com php-src: Enhance the buildconf script: buildconf
| From: | Peter Kokot | Date: | Sat, 16 Mar 2019 22:43:25 +0000 |
| Subject: | com php-src: Enhance the buildconf script: buildconf | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105170@lists.php.net to get a copy of this message | ||
Commit: 78ab79b9164420679da7aba1f7195335d656afda
Author: Peter Kokot <peterkokot@gmail.com> Sat, 16 Feb 2019 20:29:42 +0100
Parents: 2619b138c0f3fe501f2b5b3924244237f02b7042
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=78ab79b9164420679da7aba1f7195335d656afda
Log:
Enhance the buildconf script
Changes:
- Added a short introduction what this script does
- Added usually the expected -h and --help options with explanation
for a reason for this script and its usage.
- Messages changed a bit so the PHP installation procedure becomes
simpler without needing to constantly remind the reader what to run
and what not in the documentations and installation instructions.
- cd into current working directory of the buildconf (this enables
running the script from other locations and inside other scripts).
- check if make exists
Changed paths:
M buildconf
Diff:
diff --git a/buildconf b/buildconf
index 4b72ef8..3248cd6 100755
--- a/buildconf
+++ b/buildconf
@@ -1,6 +1,15 @@
#!/bin/sh
+#
+# A wrapper around Autoconf that generates files to build PHP on *nix systems.
-eval
grep '^PHP_EXTRA_VERSION=' configure.ac
+MAKE=${MAKE:-make}
+force=0
+debug=0
+
+# Go to project root.
+cd $(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
+
+eval $(grep '^PHP_EXTRA_VERSION=' configure.ac)
case "$PHP_EXTRA_VERSION" in
*-dev)
dev=1
@@ -10,37 +19,82 @@ case "$PHP_EXTRA_VERSION" in
;;
esac
-devok=0
-debug=no
-
while test $# -gt 0; do
+ if test "$1" = "-h" || test "$1" = "--help"; then
+ cat << HELP
+PHP buildconf
+
+A wrapper around the autoconf and autoheader that generate files for building
+PHP on *nix systems (configure, main/php_config.h.in, aclocal.m4...). The
+configure script is used to customize the PHP build based on the provided
+options and system. PHP releases downloaded from PHP.net already include the
+configure script so installing Autoconf and running buildconf is not needed. For
+the PHP sources from the Git repository, buildconf is used for generating a new
+configure script and required files.
+
+SYNOPSIS:
+ buildconf [<options>]
+
+OPTIONS:
+ --force Clean cache and overwrite configure files..
+ --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.
+ PHP_AUTOHEADER=/path/to/autoheader ./buildconf
+HELP
+ exit 0
+ fi
+
if test "$1" = "--force"; then
- devok=1
- echo "Forcing buildconf"
+ force=1
fi
if test "$1" = "--debug"; then
- debug=yes
+ debug=1
fi
shift
done
-if test "$dev" = "0" -a "$devok" = "0"; then
- echo "You should not run buildconf in a release package." >&2
- echo "use buildconf --force to override this check." >&2
+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."
+ exit 0
+ else
+ echo "Configure script is missing." >&2
+ echo "Run ./buildconf --force to create a configure script." >&2
+ exit 1
+ fi
+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
fi
-if test "$devok" = "1"; then
- echo "Removing configure caches"
+if test "$force" = "1"; then
+ echo "buildconf: Forcing buildconf"
+ echo "buildconf: Removing configure caches"
rm -rf autom4te.cache config.cache
fi
+echo "buildconf: Building configure files"
+
rm -f generated_lists
-if test "$debug" = "yes"; then
- ${MAKE:-make} -s -f build/build.mk SUPPRESS_WARNINGS=""
+if test "$debug" = "1"; then
+ $MAKE -s -f build/build.mk SUPPRESS_WARNINGS=""
else
- ${MAKE:-make} -s -f build/build.mk
+ $MAKE -s -f build/build.mk
fi