Skip to content

Commit ef165b4

Browse files
committed
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 phpGH-4437
1 parent 1b969a7 commit ef165b4

File tree

3 files changed

+29
-68
lines changed

3 files changed

+29
-68
lines changed

.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ end_of_line = lf
99
charset = utf-8
1010
tab_width = 4
1111

12-
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
12+
[{*.{awk,bat,c,cpp,d,h,l,re,skl,w32,y},Makefile*}]
1313
indent_size = 4
1414
indent_style = tab
1515

build/build.mk

-40
This file was deleted.

buildconf

+28-27
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# A wrapper around Autoconf that generates files to build PHP on *nix systems.
44

5-
MAKE=${MAKE:-make}
65
PHP_AUTOCONF=${PHP_AUTOCONF:-autoconf}
76
PHP_AUTOHEADER=${PHP_AUTOHEADER:-autoheader}
87
force=0
@@ -38,15 +37,13 @@ SYNOPSIS:
3837
buildconf [<options>]
3938
4039
OPTIONS:
41-
-f, --force Clean cache and overwrite configure files.
40+
-f, --force Regenerate configure files in PHP release packages.
4241
--debug Display warnings emitted by Autoconf.
4342
-h, --help Display this help.
4443
4544
ENVIRONMENT:
4645
The following optional variables are supported:
4746
48-
MAKE Overrides the path to make tool.
49-
MAKE=/path/to/make ./buildconf
5047
PHP_AUTOCONF Overrides the path to autoconf tool.
5148
PHP_AUTOCONF=/path/to/autoconf ./buildconf
5249
PHP_AUTOHEADER Overrides the path to autoheader tool.
@@ -66,24 +63,18 @@ HELP
6663
shift
6764
done
6865

69-
if test "$dev" = "0" -a "$force" = "0"; then
70-
if test -f "configure"; then
71-
echo "The configure script has already been built for you. All done."
72-
echo "Run ./configure to proceed with customizing the PHP build."
66+
if test "$dev" = "0" && test "$force" = "0"; then
67+
if test -f "configure" && test -f "main/php_config.h.in"; then
68+
echo "buildconf: The configure script is already built. All done."
69+
echo " Run ./configure to proceed with customizing the PHP build."
7370
exit 0
7471
else
75-
echo "Configure script is missing." >&2
76-
echo "Run ./buildconf --force to create a configure script." >&2
72+
echo "buildconf: Configure files are missing." >&2
73+
echo " Run ./buildconf --force to create a configure script." >&2
7774
exit 1
7875
fi
7976
fi
8077

81-
if test "$force" = "1"; then
82-
echo "buildconf: Forcing buildconf"
83-
echo "buildconf: Removing configure caches and files"
84-
rm -rf autom4te.cache config.cache configure
85-
fi
86-
8778
echo "buildconf: Checking installation"
8879

8980
# Get minimum required autoconf version from the configure.ac file.
@@ -114,23 +105,33 @@ else
114105
echo "buildconf: autoconf version $ac_version (ok)"
115106
fi
116107

117-
# Check if make exists.
118-
if ! test -x "$(command -v $MAKE)"; then
119-
echo "buildconf: make not found." >&2
120-
echo " You need to have make installed to build PHP." >&2
121-
exit 1
108+
if test "$force" = "1"; then
109+
echo "buildconf: Forcing buildconf. The configure files will be regenerated."
122110
fi
123111

124-
echo "buildconf: Building configure files"
112+
# Clean cache and explicitly remove all targets if present. Remove also
113+
# aclocal.m4 if present. It is automatically included by autoconf but not used
114+
# by the PHP build system since PHP 7.4.
115+
echo "buildconf: Cleaning cache and configure files"
116+
rm -rf \
117+
aclocal.m4 \
118+
autom4te.cache \
119+
config.cache \
120+
configure \
121+
main/php_config.h.in
125122

126123
if test "$debug" = "1"; then
127124
autoconf_flags="-f -Wall"
125+
autoheader_flags="-Wall"
128126
else
129127
autoconf_flags="-f"
128+
autoheader_flags=""
130129
fi
131130

132-
$MAKE -s -f build/build.mk \
133-
PHP_AUTOCONF="$PHP_AUTOCONF" \
134-
PHP_AUTOHEADER="$PHP_AUTOHEADER" \
135-
PHP_AUTOCONF_FLAGS="$autoconf_flags" \
136-
PHP_M4_FILES="$(echo TSRM/*.m4 Zend/Zend.m4 build/*.m4 ext/*/config*.m4 sapi/*/config*.m4)"
131+
echo "buildconf: Rebuilding configure"
132+
$PHP_AUTOCONF $autoconf_flags
133+
134+
echo "buildconf: Rebuilding main/php_config.h.in"
135+
$PHP_AUTOHEADER $autoheader_flags
136+
137+
echo "buildconf: Run ./configure to proceed with customizing the PHP build."

0 commit comments

Comments
 (0)