From 8fea99baa20d4725f9a7716c2f1dc550703cecdb Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 16 May 2020 17:18:09 -0400 Subject: [PATCH] Use `gmake` over `make` if it is installed. BSD systems install GNU make as `gmake` along with their own less- capable version of make as `make`. If `gmake` is found to be installed, prefer it because the BSD makes don't often work as expected. --- chocpkg/modules/build_autotools.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/chocpkg/modules/build_autotools.sh b/chocpkg/modules/build_autotools.sh index fce63ff..7e174db 100644 --- a/chocpkg/modules/build_autotools.sh +++ b/chocpkg/modules/build_autotools.sh @@ -14,6 +14,17 @@ build_autotools::need_autoreconf() { [ ! -e configure ] || [ $configure_ac -nt configure ] } +# BSD systems usually have their own less-capable version of make, while +# GNU make is installed as `gmake`. If a command named gmake is found, +# prefer that over `make`. +build_autotools::make() { + if chocpkg::have_tool gmake; then + gmake "$@" + else + make "$@" + fi +} + # This function encapsulates the "./configure; make" process that does the # actual build of the package. This should work for most autotools-based # packages but the intention is that this can be overrriden by packages. @@ -45,7 +56,7 @@ do_build() { chocpkg::abort "Failed to configure package $PACKAGE_NAME for build." ) - make $MAKE_OPTS || ( + build_autotools::make $MAKE_OPTS || ( chocpkg::abort "Failed to build package $PACKAGE_NAME." ) } @@ -57,7 +68,7 @@ do_install() { cd "$AUTOTOOLS_BUILD_PATH" fi - make install || ( + build_autotools::make install || ( chocpkg::abort "Failed to install package $PACKAGE_NAME." ) }