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.
This commit is contained in:
Simon Howard 2020-05-16 17:18:09 -04:00
parent cf5290d208
commit 8fea99baa2

View file

@ -14,6 +14,17 @@ build_autotools::need_autoreconf() {
[ ! -e configure ] || [ $configure_ac -nt configure ] [ ! -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 # This function encapsulates the "./configure; make" process that does the
# actual build of the package. This should work for most autotools-based # actual build of the package. This should work for most autotools-based
# packages but the intention is that this can be overrriden by packages. # 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." 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." chocpkg::abort "Failed to build package $PACKAGE_NAME."
) )
} }
@ -57,7 +68,7 @@ do_install() {
cd "$AUTOTOOLS_BUILD_PATH" cd "$AUTOTOOLS_BUILD_PATH"
fi fi
make install || ( build_autotools::make install || (
chocpkg::abort "Failed to install package $PACKAGE_NAME." chocpkg::abort "Failed to install package $PACKAGE_NAME."
) )
} }