From b8462c05181331456c9136877d2539b4f43a01cb Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 17 Jan 2009 09:46:08 +0100 Subject: [PATCH] Support for stripping executables in --enable-relocatable. --- ChangeLog | 12 ++++++++++++ NEWS | 3 +++ build-aux/install-reloc | 29 +++++++++++++++++++++-------- doc/relocatable-maint.texi | 5 ++++- m4/relocatable.m4 | 4 ++-- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65f6f67ca..3d0769de1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2009-01-17 Bruno Haible + Support for stripping executables in --enable-relocatable. + * build-aux/install-reloc: Expect one more argument, or an environment + variable RELOC_STRIP_PROG. If set, strip the destination program and + its wrapper. + * m4/relocatable.m4 (gl_RELOCATABLE_BODY): In INSTALL_PROGRAM_ENV, set + RELOC_STRIP_PROG. + * doc/relocatable-maint.texi (Supporting Relocation): Mention the need + to set RELOCATABLE_STRIP. + * NEWS: Mention the new Makefile requirement. + +2009-01-17 Bruno Haible + * build-aux/install-reloc: Remove debugging information left over by C compiler on MacOS X. diff --git a/NEWS b/NEWS index 10f419e93..650c4161f 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ User visible incompatible changes Date Modules Changes +2009-01-17 relocatable-prog In the Makefile.am or Makefile.in, you now also + need to set RELOCATABLE_STRIP = :. + 2008-12-22 getaddrinfo When using this module, you now need to link with canon-host $(GETADDRINFO_LIB). diff --git a/build-aux/install-reloc b/build-aux/install-reloc index 81aff878c..4d02cc137 100755 --- a/build-aux/install-reloc +++ b/build-aux/install-reloc @@ -18,7 +18,8 @@ # Usage: # install-reloc library_path_var library_path_value prefix destdir \ -# compile_command srcdir config_h_dir exeext \ +# compile_command srcdir builddir config_h_dir exeext \ +# strip_command \ # install_command... destprog # where # - library_path_var is the platform dependent runtime library path variable @@ -34,7 +35,9 @@ # alloca.h and stdbool.h) # - config_h_dir is the directory where to find config.h # - exeext is platform dependent suffix of executables -# - install-command is the install command line, excluding the final destprog +# - strip_command is the command for stripping executables, or : if no +# stripping is desired +# - install_command is the install command line, excluding the final destprog # - destprog is the destination program name # install-reloc renames destprog to destprog.bin and installs a relocating # wrapper in the place of destprog. @@ -52,33 +55,37 @@ if test $# -eq 2; then builddir=$RELOC_BUILDDIR config_h_dir=$RELOC_CONFIG_H_DIR exeext=$RELOC_EXEEXT + strip_prog=$RELOC_STRIP_PROG install_prog=$RELOC_INSTALL_PROG # including the "-c" option else - if test $# -ge 10; then + if test $# -ge 11; then # Get fixed position arguments. library_path_var=$1 library_path_value=$2 prefix=$3 destdir=$4 - compile_command=$5 - srcdir=$6 - builddir=$7 - config_h_dir=$8 - exeext=$9 shift shift shift shift + compile_command=$1 + srcdir=$2 + builddir=$3 + config_h_dir=$4 + exeext=$5 shift shift shift shift shift + strip_prog=$1 + shift install_prog=$1 # maybe not including the "-c" option shift else echo "Usage: $0 library_path_var library_path_value prefix destdir" \ "compile_command srcdir builddir config_h_dir exeext" \ + "strip_command" \ "install_command... destprog" 1>&2 exit 1 fi @@ -107,6 +114,9 @@ func_verbose () # Run install_command. func_verbose $install_prog "$@" || exit $? +# Run strip_command. +test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog$exeext" || exit $? + # If the platform doesn't support LD_LIBRARY_PATH or similar, we cannot build # a wrapper. test -n "$library_path_var" || exit 0 @@ -173,6 +183,9 @@ test $rc = 0 || exit $? rm -rf "$destprog.wrapper$exeext.dSYM" test $rc = 0 || exit $? +# Strip wrapper. +test "$strip_prog" = ':' || func_verbose "$strip_prog" "$destprog.wrapper$exeext" || exit $? + # Rename $destprog.wrapper -> $destprog -> $destprog.bin. ln -f "$destprog$exeext" "$destprog.bin$exeext" \ || { rm -f "$destprog.bin$exeext" \ diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi index 86e6fa0af..ab7cdcdfc 100644 --- a/doc/relocatable-maint.texi +++ b/doc/relocatable-maint.texi @@ -125,7 +125,7 @@ endif @end example @item -You may also need to add one or two variable assignments to your +You may also need to add a couple of variable assignments to your @file{configure.ac}. If your package (or any package you rely on, e.g.@: gettext-runtime) @@ -142,3 +142,6 @@ If your @file{config.h} is not in @file{$(top_builddir)}, then set RELOCATABLE_CONFIG_H_DIR='$(top_builddir)/src' @end example @end enumerate + +Set @var{RELOCATABLE_STRIP} to @code{:}. This is needed so that +@samp{make install} installs executables without stripping them. diff --git a/m4/relocatable.m4 b/m4/relocatable.m4 index 1386892a7..b4a87afe6 100644 --- a/m4/relocatable.m4 +++ b/m4/relocatable.m4 @@ -1,4 +1,4 @@ -# relocatable.m4 serial 13 +# relocatable.m4 serial 14 dnl Copyright (C) 2003, 2005-2007, 2009 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -62,7 +62,7 @@ AC_DEFUN([gl_RELOCATABLE_BODY], dnl consisting of more than one word - libtool doesn't support this. dnl So we abuse the INSTALL_PROGRAM_ENV hook, originally meant for the dnl 'install-strip' target. - INSTALL_PROGRAM_ENV="RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" RELOC_COMPILE_COMMAND=\"\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS)\" RELOC_SRCDIR=\"\$(RELOCATABLE_SRC_DIR)\" RELOC_BUILDDIR=\"\$(RELOCATABLE_BUILD_DIR)\" RELOC_CONFIG_H_DIR=\"\$(RELOCATABLE_CONFIG_H_DIR)\" RELOC_EXEEXT=\"\$(EXEEXT)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\"" + INSTALL_PROGRAM_ENV="RELOC_LIBRARY_PATH_VAR=\"$shlibpath_var\" RELOC_LIBRARY_PATH_VALUE=\"\$(RELOCATABLE_LIBRARY_PATH)\" RELOC_PREFIX=\"\$(prefix)\" RELOC_DESTDIR=\"\$(DESTDIR)\" RELOC_COMPILE_COMMAND=\"\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(LDFLAGS)\" RELOC_SRCDIR=\"\$(RELOCATABLE_SRC_DIR)\" RELOC_BUILDDIR=\"\$(RELOCATABLE_BUILD_DIR)\" RELOC_CONFIG_H_DIR=\"\$(RELOCATABLE_CONFIG_H_DIR)\" RELOC_EXEEXT=\"\$(EXEEXT)\" RELOC_STRIP_PROG=\"\$(RELOCATABLE_STRIP)\" RELOC_INSTALL_PROG=\"$INSTALL_PROGRAM\"" AC_SUBST([INSTALL_PROGRAM_ENV]) case "$ac_aux_dir" in /*) INSTALL_PROGRAM="$ac_aux_dir/install-reloc" ;; -- 2.11.0