Support for stripping executables in --enable-relocatable.
authorBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2009 08:46:08 +0000 (09:46 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 17 Jan 2009 08:46:08 +0000 (09:46 +0100)
ChangeLog
NEWS
build-aux/install-reloc
doc/relocatable-maint.texi
m4/relocatable.m4

index 65f6f67..3d0769d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 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
        C compiler on MacOS X.
 
diff --git a/NEWS b/NEWS
index 10f419e..650c416 100644 (file)
--- 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).
 
index 81aff87..4d02cc1 100755 (executable)
@@ -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" \
index 86e6fa0..ab7cdcd 100644 (file)
@@ -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.
index 1386892..b4a87af 100644 (file)
@@ -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" ;;