mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-28 04:23:37 +01:00
rewrite configure script
This commit is contained in:
parent
7a4e5cde3b
commit
431633612f
1 changed files with 42 additions and 78 deletions
120
configure
vendored
120
configure
vendored
|
@ -1,41 +1,21 @@
|
|||
#! /bin/bash
|
||||
#! /usr/bin/env bash
|
||||
|
||||
#
|
||||
# Output variables
|
||||
#
|
||||
|
||||
# Path parameters
|
||||
# Install prefix
|
||||
PREFIX="$HOME/.local"
|
||||
# Individual component selection
|
||||
BUILD_fxsdk=1
|
||||
BUILD_fxconv=1
|
||||
BUILD_fxg1a=1
|
||||
|
||||
#
|
||||
# Tool name checking
|
||||
#
|
||||
|
||||
check()
|
||||
{
|
||||
[[ $1 = "fxsdk" ]] ||
|
||||
[[ $1 = "fxconv" ]] ||
|
||||
[[ $1 = "fxg1a" ]]
|
||||
}
|
||||
|
||||
#
|
||||
# Usage
|
||||
#
|
||||
|
||||
help()
|
||||
{
|
||||
cat << EOF
|
||||
help() {
|
||||
cat << EOF
|
||||
Configuration options for the fxSDK (fx9860g and fxcg50 development tools).
|
||||
|
||||
Tool selection:
|
||||
<tool> may be one of the following:
|
||||
"fxsdk" Command-line options (you generally want this)
|
||||
"fxconv" Asset conversion for gint (or any 4-aligned-VRAM system)
|
||||
"fxg1a" G1A file wrapper, editor and analyzer
|
||||
fxsdk Project management (you generally want this)
|
||||
fxconv Asset conversion for standard and custom gint formats
|
||||
fxg1a G1A file wrapper, editor and analyzer
|
||||
|
||||
--enable-<tool> Build and install the selected tool [default]
|
||||
--disable-<tool> Do not build or install the selected tool
|
||||
|
@ -46,65 +26,49 @@ Install folders:
|
|||
|
||||
--prefix=<prefix> Base install folder [default $HOME/.local]
|
||||
EOF
|
||||
exit 0
|
||||
exit 0
|
||||
}
|
||||
|
||||
#
|
||||
# Argument parsing
|
||||
#
|
||||
|
||||
# Parse arguments
|
||||
for arg; do case "$arg" in
|
||||
-h | -? | --help)
|
||||
help;;
|
||||
-h | -? | --help)
|
||||
help;;
|
||||
|
||||
--prefix=*)
|
||||
PREFIX=${arg#--prefix=};;
|
||||
--prefix=*)
|
||||
PREFIX=${arg#--prefix=};;
|
||||
|
||||
--enable-*)
|
||||
tool="${arg#--enable-}"
|
||||
if ! check $tool; then
|
||||
echo "error: cannot enable $tool: unknown tool"
|
||||
exit 1
|
||||
fi
|
||||
--enable-*)
|
||||
tool="${arg#--enable-}"
|
||||
if [[ ! ":fxsdk:fxg1a:fxconv:" =~ ":$tool:" ]]; then
|
||||
echo "error: $arg: no such tool"
|
||||
exit 1
|
||||
fi
|
||||
eval "BUILD_${tool}=1";;
|
||||
|
||||
eval "BUILD_${tool}=1";;
|
||||
--disable-*)
|
||||
tool="${arg#--disable-}"
|
||||
if [[ ! ":fxsdk:fxg1a:fxconv:" =~ ":$tool:" ]]; then
|
||||
echo "error: $arg: no such tool"
|
||||
exit 1
|
||||
fi
|
||||
eval "BUILD_${tool}=0";;
|
||||
|
||||
--disable-*)
|
||||
tool="${arg#--disable-}"
|
||||
if ! check $tool; then
|
||||
echo "error: cannot disable $tool: unknown tool"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval "BUILD_${tool}=0";;
|
||||
|
||||
*)
|
||||
echo "error: unrecognized option $arg"
|
||||
exit 1;;
|
||||
*)
|
||||
echo "error: unrecognized option $arg"
|
||||
exit 1;;
|
||||
esac; done
|
||||
|
||||
#
|
||||
# Makefile generation
|
||||
#
|
||||
|
||||
gen()
|
||||
{
|
||||
# Allow an install script to change the destination at the last second
|
||||
# to have all files in a separate root before packaging
|
||||
echo "PREFIX ?= $PREFIX"
|
||||
echo -n "TARGETS ="
|
||||
|
||||
[[ $BUILD_fxsdk = 1 ]] && echo -n " fxsdk"
|
||||
[[ $BUILD_fxconv = 1 ]] && echo -n " fxconv"
|
||||
[[ $BUILD_fxg1a = 1 ]] && echo -n " fxg1a"
|
||||
|
||||
echo ""
|
||||
# Generate sub-Makefile with configuration details
|
||||
gen() {
|
||||
# Allow an install script to change the destination at the last second
|
||||
# to have all files in a separate root before packaging
|
||||
# TODO: Support DESTDIR instead
|
||||
echo "PREFIX ?= $PREFIX"
|
||||
echo -n "TARGETS ="
|
||||
[[ $BUILD_fxsdk = 1 ]] && echo -n " fxsdk"
|
||||
[[ $BUILD_fxconv = 1 ]] && echo -n " fxconv"
|
||||
[[ $BUILD_fxg1a = 1 ]] && echo -n " fxg1a"
|
||||
echo ""
|
||||
}
|
||||
|
||||
echo "Configuration complete, the following has been saved in Makefile.cfg:"
|
||||
echo ""
|
||||
|
||||
gen | tee Makefile.cfg
|
||||
|
||||
echo ""
|
||||
echo "You can now 'make'."
|
||||
gen > Makefile.cfg
|
||||
|
|
Loading…
Reference in a new issue