diff options
author | Guy Harris <guy@alum.mit.edu> | 2018-05-14 20:42:32 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2018-05-15 03:43:53 +0000 |
commit | ec8b402a763706d8a8ae0df86e2e1afdb64882e8 (patch) | |
tree | 663ba3cd3e8476fba41f9794a5f7823b776099a4 | |
parent | e7db145b7f6bef4b2575f561f501fea589e0c8b9 (diff) |
Download and install Ninja.
The Developer's Guide recommends Ninja for all UN*Xes, so download it
rather than having to say "but on macOS use make".
Change-Id: I147b96144c25d01151c68e13d249172023b1fccc
Reviewed-on: https://code.wireshark.org/review/27544
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rwxr-xr-x | tools/macos-setup.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tools/macos-setup.sh b/tools/macos-setup.sh index 018d397a20..9c1db539df 100755 --- a/tools/macos-setup.sh +++ b/tools/macos-setup.sh @@ -38,6 +38,13 @@ LZIP_VERSION=1.19 CMAKE_VERSION=${CMAKE_VERSION-3.11.0} # +# Ninja isn't required, as make is provided with Xcode, but it is +# claimed to build faster than make. +# Comment it out if you don't want it. +# +NINJA_VERSION=${NINJA_VERSION-1.8.2} + +# # The following libraries and tools are required even to build only TShark. # GETTEXT_VERSION=0.19.8.1 @@ -333,6 +340,33 @@ uninstall_libtool() { fi } +install_ninja() { + if [ "$NINJA_VERSION" -a ! -f ninja-$NINJA_VERSION-done ] ; then + echo "Downloading and installing Ninja:" + # + # Download the zipball, unpack it, and move the binary to + # /usr/local/bin. + # + [ -f ninja-mac-v$NINJA_VERSION.zip ] || curl -L -o ninja-mac-v$NINJA_VERSION.zip https://github.com/ninja-build/ninja/releases/download/v$NINJA_VERSION/ninja-mac.zip || exit 1 + $no_build && echo "Skipping installation" && return + unzip ninja-mac-v$NINJA_VERSION.zip + sudo mv ninja /usr/local/bin + touch ninja-$NINJA_VERSION-done + fi +} + +uninstall_ninja() { + if [ ! -z "$installed_ninja_version" ]; then + echo "Uninstalling Ninja:" + sudo rm /usr/local/bin/ninja + if [ "$#" -eq 1 -a "$1" = "-r" ] ; then + rm -f ninja-mac-v$installed_ninja_version.zip + fi + + installed_ninja_version="" + fi +} + install_cmake() { if [ ! -f cmake-$CMAKE_VERSION-done ]; then echo "Downloading and installing CMake:" @@ -1740,6 +1774,17 @@ install_all() { uninstall_gettext -r fi + if [ ! -z "$installed_ninja_version" -a \ + "$installed_ninja_version" != "$NINJA_VERSION" ] ; then + echo "Installed Ninja version is $installed_ninja_version" + if [ -z "$NINJA_VERSION" ] ; then + echo "Ninja is not requested" + else + echo "Requested Ninja version is $NINJA_VERSION" + fi + uninstall_ninja -r + fi + if [ ! -z "$installed_cmake_version" -a \ "$installed_cmake_version" != "$CMAKE_VERSION" ] ; then echo "Installed CMake version is $installed_cmake_version" @@ -1821,6 +1866,8 @@ install_all() { install_cmake + install_ninja + # # Start with GNU gettext; GLib requires it, and macOS doesn't have it # or a BSD-licensed replacement. @@ -1954,6 +2001,8 @@ uninstall_all() { uninstall_gettext + uninstall_ninja + # # XXX - really remove this? # Or should we remember it as installed only if this script @@ -2081,6 +2130,7 @@ then installed_automake_version=`ls automake-*-done 2>/dev/null | sed 's/automake-\(.*\)-done/\1/'` installed_libtool_version=`ls libtool-*-done 2>/dev/null | sed 's/libtool-\(.*\)-done/\1/'` installed_cmake_version=`ls cmake-*-done 2>/dev/null | sed 's/cmake-\(.*\)-done/\1/'` + installed_ninja_version=`ls ninja-*-done 2>/dev/null | sed 's/ninja-\(.*\)-done/\1/'` installed_gettext_version=`ls gettext-*-done 2>/dev/null | sed 's/gettext-\(.*\)-done/\1/'` installed_pkg_config_version=`ls pkg-config-*-done 2>/dev/null | sed 's/pkg-config-\(.*\)-done/\1/'` installed_glib_version=`ls glib-*-done 2>/dev/null | sed 's/glib-\(.*\)-done/\1/'` |