Skip to content
Snippets Groups Projects
Commit b1bb2b05 authored by Arkerthan's avatar Arkerthan Committed by Pregmodder
Browse files

Unifiy all UNIX compile files into one

parent a7925076
No related branches found
No related tags found
No related merge requests found
...@@ -46,9 +46,8 @@ How to mod (basic doc): ...@@ -46,9 +46,8 @@ How to mod (basic doc):
Linux: Linux:
Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!) Ensure executable permission on file "devTools/tweeGo/tweego" (not tweego.exe!)
Ensure executable permission on file "compile" Ensure executable permission on file "compile.sh"
In the root dir of sources (where you see src, devTools, bin...) run command "./compile" from console In the root dir of sources (where you see src, devTools, bin...) run command "./compile.sh" from console
compile-git will produce the same result file but with current commit hash in filename.
Mac: Mac:
Not supported directly (I don't have access to Mac for testing). Not supported directly (I don't have access to Mac for testing).
......
#!/bin/bash
mkdir -p bin
while [[ "$1" ]]
do
case $1 in
--insane)
insane="true"
;;
*)
echo "Unknown argument $1"
exit 1
esac
shift
done
# Find and insert current commit
COMMIT=$(git rev-parse --short HEAD)
sed -Ei "s/build .releaseID/\0 commit $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw
if [[ ! "$insane" ]]
then
# Run sanity check.
./sanityCheck
fi
export TWEEGO_PATH=devTools/tweeGo/storyFormats
TWEEGO_EXE="tweego"
if hash $TWEEGO_EXE 2>/dev/null; then
echo "system tweego binary"
else
case "$(uname -m)" in
x86_64|amd64)
echo "x64 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
fi
;;
x86|i[3-6]86)
echo "x86 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
fi
;;
*)
echo "No system tweego binary found, and no precompiled binary for your platform available"
echo "Please compile tweego and put the executable in PATH"
exit 2
esac
fi
$TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ --head devTools/head.html || build_failed="true"
# Revert AlphaDisclaimer for next compilation
git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
if [ "$build_failed" = "true" ]
then
exit 1
fi
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \
&& mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html
ln -s ../resources bin/ 2> /dev/null
echo "bin/FC_pregmod.html compilation finished."
#!/bin/bash
mkdir -p bin
# Run sanity check.
./sanityCheck
HASH="$(git rev-list -n 1 --abbrev-commit HEAD)"
export TWEEGO_PATH=devTools/tweeGo/storyFormats
TWEEGO_EXE="tweego"
if hash $TWEEGO_EXE 2>/dev/null; then
echo "system tweego binary"
else
case "$(uname -m)" in
x86_64|amd64)
echo "x64 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
fi
;;
x86|i[3-6]86)
echo "x86 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
fi
;;
*)
echo "No system tweego binary found, and no precompiled binary for your platform available"
echo "Please compile tweego and put the executable in PATH"
exit 2
esac
fi
$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true"
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \
&& mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html"
ln -s ../resources bin/ 2> /dev/null
echo "bin/FC_pregmod_$HASH.html compilation finished."
#!/bin/bash
mkdir -p bin
# Run sanity check.
./java+gitGrep-sanityCheck.sh
HASH="$(git rev-list -n 1 --abbrev-commit HEAD)"
export TWEEGO_PATH=devTools/tweeGo/storyFormats
TWEEGO_EXE="tweego"
if hash $TWEEGO_EXE 2>/dev/null; then
echo "system tweego binary"
else
case "$(uname -m)" in
x86_64|amd64)
echo "x64 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
fi
;;
x86|i[3-6]86)
echo "x86 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
fi
;;
*)
echo "No system tweego binary found, and no precompiled binary for your platform available"
echo "Please compile tweego and put the executable in PATH"
exit 2
esac
fi
$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true"
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \
&& mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html"
ln -s ../resources bin/ 2> /dev/null
echo "FC_pregmod_$HASH.html compilation finished."
#!/bin/bash
output=/dev/stdout
# displays help text
function displayHelp {
cat << HelpText
Usage: compile.sh [OPTION]...
Options:
-d, --dry Do not compile
-g, --git Add hash of HEAD to filename
-h, --help Show this help text
-j, --java Run sanityCheck based on java
-p, --python Run sanityCheck based on python
-q, --quiet Suppress terminal output
HelpText
}
#display an error message
function echoError {
echo -e "\033[0;31m$@\033[0m"
}
#display message
function echoMessage {
echo "$1" > "${output}"
}
#compile the HTML file
function compile {
mkdir -p bin
export TWEEGO_PATH=devTools/tweeGo/storyFormats
TWEEGO_EXE="tweego"
if hash $TWEEGO_EXE 2>/dev/null; then
echoMessage "system tweego binary"
else
case "$(uname -m)" in
x86_64|amd64)
echoMessage "x64 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx64"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix64"
fi
;;
x86|i[3-6]86)
echoMessage "x86 arch"
if [ "$(uname -s)" = "Darwin" ]; then
TWEEGO_EXE="./devTools/tweeGo/tweego_osx86"
else
TWEEGO_EXE="./devTools/tweeGo/tweego_nix86"
fi
;;
*)
echoError "No system tweego binary found, and no precompiled binary for your platform available."
echoError "Please compile tweego and put the executable in PATH."
exit 2
esac
fi
if [[ "$usehash" ]]; then
HASH="$(git rev-list -n 1 --abbrev-commit HEAD)"
$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/ --head devTools/head.html || build_failed="true"
if [ "$build_failed" = "true" ]
then
echoError "Build failed."
exit 1
fi
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g' "bin/FC_pregmod_${HASH}_tmp.html" \
&& mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html"
ln -s ../resources bin/ 2> /dev/null
echoMessage "Saved to bin/FC_pregmod_$HASH.html."
else
# Find and insert current commit
COMMIT=$(git rev-parse --short HEAD)
sed -Ei "s/build .releaseID/\0 commit $COMMIT/" src/gui/mainMenu/AlphaDisclaimer.tw
$TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ --head devTools/head.html || build_failed="true"
# Revert AlphaDisclaimer for next compilation
git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
if [ "$build_failed" = "true" ]
then
echoError "Build failed."
exit 1
fi
#Make the output prettier, replacing \t with a tab and \n with a newline
sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \
&& mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html
ln -s ../resources bin/ 2> /dev/null
echoMessage "Saved to bin/FC_pregmod.html."
fi
}
if [[ "$1" == "" ]]; then
#tip if no option
echoMessage "For more options see compile.sh -h."
else
#parse options
while [[ "$1" ]]
do
case $1 in
-d|--dry)
dry="true"
;;
-g|--git)
usehash="true"
;;
-h|--help)
displayHelp
exit 0
;;
-j|--java)
java="true"
;;
-p|--python)
python="true"
;;
-q|--quiet)
output=/dev/null
;;
*)
echoError "Unknown argument $1."
displayHelp
exit 1
esac
shift
done
fi
# Run sanity check.
[ -n "$java" ] && ./java+gitGrep-sanityCheck.sh
[ -n "$python" ] && ./sanityCheck
#compile
if [[ "$dry" ]]; then
echoMessage "Dry run finished."
else
compile
echoMessage "Compilation finished."
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment