changeset 11028:29b9820e29f2

Support for stripping executables in --enable-relocatable.
author Bruno Haible <bruno@clisp.org>
date Sat, 17 Jan 2009 09:46:08 +0100
parents fa0076bdc391
children 10f80546fa7e
files ChangeLog NEWS build-aux/install-reloc doc/relocatable-maint.texi m4/relocatable.m4
diffstat 5 files changed, 45 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-01-17  Bruno Haible  <bruno@clisp.org>
+
+	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  <bruno@clisp.org>
 
 	* build-aux/install-reloc: Remove debugging information left over by
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@
 
 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).
 
--- 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 @@
   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
-    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 @@
 # 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 @@
 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" \
--- a/doc/relocatable-maint.texi
+++ b/doc/relocatable-maint.texi
@@ -125,7 +125,7 @@
 @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 @@
 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.
--- 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 @@
         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" ;;