Create modules directory in a centralized location (#13411)

Shared objects of extensions during the *nix build are copied to the
`modules` directory. It is a practice established since the early days
of the PHP build system. Other build systems may have similar concept of
"library destination directory". On Windows, they are put into the root
build directory. Such directory simplifies collection of the shared
extensions during testing, or when running the cli executable at the end
of the build process.

This change ensures that the directory is consistently created in a
single location, for both the primary PHP build process and when
utilizing `phpize` within community extensions.

The AC_CONFIG_COMMANDS_PRE is executed at the end of the configuration
phase, before creating the config.status script, where also build
directories and global Makefile are created.

The pwd is executed using the recommended $(...) instead of the obsolete
backticks. Autoconf automatically locates the proper shell and
re-executes the configure script if such case is found that $(...) is
not supported (the initial /bin/sh on Solaris 10, for example).
This commit is contained in:
Peter Kokot 2024-03-21 17:43:49 +01:00 committed by GitHub
parent 79e4ca1e41
commit 530e0d68eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 13 deletions

View File

@ -128,6 +128,15 @@ AC_DEFUN([PHP_INIT_BUILD_SYSTEM],[
AC_REQUIRE([PHP_CANONICAL_HOST_TARGET])dnl
> Makefile.objects
> Makefile.fragments
dnl Run at the end of the configuration, before creating the config.status.
AC_CONFIG_COMMANDS_PRE(
[dnl Directory for storing shared objects of extensions.
PHP_ADD_BUILD_DIR([modules])
phplibdir="$(pwd)/modules"
PHP_SUBST([phplibdir])
PHP_GEN_BUILD_DIRS
PHP_GEN_GLOBAL_MAKEFILE
])dnl
])
dnl
@ -136,6 +145,7 @@ dnl
dnl Generates the global makefile.
dnl
AC_DEFUN([PHP_GEN_GLOBAL_MAKEFILE],[
AC_MSG_NOTICE([creating Makefile])
cat >Makefile <<EOF
srcdir = $abs_srcdir
builddir = $abs_builddir
@ -881,6 +891,7 @@ dnl
dnl PHP_GEN_BUILD_DIRS
dnl
AC_DEFUN([PHP_GEN_BUILD_DIRS],[
AC_MSG_NOTICE([creating build directories])
$php_shtool mkdir -p $BUILD_DIR
])

View File

@ -1380,8 +1380,6 @@ case `eval echo $datadir` in
;;
esac
phplibdir=`pwd`/modules
$php_shtool mkdir -p $phplibdir
phptempdir=`pwd`/libs
old_exec_prefix=$exec_prefix
@ -1508,7 +1506,6 @@ PHP_SUBST_OLD(program_suffix)
PHP_SUBST(includedir)
PHP_SUBST(libdir)
PHP_SUBST(mandir)
PHP_SUBST(phplibdir)
PHP_SUBST(phptempdir)
PHP_SUBST(prefix)
PHP_SUBST(localstatedir)
@ -1750,9 +1747,6 @@ PHP_ADD_BUILD_DIR(Zend Zend/asm Zend/Optimizer)
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts)
PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend)
PHP_GEN_BUILD_DIRS
PHP_GEN_GLOBAL_MAKEFILE
AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
dnl Make directories when building in a separate build directory.

View File

@ -162,7 +162,6 @@ AC_PROG_LIBTOOL
all_targets='$(PHP_MODULES) $(PHP_ZEND_EX)'
install_targets="install-modules install-headers"
phplibdir="`pwd`/modules"
CPPFLAGS="$CPPFLAGS -DHAVE_CONFIG_H"
CFLAGS_CLEAN='$(CFLAGS) -D_GNU_SOURCE'
CXXFLAGS_CLEAN='$(CXXFLAGS)'
@ -188,7 +187,6 @@ PHP_SUBST(prefix)
PHP_SUBST(exec_prefix)
PHP_SUBST(libdir)
PHP_SUBST(prefix)
PHP_SUBST(phplibdir)
PHP_SUBST(phpincludedir)
PHP_SUBST(CC)
@ -210,11 +208,6 @@ PHP_SUBST(SHELL)
PHP_SUBST(INSTALL_HEADERS)
PHP_SUBST(BUILD_CC)
PHP_GEN_BUILD_DIRS
PHP_GEN_GLOBAL_MAKEFILE
test -d modules || $php_shtool mkdir modules
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([config.h.in])])