Extend type: syntax to allow target: prefix too.

This is important for pkgdef files like SDL2_mixer which recursively
invoke chocpkg to check if a soft dependent package is installed. In
this case it's important to explicitly prefix the package type to
pass it through to the recursed instance.
This commit is contained in:
Simon Howard 2016-03-05 21:59:19 -05:00
parent b1ac826648
commit 131faedfa6
2 changed files with 8 additions and 7 deletions

View file

@ -77,10 +77,10 @@ configure_for_package() {
local package=$1
PACKAGE_NAME=$package
# Detect native: prefix and set package type.
if [[ "$package" =~ ^native: ]]; then
PACKAGE_TYPE=native
package=${package/#native:/}
# Allow type: prefix to specify PACKAGE_TYPE to install explicitly.
if [[ "$package" =~ .*:.* ]]; then
PACKAGE_TYPE=${package/%:*/}
package=${package/#*:/}
else
PACKAGE_TYPE=target
fi
@ -107,6 +107,7 @@ configure_for_package() {
native)
PACKAGE_INSTALL_DIR="$NATIVE_INSTALL_DIR"
PACKAGE_BUILD_DIR="$NATIVE_BUILD_DIR/$PACKAGE_DIR_NAME"
# When installing a native package, all its dependencies are
# necessarily native as well.
DEPENDENCIES=$(dependencies_for_native)

View file

@ -10,15 +10,15 @@ config_options="
"
# ...except ones we have installed:
if ! chocpkg installed flac; then
if ! chocpkg installed ${PACKAGE_TYPE}:flac; then
config_options+=" --disable-music-flac"
fi
if ! chocpkg installed libogg; then
if ! chocpkg installed ${PACKAGE_TYPE}:libogg; then
config_options+=" --disable-music-ogg"
fi
# FluidSynth, if we have it.
if chocpkg installed fluidsynth; then
if chocpkg installed ${PACKAGE_TYPE}:fluidsynth; then
config_options+=" --enable-music-midi-fluidsynth"
else
config_options+=" --disable-music-midi-fluidsynth"