Simplify checking of *nix build tools

The buildmk.stamp file has been created by the *nix build checking step
to run the check step only once. Instead of poluting the project root
directory, the stamp file can be also omitted. Performance difference is
very minimal to not justify having the stamp check at all today anymore.

This patch integrates the buildcheck.sh to buildconf script directly.
This commit is contained in:
Peter Kokot 2019-04-27 17:21:56 +02:00
parent b931dacc88
commit c79eb107a0
6 changed files with 39 additions and 92 deletions

5
.gitignore vendored
View file

@ -38,12 +38,9 @@
# Standard object files generated during build process
*.o
# Cache directories generated by Autoconf tools - autoconf, autoreconf...
# Cache directories created by Autoconf tools
autom4te.cache/
# Stamp file generated by `./buildconf` to run `./build/buildcheck.sh`
/buildmk.stamp
# Cache file(s) generated by Autoconf's configure when run as `configure -C`
config.cache

View file

@ -118,7 +118,7 @@ clean:
rm -f libphp$(PHP_MAJOR_VERSION).la $(SAPI_CLI_PATH) $(SAPI_CGI_PATH) $(SAPI_LITESPEED_PATH) $(SAPI_FPM_PATH) $(OVERALL_TARGET) modules/* libs/*
distclean: clean
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c buildmk.stamp Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f Makefile config.cache config.log config.status Makefile.objects Makefile.fragments libtool main/php_config.h main/internal_functions_cli.c main/internal_functions.c Zend/zend_dtrace_gen.h Zend/zend_dtrace_gen.h.bak Zend/zend_config.h TSRM/tsrm_config.h
rm -f main/build-defs.h scripts/phpize
rm -f ext/date/lib/timelib_config.h ext/mbstring/libmbfl/config.h ext/oci8/oci8_dtrace_gen.h ext/oci8/oci8_dtrace_gen.h.bak
rm -f scripts/man1/phpize.1 scripts/php-config scripts/man1/php-config.1 sapi/cli/php.1 sapi/cgi/php-cgi.1 sapi/phpdbg/phpdbg.1 ext/phar/phar.1 ext/phar/phar.phar.1

View file

@ -19,16 +19,12 @@
#
subdirs = Zend TSRM
stamp = buildmk.stamp
config_h_in = main/php_config.h.in
PHP_AUTOCONF = autoconf
PHP_AUTOHEADER = autoheader
PHP_AUTOCONF_FLAGS = -f
all: $(stamp) configure $(config_h_in)
$(stamp): build/buildcheck.sh
@build/buildcheck.sh $@
all: configure $(config_h_in)
configure: configure.ac $(PHP_M4_FILES)
# Remove aclocal.m4 if present. It is automatically included by autoconf but

View file

@ -1,72 +0,0 @@
#!/bin/sh
#
# +----------------------------------------------------------------------+
# | 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. |
# +----------------------------------------------------------------------+
# | Authors: Stig Bakken <ssb@php.net> |
# | Sascha Schumann <sascha@schumann.cx> |
# +----------------------------------------------------------------------+
#
# Check PHP build system tools such as autoconf and their versions.
#
# SYNOPSIS:
# buildcheck.sh [stampfile]
#
# DESCRIPTION:
# Optional stampfile is for Makefile to check build system only once.
#
# ENVIRONMENT:
# The following optional variables are supported:
#
# PHP_AUTOCONF Overrides the path to autoconf tool.
# PHP_AUTOCONF=/path/to/autoconf buildcheck.sh
echo "buildconf: checking installation..."
stamp=$1
# Allow the autoconf executable to be overridden by $PHP_AUTOCONF.
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
# Go to project root.
cd $(CDPATH= cd -- "$(dirname -- "$0")/../" && pwd -P)
# Get minimum required autoconf version from the configure.ac file.
min_version=$(sed -n 's/AC_PREREQ(\[\(.*\)\])/\1/p' configure.ac)
# Check if autoconf exists.
ac_version=$($PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//')
if test -z "$ac_version"; then
echo "buildconf: autoconf not found." >&2
echo " You need autoconf version $min_version or newer installed" >&2
echo " to build PHP from Git." >&2
exit 1
fi
# Check autoconf version.
set -f; IFS='.'; set -- $ac_version; set +f; IFS=' '
ac_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
set -f; IFS='.'; set -- $min_version; set +f; IFS=' '
min_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
if test "$ac_version_num" -lt "$min_version_num"; then
echo "buildconf: autoconf version $ac_version found." >&2
echo " You need autoconf version $min_version or newer installed" >&2
echo " to build PHP from Git." >&2
exit 1
else
echo "buildconf: autoconf version $ac_version (ok)"
fi
test -n "$stamp" && touch $stamp

View file

@ -78,6 +78,42 @@ if test "$dev" = "0" -a "$force" = "0"; then
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.
min_version=$(sed -n 's/AC_PREREQ(\[\(.*\)\])/\1/p' configure.ac)
# Check if autoconf exists.
ac_version=$($PHP_AUTOCONF --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//')
if test -z "$ac_version"; then
echo "buildconf: autoconf not found." >&2
echo " You need autoconf version $min_version or newer installed" >&2
echo " to build PHP from Git." >&2
exit 1
fi
# Check autoconf version.
set -f; IFS='.'; set -- $ac_version; set +f; IFS=' '
ac_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
set -f; IFS='.'; set -- $min_version; set +f; IFS=' '
min_version_num="$(expr ${1} \* 10000 + ${2} \* 100)"
if test "$ac_version_num" -lt "$min_version_num"; then
echo "buildconf: autoconf version $ac_version found." >&2
echo " You need autoconf version $min_version or newer installed" >&2
echo " to build PHP from Git." >&2
exit 1
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
@ -85,12 +121,6 @@ if ! test -x "$(command -v $MAKE)"; then
exit 1
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: Building configure files"
if test "$debug" = "1"; then

View file

@ -78,10 +78,6 @@ done
set -x
./buildconf --force
# remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
# when a user runs buildconf in the distribution.
rm -f buildmk.stamp
# Generate lexer and parser files
./scripts/dev/genfiles
exit_code=$?