bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

relocatable-prog: add support for stripping executables


From: Bruno Haible
Subject: relocatable-prog: add support for stripping executables
Date: Sat, 17 Jan 2009 09:50:51 +0100
User-agent: KMail/1.9.9

relocatable-prog may install one or two executables per program being
installed, depending on the system. Therefore stripping of these
executables is best done inside install-reloc. This implements it.

Attention! This is an incompatible change. Users of this module must add a
line
    RELOCATABLE_STRIP = :
to their Makefile.in or Makefile.am. If they want to implement the
install-strip target, it can be done as follows:


# Programs used by "make install-strip":
STRIP = @STRIP@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 
install_sh = @install_sh@

install-strip : force
        case '$(INSTALL_PROGRAM)' in \
          */install-reloc) \
            $(MAKE) RELOCATABLE_STRIP='$(STRIP)' ;; \
          *) \
            $(MAKE) INSTALL_PROGRAM='$(INSTALL_STRIP_PROGRAM)' ;; \
        esac


2009-01-17  Bruno Haible  <address@hidden>

        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.

--- NEWS.orig   2009-01-17 09:41:39.000000000 +0100
+++ NEWS        2009-01-17 09:40:14.000000000 +0100
@@ -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).
 
--- build-aux/install-reloc.orig        2009-01-17 09:41:39.000000000 +0100
+++ build-aux/install-reloc     2009-01-17 09:41:36.000000000 +0100
@@ -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
+    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" \
--- doc/relocatable-maint.texi.orig     2009-01-17 09:41:39.000000000 +0100
+++ doc/relocatable-maint.texi  2009-01-17 09:38:54.000000000 +0100
@@ -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
address@hidden install} installs executables without stripping them.
--- m4/relocatable.m4.orig      2009-01-17 09:41:39.000000000 +0100
+++ m4/relocatable.m4   2009-01-17 09:33:39.000000000 +0100
@@ -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" ;;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]