1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Remove build.mk usage

First step when creating the `configure` script is currently using
make. This is helpful when developing buildsystem to only rebuild
`configure` and `main/php_config.h.in` files when one of the *.m4
or configure.ac file changes and saves the developer time a little.

Realistically however, it is not needed that much considering the
times of several seconds to fully rebuild the configure script and
configuration header. The next step when running the `configure`
script is much more time consuming so performance on buildconf
level is a bit questionable and won't be noticed on today's
systems.

Additionally:
- buildconf now removes cache and all targets and uses -f option on
  the first step i.e. autoconf. The autoheader does not need the -f
  option in this case.

Closes GH-4437
This commit is contained in:
Peter Kokot
2019-07-21 11:40:23 +02:00
parent 1b969a74d0
commit ef165b4422
3 changed files with 29 additions and 68 deletions

View File

@@ -9,7 +9,7 @@ end_of_line = lf
charset = utf-8
tab_width = 4
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
indent_size = 4
indent_style = tab

View File

@@ -1,40 +0,0 @@
# +----------------------------------------------------------------------+
# | PHP Version 7 |
# +----------------------------------------------------------------------+
# | Copyright (c) The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | that is bundled with this package in the file LICENSE, and is |
# | available through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | If you did not receive a copy of the PHP license and are unable to |
# | obtain it through the world-wide-web, please send a note to |
# | license@php.net so we can mail you a copy immediately. |
# +----------------------------------------------------------------------+
# | Author: Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
#
# Makefile to generate build tools
#
config_h_in = main/php_config.h.in
PHP_AUTOCONF = autoconf
PHP_AUTOHEADER = autoheader
PHP_AUTOCONF_FLAGS = -f
all: configure $(config_h_in)
configure: configure.ac $(PHP_M4_FILES)
# Remove aclocal.m4 if present. It is automatically included by autoconf but
# not used by the PHP build system since PHP 7.4.
@echo rebuilding $@
@rm -f $@ aclocal.m4
@$(PHP_AUTOCONF) $(PHP_AUTOCONF_FLAGS)
$(config_h_in): configure
# Explicitly remove target since autoheader does not seem to work correctly
# otherwise (timestamps are not updated).
@echo rebuilding $@
@rm -f $@
@$(PHP_AUTOHEADER) $(PHP_AUTOCONF_FLAGS)

View File

@@ -2,7 +2,6 @@
#
# A wrapper around Autoconf that generates files to build PHP on *nix systems.
MAKE=${MAKE:-make}
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
force=0
@@ -38,15 +37,13 @@ SYNOPSIS:
buildconf [<options>]
OPTIONS:
-f, --force Clean cache and overwrite configure files.
-f, --force Regenerate configure files in PHP release packages.
--debug Display warnings emitted by Autoconf.
-h, --help Display this help.
ENVIRONMENT:
The following optional variables are supported:
MAKE Overrides the path to make tool.
MAKE=/path/to/make ./buildconf
PHP_AUTOCONF Overrides the path to autoconf tool.
PHP_AUTOCONF=/path/to/autoconf ./buildconf
PHP_AUTOHEADER Overrides the path to autoheader tool.
@@ -66,24 +63,18 @@ HELP
shift
done
if test "$dev" = "0" -a "$force" = "0"; then
if test -f "configure"; then
echo "The configure script has already been built for you. All done."
echo "Run ./configure to proceed with customizing the PHP build."
if test "$dev" = "0" && test "$force" = "0"; then
if test -f "configure" && test -f "main/php_config.h.in"; then
echo "buildconf: The configure script is already built. All done."
echo " Run ./configure to proceed with customizing the PHP build."
exit 0
else
echo "Configure script is missing." >&2
echo "Run ./buildconf --force to create a configure script." >&2
echo "buildconf: Configure files are missing." >&2
echo " Run ./buildconf --force to create a configure script." >&2
exit 1
fi
fi
if test "$force" = "1"; then
echo "buildconf: Forcing buildconf"
echo "buildconf: Removing configure caches and files"
rm -rf autom4te.cache config.cache configure
fi
echo "buildconf: Checking installation"
# Get minimum required autoconf version from the configure.ac file.
@@ -114,23 +105,33 @@ else
echo "buildconf: autoconf version $ac_version (ok)"
fi
# Check if make exists.
if ! test -x "$(command -v $MAKE)"; then
echo "buildconf: make not found." >&2
echo " You need to have make installed to build PHP." >&2
exit 1
if test "$force" = "1"; then
echo "buildconf: Forcing buildconf. The configure files will be regenerated."
fi
echo "buildconf: Building configure files"
# Clean cache and explicitly remove all targets if present. Remove also
# aclocal.m4 if present. It is automatically included by autoconf but not used
# by the PHP build system since PHP 7.4.
echo "buildconf: Cleaning cache and configure files"
rm -rf \
aclocal.m4 \
autom4te.cache \
config.cache \
configure \
main/php_config.h.in
if test "$debug" = "1"; then
autoconf_flags="-f -Wall"
autoheader_flags="-Wall"
else
autoconf_flags="-f"
autoheader_flags=""
fi
$MAKE -s -f build/build.mk \
PHP_AUTOCONF="$PHP_AUTOCONF" \
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
echo "buildconf: Rebuilding configure"
$PHP_AUTOCONF $autoconf_flags
echo "buildconf: Rebuilding main/php_config.h.in"
$PHP_AUTOHEADER $autoheader_flags
echo "buildconf: Run ./configure to proceed with customizing the PHP build."