From 8c263008bbd9c1ce221276229e548d7b15dcb0d0 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 11 Jan 2016 14:23:45 +0000 Subject: [PATCH] build: Calculate ABS_GLIB_RUNTIME_LIBDIR at build time Rather than calculating it at configure time. This means it can expand $libdir properly, and use the Make $(realpath) function rather than invoking the non-portable `readlink -f`. This fixes problems where `readlink` would be called on an invalid path (due to a variable not being expanded) and would evaluate to "", which would then cause things to be installed in the wrong place. https://bugzilla.gnome.org/show_bug.cgi?id=744772 --- configure.ac | 4 ---- gio/Makefile.am | 6 ++++++ glib/Makefile.am | 13 +++++++++++++ gobject/Makefile.am | 14 ++++++++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 677b1eed2..1af90c5ec 100644 --- a/configure.ac +++ b/configure.ac @@ -282,9 +282,7 @@ AC_ARG_WITH(runtime-libdir, [], [with_runtime_libdir=""]) GLIB_RUNTIME_LIBDIR="$with_runtime_libdir" -ABS_GLIB_RUNTIME_LIBDIR="`readlink -f $libdir/$with_runtime_libdir`" AC_SUBST(GLIB_RUNTIME_LIBDIR) -AC_SUBST(ABS_GLIB_RUNTIME_LIBDIR) AM_CONDITIONAL(HAVE_GLIB_RUNTIME_LIBDIR, [test "x$with_runtime_libdir" != "x"]) dnl Check for a working C++ compiler, but do not bail out, if none is found. @@ -3395,7 +3393,6 @@ build/win32/vs11/Makefile build/win32/vs12/Makefile build/win32/vs14/Makefile glib/Makefile -glib/glib.stp glib/libcharset/Makefile glib/gnulib/Makefile glib/pcre/Makefile @@ -3404,7 +3401,6 @@ glib/tests/Makefile gmodule/Makefile gmodule/gmoduleconf.h gobject/Makefile -gobject/gobject.stp gobject/glib-mkenums gobject/tests/Makefile gthread/Makefile diff --git a/gio/Makefile.am b/gio/Makefile.am index b5b61201c..e911d9145 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -828,6 +828,12 @@ dist-hook: \ if test -f $$f; then d=.; else d=$(srcdir); fi; \ cp $$d/$$f $(distdir) || exit 1; done +if HAVE_GLIB_RUNTIME_LIBDIR +ABS_GLIB_RUNTIME_LIBDIR = $(realpath $(libdir)/$(GLIB_RUNTIME_LIBDIR)) +else +ABS_GLIB_RUNTIME_LIBDIR = $(libdir) +endif + if HAVE_GLIB_RUNTIME_LIBDIR install-data-hook: mkdir -p $(DESTDIR)$(libdir)/$(GLIB_RUNTIME_LIBDIR) diff --git a/glib/Makefile.am b/glib/Makefile.am index 2783b51da..e9ded1603 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -382,6 +382,14 @@ tapset_in_files = glib.stp.in tapsetdir = @ABS_TAPSET_DIR@ tapset_DATA = $(tapset_in_files:.stp.in=.stp) EXTRA_DIST += $(tapset_in_files) +CLEANFILES += $(tapset_in_files:.stp.in=.stp) + +$(tapset_DATA): %.stp: %.stp.in Makefile + $(AM_V_GEN)$(SED) \ + -e 's|[@]ABS_GLIB_RUNTIME_LIBDIR[@]|$(ABS_GLIB_RUNTIME_LIBDIR)|g' \ + -e 's|[@]LT_CURRENT[@]|$(LT_CURRENT)|g' \ + -e 's|[@]LT_REVISION[@]|$(LT_REVISION)|g' \ + $< > $@ endif gspawn-win32-helper-console.c: @@ -473,6 +481,11 @@ dist_gdb_SCRIPTS = glib.py libglib-gdb.py: libglib-gdb.py.in $(AM_V_GEN) $(SED) -e "s|\@datadir\@|$(datadir)|" $(srcdir)/libglib-gdb.py.in > $(builddir)/libglib-gdb.py +if HAVE_GLIB_RUNTIME_LIBDIR +ABS_GLIB_RUNTIME_LIBDIR = $(realpath $(libdir)/$(GLIB_RUNTIME_LIBDIR)) +else +ABS_GLIB_RUNTIME_LIBDIR = $(libdir) +endif install-data-hook: libglib-gdb.py mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load$(ABS_GLIB_RUNTIME_LIBDIR) diff --git a/gobject/Makefile.am b/gobject/Makefile.am index 5512c7e5d..c19ece595 100644 --- a/gobject/Makefile.am +++ b/gobject/Makefile.am @@ -130,6 +130,14 @@ tapset_in_files = gobject.stp.in tapsetdir = @ABS_TAPSET_DIR@ tapset_DATA = $(tapset_in_files:.stp.in=.stp) EXTRA_DIST += $(tapset_in_files) +CLEANFILES += $(tapset_in_files:.stp.in=.stp) + +$(tapset_DATA): %.stp: %.stp.in Makefile + $(AM_V_GEN)$(SED) \ + -e 's|[@]ABS_GLIB_RUNTIME_LIBDIR[@]|$(ABS_GLIB_RUNTIME_LIBDIR)|g' \ + -e 's|[@]LT_CURRENT[@]|$(LT_CURRENT)|g' \ + -e 's|[@]LT_REVISION[@]|$(LT_REVISION)|g' \ + $< > $@ endif # non-header sources (headers should be specified in the above variables) @@ -260,6 +268,12 @@ libgobject-gdb.py: libgobject-gdb.py.in uninstall-gdb: -rm -r $(DESTDIR)$(datadir)/gdb +if HAVE_GLIB_RUNTIME_LIBDIR +ABS_GLIB_RUNTIME_LIBDIR = $(realpath $(libdir)/$(GLIB_RUNTIME_LIBDIR)) +else +ABS_GLIB_RUNTIME_LIBDIR = $(libdir) +endif + install-data-hook: libgobject-gdb.py mkdir -p $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR) $(INSTALL) $(builddir)/libgobject-gdb.py $(DESTDIR)$(datadir)/gdb/auto-load/$(ABS_GLIB_RUNTIME_LIBDIR)/libgobject-2.0.so.0.$(LT_CURRENT).$(LT_REVISION)-gdb.py