|
| 1 | +#!/bin/sh |
| 2 | +# |
| 3 | +# Update the bundled Libtool files to the latest version. |
| 4 | + |
| 5 | +LIBTOOL_VERSION="2.5.4" |
| 6 | + |
| 7 | +while test $# -gt 0; do |
| 8 | + if test "$1" = "-h" || test "$1" = "--help"; then |
| 9 | + cat << HELP |
| 10 | +Libtool updater |
| 11 | +
|
| 12 | +This script assembles and updates the bundled Libtool files in php-src. |
| 13 | +
|
| 14 | +SYNOPSIS: |
| 15 | + update_libtool <options> |
| 16 | +
|
| 17 | +OPTIONS: |
| 18 | + -h, --help Display this help. |
| 19 | +
|
| 20 | + --version <X.Y.Z> Set specific Libtool version to download. |
| 21 | +HELP |
| 22 | + exit 0 |
| 23 | + fi |
| 24 | + |
| 25 | + if test "$1" = "--version"; then |
| 26 | + if test -z "$2"; then |
| 27 | + echo "You must provide Libtool version" >&2 |
| 28 | + echo "Example usage: update_libtool.sh --version $LIBTOOL_VERSION" >&2 |
| 29 | + exit 1; |
| 30 | + fi |
| 31 | + LIBTOOL_VERSION="$2" |
| 32 | + shift |
| 33 | + fi |
| 34 | + |
| 35 | + shift |
| 36 | +done |
| 37 | + |
| 38 | +# Go to project root directory. |
| 39 | +cd $(CDPATH= cd -- "$(dirname -- "$0")/../../" && pwd -P) |
| 40 | + |
| 41 | +wget https://ftp.gnu.org/gnu/libtool/libtool-${LIBTOOL_VERSION}.tar.gz |
| 42 | +tar -xvf libtool-${LIBTOOL_VERSION}.tar.gz |
| 43 | + |
| 44 | +LIBTOOL_DIR="libtool-$LIBTOOL_VERSION" |
| 45 | + |
| 46 | +# Copy main Libtool shell script template. |
| 47 | +cp "$LIBTOOL_DIR/build-aux/ltmain.sh" build |
| 48 | +echo "build/ltmain.sh added" |
| 49 | + |
| 50 | +# Join all M4 Libtool macro files to a single libtool.m4 for convenience. |
| 51 | +cat $LIBTOOL_DIR/m4/libtool.m4 \ |
| 52 | + $LIBTOOL_DIR/m4/lt\~obsolete.m4 \ |
| 53 | + $LIBTOOL_DIR/m4/ltoptions.m4 \ |
| 54 | + $LIBTOOL_DIR/m4/ltsugar.m4 \ |
| 55 | + $LIBTOOL_DIR/m4/ltversion.m4 \ |
| 56 | + > build/libtool.m4 |
| 57 | + |
| 58 | +# Patch the generated libtool.m4 file for the diagnostic edge cases. The strings |
| 59 | +# "# serial NN ..." should appear once at the top of the M4 macros. For example, |
| 60 | +# when running "autoreconf --warnings=all", which runs aclocal, the |
| 61 | +# "warning: the serial number must appear before any macro definition" appear. |
| 62 | +sed -e 's/^#[ ]*serial .*lt.*/dnl &/g' < build/libtool.m4 \ |
| 63 | + > build/libtool.m4.tmp && mv build/libtool.m4.tmp build/libtool.m4 |
| 64 | +echo "build/libtool.m4 assembled and patched" |
| 65 | + |
| 66 | +# Print Libtool version. |
| 67 | +version=$(sed -n 's/m4_define(\[LT_PACKAGE_VERSION\],[ ]*\[\(.*\)\])/\1/p' $LIBTOOL_DIR/m4/ltversion.m4) |
| 68 | +echo "Libtool version $version" |
0 commit comments