1
0
forked from GitHub/gf-rgl

Clean up Make.sh and add verbosity flag

This commit is contained in:
John J. Camilleri
2018-07-30 11:52:55 +02:00
parent 4ca4fb1d6d
commit 56f530abab
2 changed files with 20 additions and 12 deletions

26
Make.sh
View File

@@ -8,6 +8,7 @@ modules_api="Try Symbolic"
# Defaults (may be overridden by options) # Defaults (may be overridden by options)
gf="gf" gf="gf"
dest="" dest=""
verbose="false"
# Check command line options # Check command line options
for arg in "$@"; do for arg in "$@"; do
@@ -16,6 +17,8 @@ for arg in "$@"; do
gf="${arg#*=}"; shift ;; gf="${arg#*=}"; shift ;;
--dest=*) --dest=*)
dest="${arg#*=}"; shift ;; dest="${arg#*=}"; shift ;;
--verbose|-v)
verbose="true"; shift ;;
*) echo "Unknown option: ${arg}" ; exit 1 ;; *) echo "Unknown option: ${arg}" ; exit 1 ;;
esac esac
done done
@@ -25,7 +28,7 @@ if [ -z "$dest" ]; then
dest="$GF_LIB_PATH" dest="$GF_LIB_PATH"
fi fi
if [ -z "$dest" ] && [ -f "../gf-core/DATA_DIR" ]; then if [ -z "$dest" ] && [ -f "../gf-core/DATA_DIR" ]; then
dest=`cat ../gf-core/DATA_DIR` dest=$(cat ../gf-core/DATA_DIR)
if [ -n "$dest" ]; then dest="${dest}/lib"; fi if [ -n "$dest" ]; then dest="${dest}/lib"; fi
fi fi
if [ -z "$dest" ]; then if [ -z "$dest" ]; then
@@ -47,37 +50,38 @@ mkdir -p "${dist}/present"
mkdir -p "${dist}/alltenses" mkdir -p "${dist}/alltenses"
# Build: prelude # Build: prelude
echo "Building prelude" echo "Building [prelude]"
${gfc} --gfo-dir="${dist}"/prelude "${src}"/prelude/*.gf ${gfc} --gfo-dir="${dist}"/prelude "${src}"/prelude/*.gf
# Gather all language modules for building # Gather all language modules for building
for mod in $modules_langs; do for mod in $modules_langs; do
for file in "${src}"/*/${mod}???.gf; do for file in "${src}"/*/"${mod}"???.gf; do
[[ ! -e $file ]] && continue
modules="${modules} ${file}" modules="${modules} ${file}"
done done
done done
for mod in $modules_api; do for mod in $modules_api; do
for file in "${src}"/api/${mod}???.gf; do for file in "${src}"/api/"${mod}"???.gf; do
[[ ! -e $file ]] && continue
modules="${modules} ${file}" modules="${modules} ${file}"
done done
done done
# Redirect stderr if not verbose
if [ $verbose = false ]; then
exec 2> /dev/null
fi
# Build: present # Build: present
echo "Building present" echo "Building [present]"
# ${gfc} -no-pmcfg --gfo-dir="${dist}"/present -preproc=mkPresent "${modules}"
for module in $modules; do for module in $modules; do
${gfc} --no-pmcfg --gfo-dir="${dist}"/present -preproc=mkPresent "${module}" ${gfc} --no-pmcfg --gfo-dir="${dist}"/present -preproc=mkPresent "${module}"
done done
# Build: alltenses # Build: alltenses
echo "Building alltenses" echo "Building [alltenses]"
# ${gfc} -no-pmcfg --gfo-dir="${dist}"/alltenses "${modules}"
for module in $modules; do for module in $modules; do
${gfc} --no-pmcfg --gfo-dir="${dist}"/alltenses "${module}" ${gfc} --no-pmcfg --gfo-dir="${dist}"/alltenses "${module}"
done done
# Copy # Copy
echo "Copying to ${dest}" echo "Copying to ${dest}"
cp -R ${dist}/* ${dest} cp -R "${dist}"/* "${dest}"

View File

@@ -78,11 +78,15 @@ clean
## Shell script: `Make.sh` ## Shell script: `Make.sh`
This method is provided as an alternative for those who don't have Haskell installed. Simply run the script to build the entire RGL and install in the default location: This method is provided as an alternative for those who don't have Haskell installed.
Simply run the script to build the entire RGL and install in the default location:
You can pass the following flags: You can pass the following flags:
- `--dest=...` to manually specify the install location - `--dest=...` to manually specify the install location
- `--gf=...` to specify the path to the `gf` executable, if not available on the system path - `--gf=...` to specify the path to the `gf` executable, if not available on the system path
- `--verbose` or `-v` to show all GF warnings and errors
This build method tries to build all languages found in the `src` directory, even those which are not considered complete.
## Windows batch file: `Make.bat` ## Windows batch file: `Make.bat`