From c707bc71fe371b942c0d9d14ecd7913929c7348b Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 30 Jan 2025 02:37:31 +0000 Subject: [PATCH] sapi/*/Makefile.frag: install programs built with libtool, with libtool When installing executables that were built using libtool, we are supposed to use $ libtool --mode-install rather than the bare . This is discussed ever so briefly in the "Installing executables" section of the GNU libtool documentation: https://www.gnu.org/software/libtool/manual/libtool.html So far this has not caused a problem with GNU libtool on the platforms that PHP supports, but there is an alternate libtool implementation called slibtool that stores wrappers at the locations where PHP is expecting the true executables to live. As a result, the wrappers (and not the executables) are installed when slibtool is used to build PHP. This is fixed by replacing, $(INSTALL) with $(LIBTOOL) --mode=install $(INSTALL) in the install-foo rules for the executables that are built with libtool. Closes GH-13674 --- sapi/cgi/Makefile.frag | 2 +- sapi/cli/Makefile.frag | 2 +- sapi/fpm/Makefile.frag | 2 +- sapi/litespeed/Makefile.frag | 2 +- sapi/phpdbg/Makefile.frag | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sapi/cgi/Makefile.frag b/sapi/cgi/Makefile.frag index 79e2afec25455..eeadc7d3864ce 100644 --- a/sapi/cgi/Makefile.frag +++ b/sapi/cgi/Makefile.frag @@ -6,7 +6,7 @@ $(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_FASTCGI_OBJS) $(PH install-cgi: $(SAPI_CGI_PATH) @echo "Installing PHP CGI binary: $(INSTALL_ROOT)$(bindir)/" @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) - @$(INSTALL) -m 0755 $(SAPI_CGI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php-cgi$(program_suffix)$(EXEEXT) + @$(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(SAPI_CGI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php-cgi$(program_suffix)$(EXEEXT) @echo "Installing PHP CGI man page: $(INSTALL_ROOT)$(mandir)/man1/" @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 @$(INSTALL_DATA) sapi/cgi/php-cgi.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)php-cgi$(program_suffix).1 diff --git a/sapi/cli/Makefile.frag b/sapi/cli/Makefile.frag index aa1d642b9cd6f..52150d92d528b 100644 --- a/sapi/cli/Makefile.frag +++ b/sapi/cli/Makefile.frag @@ -6,7 +6,7 @@ $(SAPI_CLI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_CLI_OBJS) install-cli: $(SAPI_CLI_PATH) @echo "Installing PHP CLI binary: $(INSTALL_ROOT)$(bindir)/" @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) - @$(INSTALL) -m 0755 $(SAPI_CLI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT) + @$(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(SAPI_CLI_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)php$(program_suffix)$(EXEEXT) @echo "Installing PHP CLI man page: $(INSTALL_ROOT)$(mandir)/man1/" @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 @$(INSTALL_DATA) sapi/cli/php.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)php$(program_suffix).1 diff --git a/sapi/fpm/Makefile.frag b/sapi/fpm/Makefile.frag index c6a290f9d59bf..8c90e8c00daaa 100644 --- a/sapi/fpm/Makefile.frag +++ b/sapi/fpm/Makefile.frag @@ -8,7 +8,7 @@ install-fpm: $(SAPI_FPM_PATH) @$(mkinstalldirs) $(INSTALL_ROOT)$(sbindir) @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/log @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run - @$(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROOT)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT) + @$(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(SAPI_FPM_PATH) $(INSTALL_ROOT)$(sbindir)/$(program_prefix)php-fpm$(program_suffix)$(EXEEXT) @if test -f "$(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf"; then \ echo "Installing PHP FPM defconfig: skipping"; \ diff --git a/sapi/litespeed/Makefile.frag b/sapi/litespeed/Makefile.frag index 2010d8d6235fd..d33d467c7deff 100644 --- a/sapi/litespeed/Makefile.frag +++ b/sapi/litespeed/Makefile.frag @@ -6,4 +6,4 @@ $(SAPI_LITESPEED_PATH): $(PHP_GLOBAL_OBJS) $(PHP_BINARY_OBJS) $(PHP_LITESPEED_OB install-litespeed: $(SAPI_LITESPEED_PATH) @echo "Installing PHP LiteSpeed binary: $(INSTALL_ROOT)$(bindir)/" @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) - @$(INSTALL) -m 0755 $(SAPI_LITESPEED_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)lsphp$(program_suffix) + @$(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(SAPI_LITESPEED_PATH) $(INSTALL_ROOT)$(bindir)/$(program_prefix)lsphp$(program_suffix) diff --git a/sapi/phpdbg/Makefile.frag b/sapi/phpdbg/Makefile.frag index 2e2faf803b00d..f47870b092aa6 100644 --- a/sapi/phpdbg/Makefile.frag +++ b/sapi/phpdbg/Makefile.frag @@ -25,7 +25,7 @@ install-phpdbg: $(BUILD_BINARY) @$(mkinstalldirs) $(INSTALL_ROOT)$(bindir) @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/log @$(mkinstalldirs) $(INSTALL_ROOT)$(localstatedir)/run - @$(INSTALL) -m 0755 $(BUILD_BINARY) $(INSTALL_ROOT)$(bindir)/$(program_prefix)phpdbg$(program_suffix)$(EXEEXT) + @$(LIBTOOL) --mode=install $(INSTALL) -m 0755 $(BUILD_BINARY) $(INSTALL_ROOT)$(bindir)/$(program_prefix)phpdbg$(program_suffix)$(EXEEXT) @echo "Installing phpdbg man page: $(INSTALL_ROOT)$(mandir)/man1/" @$(mkinstalldirs) $(INSTALL_ROOT)$(mandir)/man1 @$(INSTALL_DATA) sapi/phpdbg/phpdbg.1 $(INSTALL_ROOT)$(mandir)/man1/$(program_prefix)phpdbg$(program_suffix).1