build: Do not strip installed executables by default.
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 18 Jul 2016 16:49:31 +0000 (18:49 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 8 Jan 2017 12:58:54 +0000 (13:58 +0100)
The "install" target currently strips all executables while installing
them, which is not recommended according to GNU conventions. Instead,
there should exist the "install-strip" target for this purpose.

Moreover, the current install target assumes the GNU variant of
the install utility because we call install with --strip-program,
an option which is not available on *BSD.

This patch addresses both issues. It removes the autoconf check and
lets the user directly define the path to the install executable by
setting INSTALL, INSTALL_PROGRAM, INSTALL_DATA, as recommended by the
GNU project. These variables are used in the commands to be executed
when the install target is made. They have reasonable and portable
defaults, so not setting them at all should be fine on all supported
platforms, addressing the issue with --strip-program.

The new phony target install-strip runs install -s but does not try
to be smart about how to tell the install implementation which strip
program to use.

The cross compiling example can be simplified to reflect the fact
that CROSS_COMPILE is no longer used in the Makefile.

INSTALL
Makefile.in
Makefile.real
configure.ac

diff --git a/INSTALL b/INSTALL
index 85b4fab1ff04219e136ea00fe6cfb2d1a5ea97ab..547036b104d03759d79626e6ac3b686b165b88c0 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -16,10 +16,8 @@ Installing paraslash from git
 
 Example for cross-compiling
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
-       export CROSS_COMPILE='armv6j-hardfloat-linux-gnueabi-'
+       export CC='armv6j-hardfloat-linux-gnueabi-gcc'
        export PATH="/usr/cross/arm/bin:$PATH"
-       export CC=${CROSS_COMPILE}gcc
-
        export LDFLAGS='
                -L/usr/sysroot/arm/lib
                -L/usr/sysroot/arm/usr/lib
@@ -29,7 +27,7 @@ Example for cross-compiling
        autoconf
        autoheader
        ./configure --host=arm-linux-gnueabi --prefix /usr/sysroot/arm/usr/local
-       make CROSS_COMPILE=$CROSS_COMPILE
+       make
 
 For details see the user manual:
 
index ec55c8e388a78a4fb88164aa0030320738e62c6e..00a3d18f60fdee110a491371210920b3c7905026 100644 (file)
@@ -8,7 +8,6 @@ datarootdir := @datarootdir@
 PACKAGE_TARNAME := @PACKAGE_TARNAME@
 PACKAGE_VERSION := @PACKAGE_VERSION@
 
-INSTALL := @INSTALL@
 M4 := @M4@
 GENGETOPT := @GENGETOPT@
 HELP2MAN := @HELP2MAN@
index 4970696b67ec9b38a365aabb992e240b6ecce853..ef4b51c4274cf9c54be47a1f1955225ab83b67dd 100644 (file)
@@ -9,7 +9,6 @@ endif
 
 vardir := /var/paraslash
 mandir := $(datarootdir)/man/man1
-STRIP := $(CROSS_COMPILE)strip
 MKDIR_P := mkdir -p
 prefixed_executables := $(addprefix para_, $(executables))
 
@@ -63,8 +62,9 @@ tarball_pfx := $(PACKAGE_TARNAME)-$(GIT_VERSION)
 tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
 tarball := $(tarball_pfx).tar.bz2
 
-.PHONY: all mostlyclean clean distclean maintainer-clean install man tarball
 all: $(prefixed_executables) $(man_pages)
+.PHONY: all mostlyclean clean distclean maintainer-clean install \
+       install-strip man tarball
 man: $(man_pages)
 tarball: $(tarball)
 
@@ -353,11 +353,17 @@ maintainer-clean: distclean
        $(Q) rm -f *.tar.bz2
        $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
 
-install: all man
+INSTALL ?= install
+INSTALL_PROGRAM ?= $(INSTALL)
+INSTALL_DATA ?= $(INSTALL) -m 644
+ifneq ($(findstring strip, $(MAKECMDGOALS)),)
+       strip_option := -s
+endif
+
+install install-strip: all man
        $(MKDIR_P) $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)
-       $(INSTALL) -s --strip-program $(STRIP) -m 755 \
-               $(prefixed_executables) $(DESTDIR)$(bindir)
-       $(INSTALL) -m 644 $(man_pages) $(DESTDIR)$(mandir)
+       $(INSTALL) $(strip_option) $(prefixed_executables) $(DESTDIR)$(bindir)
+       $(INSTALL_DATA) $(man_pages) $(DESTDIR)$(mandir)
        $(MKDIR_P) $(DESTDIR)$(vardir) >/dev/null 2>&1 || true # not fatal, so don't complain
 
 $(tarball):
index 0b00cc2af9f006d492975a54210ce26f4e5aa56e..17227125a2d9eda2dc19c12d2904c7a568a8ca22 100644 (file)
@@ -63,10 +63,6 @@ AC_PATH_PROG([HELP2MAN], [help2man])
 test -z "$HELP2MAN" && AC_MSG_ERROR(
        [help2man is required to build this package])
 
-AC_PATH_PROG([INSTALL], [install])
-test -z "$INSTALL" && AC_MSG_ERROR(
-       [The install program is required to build this package])
-
 AC_PROG_CC
 AC_PROG_CPP