| 1 |
From a49f085a4fad61ba9dc4afc925a603888c4c3123 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Alessandro Di Nepi <[email protected]> |
| 3 |
Date: Sun, 16 Aug 2026 13:14:14 +0200 |
| 4 |
Subject: [PATCH] Honor $(STRIP) in install-strip for cross-compilation (#1024) |
| 5 |
|
| 6 |
* Honor $(STRIP) in install-strip for cross-compilation |
| 7 |
|
| 8 |
The install-strip target hard-coded `install -s`, which strips via the |
| 9 |
install program using the build host's strip and ignores the STRIP |
| 10 |
variable. When cross-compiling this runs the host strip against a |
| 11 |
target binary and fails. |
| 12 |
|
| 13 |
Pass --strip-program=$(or $(STRIP),strip) so the target strip is used |
| 14 |
when STRIP is set (as cross toolchains and build systems provide), |
| 15 |
falling back to plain `strip` for native builds. A plain `make install` |
| 16 |
is unaffected. |
| 17 |
|
| 18 |
* Make install-strip portable (address review) |
| 19 |
|
| 20 |
- Detect the target strip via AC_CHECK_TOOL([STRIP],[strip],[strip]) in |
| 21 |
configure.ac (picks up the cross-prefixed strip when cross-compiling, |
| 22 |
defaults to plain strip otherwise) and substitute @STRIP@ in Makefile.in. |
| 23 |
- Rewrite install-strip to run a normal install then $(STRIP) on the |
| 24 |
installed rsync binary, dropping the GNU Make $(or ...) and the GNU |
| 25 |
install --strip-program extension that broke with install-sh/BSD install. |
| 26 |
|
| 27 |
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> |
| 28 |
|
| 29 |
--------- |
| 30 |
|
| 31 |
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> |
| 32 |
--- |
| 33 |
Makefile.in | 4 +++- |
| 34 |
configure.ac | 1 + |
| 35 |
2 files changed, 4 insertions(+), 1 deletion(-) |
| 36 |
|
| 37 |
diff --git a/Makefile.in b/Makefile.in |
| 38 |
index 801e8643e..716171db1 100644 |
| 39 |
--- a/Makefile.in |
| 40 |
+++ b/Makefile.in |
| 41 |
@@ -21,6 +21,7 @@ LIBOBJDIR=lib/ |
| 42 |
|
| 43 |
INSTALLCMD=@INSTALL@ |
| 44 |
INSTALLMAN=@INSTALL@ |
| 45 |
+STRIP=@STRIP@ |
| 46 |
|
| 47 |
srcdir=@srcdir@ |
| 48 |
MKDIR_P=@MKDIR_P@ |
| 49 |
@@ -116,7 +117,8 @@ install-ssl-daemon: stunnel-rsyncd.conf |
| 50 |
install-all: install install-ssl-daemon |
| 51 |
|
| 52 |
install-strip: |
| 53 |
- $(MAKE) INSTALL_STRIP='-s' install |
| 54 |
+ $(MAKE) install |
| 55 |
+ $(STRIP) $(DESTDIR)$(bindir)/rsync$(EXEEXT) |
| 56 |
|
| 57 |
.PHONY: uninstall |
| 58 |
uninstall: |
| 59 |
diff --git a/configure.ac b/configure.ac |
| 60 |
index 57cf2828d..2131bfef0 100644 |
| 61 |
--- a/configure.ac |
| 62 |
+++ b/configure.ac |
| 63 |
@@ -59,6 +59,7 @@ AC_PROG_CXX |
| 64 |
AC_PROG_AWK |
| 65 |
AC_PROG_EGREP |
| 66 |
AC_PROG_INSTALL |
| 67 |
+AC_CHECK_TOOL([STRIP], [strip], [strip]) |
| 68 |
AC_PROG_MKDIR_P |
| 69 |
AC_SUBST(SHELL) |
| 70 |
AC_PATH_PROG([PERL], [perl]) |