summaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-10 22:58:22 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2009-06-10 22:58:22 +0000
commitd94e5be7eab96e22ec7d05f44756a594443e3192 (patch)
tree700389077d760887c668dca195c3a7ee1960fd8b /libstdc++-v3
parent9448096b9e2d3c1c8230ccf6b6faccb4a5448c69 (diff)
downloadgcc-d94e5be7eab96e22ec7d05f44756a594443e3192.tar.gz
PR libstdc++/40289:
* python/Makefile.in: Rebuild. * python/hook.in: Compute module path relative to objfile. * python/Makefile.am (pythondir): Redefine. (gdb.py): Subst toolexeclibdir. (install-data-local): Rewrite. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148357 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/python/Makefile.am23
-rw-r--r--libstdc++-v3/python/Makefile.in18
-rw-r--r--libstdc++-v3/python/hook.in32
4 files changed, 74 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index d8d9361e523..642fff10c98 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,12 @@
+2009-06-10 Tom Tromey <tromey@redhat.com>
+
+ PR libstdc++/40289:
+ * python/Makefile.in: Rebuild.
+ * python/hook.in: Compute module path relative to objfile.
+ * python/Makefile.am (pythondir): Redefine.
+ (gdb.py): Subst toolexeclibdir.
+ (install-data-local): Rewrite.
+
2009-06-09 Benjamin Kosnik <bkoz@redhat.com>
* include/bits/move.h: Doxygen group fixes.
diff --git a/libstdc++-v3/python/Makefile.am b/libstdc++-v3/python/Makefile.am
index bcc8afea1eb..50cc6d94541 100644
--- a/libstdc++-v3/python/Makefile.am
+++ b/libstdc++-v3/python/Makefile.am
@@ -24,7 +24,7 @@
include $(top_srcdir)/fragment.am
## Where to install the module code.
-pythondir = $(pkgdatadir)/python
+pythondir = $(datadir)/gcc-$(gcc_version)/python
all-local: gdb.py
@@ -34,10 +34,27 @@ nobase_python_DATA = \
libstdcxx/__init__.py
gdb.py: hook.in Makefile
- sed -e 's,@dir@,$(pythondir),' < $(srcdir)/hook.in > $@
+ sed -e 's,@pythondir@,$(pythondir),' \
+ -e 's,@toolexeclibdir@,$(toolexeclibdir),' < $(srcdir)/hook.in > $@
install-data-local: gdb.py
@$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
- @libname=`cd $(toolexeclibdir) && ls -r libstdc++* | fgrep -v gdb.py | sed 1q`; \
+## We want to install gdb.py as SOMETHING-gdb.py. SOMETHING is the
+## full name of the final library. We want to ignore symlinks, the
+## .la file, and any previous -gdb.py file. This is inherently
+## fragile, but there does not seem to be a better option, because
+## libtool hides the real names from us.
+ @here=`pwd`; cd $(toolexeclibdir); \
+ for file in libstdc++*; do \
+ case $$file in \
+ *-gdb.py) ;; \
+ *.la) ;; \
+ *) if test -h $$file; then \
+ continue; \
+ fi; \
+ libname=$$file;; \
+ esac; \
+ done; \
+ cd $$here; \
echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
diff --git a/libstdc++-v3/python/Makefile.in b/libstdc++-v3/python/Makefile.in
index 879f040d606..88cc7ea34c3 100644
--- a/libstdc++-v3/python/Makefile.in
+++ b/libstdc++-v3/python/Makefile.in
@@ -298,7 +298,7 @@ WARN_CXXFLAGS = \
# -I/-D flags to pass when compiling.
AM_CPPFLAGS = $(GLIBCXX_INCLUDES)
-pythondir = $(pkgdatadir)/python
+pythondir = $(datadir)/gcc-$(gcc_version)/python
nobase_python_DATA = \
libstdcxx/v6/printers.py \
libstdcxx/v6/__init__.py \
@@ -492,11 +492,23 @@ uninstall-am: uninstall-info-am uninstall-nobase_pythonDATA
all-local: gdb.py
gdb.py: hook.in Makefile
- sed -e 's,@dir@,$(pythondir),' < $(srcdir)/hook.in > $@
+ sed -e 's,@pythondir@,$(pythondir),' \
+ -e 's,@toolexeclibdir@,$(toolexeclibdir),' < $(srcdir)/hook.in > $@
install-data-local: gdb.py
@$(mkdir_p) $(DESTDIR)$(toolexeclibdir)
- @libname=`cd $(toolexeclibdir) && ls -r libstdc++* | fgrep -v gdb.py | sed 1q`; \
+ @here=`pwd`; cd $(toolexeclibdir); \
+ for file in libstdc++*; do \
+ case $$file in \
+ *-gdb.py) ;; \
+ *.la) ;; \
+ *) if test -h $$file; then \
+ continue; \
+ fi; \
+ libname=$$file;; \
+ esac; \
+ done; \
+ cd $$here; \
echo " $(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py"; \
$(INSTALL_DATA) gdb.py $(DESTDIR)$(toolexeclibdir)/$$libname-gdb.py
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/libstdc++-v3/python/hook.in b/libstdc++-v3/python/hook.in
index fe7c0722484..f7bf1afb44d 100644
--- a/libstdc++-v3/python/hook.in
+++ b/libstdc++-v3/python/hook.in
@@ -16,9 +16,37 @@
import sys
import gdb
+import os
+import os.path
+
+pythondir = '@pythondir@'
+libdir = '@toolexeclibdir@'
+
+# Update module path. We want to find the relative path from libdir
+# to pythondir, and then we want to apply that relative path to the
+# directory holding the objfile with which this file is associated.
+# This preserves relocatability of the gcc tree.
+
+# Do a simple normalization that removes duplicate separators.
+pythondir = os.path.join (*['/'] + pythondir.split (os.sep))
+libdir = os.path.join (*['/'] + libdir.split (os.sep))
+
+prefix = os.path.commonprefix ([libdir, pythondir])
+# In some bizarre configuration we might have found a match in the
+# middle of a directory name.
+if prefix[-1] != '/':
+ prefix = os.path.dirname (prefix)
+
+# Strip off the prefix.
+pythondir = pythondir[len (prefix):]
+libdir = libdir[len (prefix):]
+
+# Compute the ".."s needed to get from libdir to the prefix.
+dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
+
+objfile = gdb.current_objfile ().filename
+dir = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
-# Update module path.
-dir = '@dir@'
if not dir in sys.path:
sys.path.insert(0, dir)