Added much more build control options, including channel and buildtype

master
Arrehn 2010-11-13 13:05:56 -05:00
parent 09dcf64f8e
commit dec84f90fa
1 changed files with 183 additions and 22 deletions

View File

@ -9,7 +9,7 @@ FALSE=1
# If you have some other version of python installed other than 26, do not edit this file.
# Add a line like this to ~/.bashrc:
# WINPYTHON="/cygdrive/c/path_to_your_python.exe"
# export WINPYTHON="/cygdrive/c/path_to_your_python.exe"
# And then close and restart cygwin
if [ -z $WINPYTHON ] ; then
WINPYTHON="/cygdrive/c/Python26/python.exe"
@ -20,29 +20,190 @@ LOG="`pwd`/logs/build_win32.log"
### Global Variables
###
WANTS_CLEAN=$TRUE
WANTS_CONFIG=$TRUE
WANTS_BUILD=$TRUE
WANTS_PACKAGE=$TRUE
WANTS_CLEAN=$FALSE
WANTS_CONFIG=$FALSE
WANTS_BUILD=$FALSE
WANTS_PACKAGE=$FALSE
WANTS_VERSION=$FALSE
BTYPE="Release"
CHANNEL="private-`hostname`"
###
### Helper Functions
###
if [ "$1" == "--rebuild" ] ; then
echo "rebuilding..."
WANTS_CLEAN=$FALSE
WANTS_CONFIG=$FALSE
elif [ "$1" == "--config" ] ; then
echo "configuring..."
WANTS_BUILD=$FALSE
WANTS_PACKAGE=$FALSE
fi
showUsage()
{
echo
echo "Usage: "
echo "========================"
echo
echo " --clean : Remove past builds & configuration"
echo " --config : General a new architecture-specific config"
echo " --version : Update version number"
echo " --rebuild : Build, reusing unchanged projects to save time"
echo " --chan [Release|Beta|Private] : Private is the default, sets channel"
echo " --btype [Release|RelWithDebInfo] : Release is default, whether to use symbols"
}
getArgs()
# $* = the options passed in from main
{
if [ $# -eq 0 ] ; then
WANTS_CLEAN=$TRUE
WANTS_CONFIG=$TRUE
WANTS_BUILD=$TRUE
WANTS_VERSION=$TRUE
WANTS_PACKAGE=$TRUE
return
fi
while getoptex "clean config version rebuild help chan: btype:" "$@" ; do
case "$OPTOPT" in
clean) WANTS_CLEAN=$TRUE;;
config) WANTS_CONFIG=$TRUE;;
version) WANTS_VERSION=$TRUE;;
rebuild) WANTS_BUILD=$TRUE
WANTS_VERSION=$TRUE
WANTS_PACKAGE=$TRUE;;
chan) CHANNEL="$OPTARG";;
btype) BTYPE="$OPTARG";;
help) showUsage && exit 0;;
-*) showUsage && exit 1;;
*) showUsage && exit 1;;
esac
done
shift $[OPTIND-1]
if [ $OPTIND -le 1 ] ; then
showUsage && exit 1
fi
}
function getoptex()
{
let $# || return 1
local optlist="${1#;}"
let OPTIND || OPTIND=1
[ $OPTIND -lt $# ] || return 1
shift $OPTIND
if [ "$1" != "-" -a "$1" != "${1#-}" ]
then OPTIND=$[OPTIND+1]; if [ "$1" != "--" ]
then
local o
o="-${1#-$OPTOFS}"
for opt in ${optlist#;}
do
OPTOPT="${opt%[;.:]}"
unset OPTARG
local opttype="${opt##*[^;:.]}"
[ -z "$opttype" ] && opttype=";"
if [ ${#OPTOPT} -gt 1 ]
then # long-named option
case $o in
"--$OPTOPT")
if [ "$opttype" != ":" ]; then return 0; fi
OPTARG="$2"
if [ -z "$OPTARG" ];
then # error: must have an agrument
let OPTERR && echo "$0: error: $OPTOPT must have an argument" >&2
OPTARG="$OPTOPT";
OPTOPT="?"
return 1;
fi
OPTIND=$[OPTIND+1] # skip option's argument
return 0
;;
"--$OPTOPT="*)
if [ "$opttype" = ";" ];
then # error: must not have arguments
let OPTERR && echo "$0: error: $OPTOPT must not have arguments" >&2
OPTARG="$OPTOPT"
OPTOPT="?"
return 1
fi
OPTARG=${o#"--$OPTOPT="}
return 0
;;
esac
else # short-named option
case "$o" in
"-$OPTOPT")
unset OPTOFS
[ "$opttype" != ":" ] && return 0
OPTARG="$2"
if [ -z "$OPTARG" ]
then
echo "$0: error: -$OPTOPT must have an argument" >&2
OPTARG="$OPTOPT"
OPTOPT="?"
return 1
fi
OPTIND=$[OPTIND+1] # skip option's argument
return 0
;;
"-$OPTOPT"*)
if [ $opttype = ";" ]
then # an option with no argument is in a chain of options
OPTOFS="$OPTOFS?" # move to the next option in the chain
OPTIND=$[OPTIND-1] # the chain still has other options
return 0
else
unset OPTOFS
OPTARG="${o#-$OPTOPT}"
return 0
fi
;;
esac
fi
done
echo "$0: error: invalid option: $o"
fi; fi
OPTOPT="?"
unset OPTARG
return 1
}
function optlistex
{
local l="$1"
local m # mask
local r # to store result
while [ ${#m} -lt $[${#l}-1] ]; do m="$m?"; done # create a "???..." mask
while [ -n "$l" ]
do
r="${r:+"$r "}${l%$m}" # append the first character of $l to $r
l="${l#?}" # cut the first charecter from $l
m="${m#?}" # cut one "?" sign from m
if [ -n "${l%%[^:.;]*}" ]
then # a special character (";", ".", or ":") was found
r="$r${l%$m}" # append it to $r
l="${l#?}" # cut the special character from l
m="${m#?}" # cut one more "?" sign
fi
done
echo $r
}
function getopt()
{
local optlist=`optlistex "$1"`
shift
getoptex "$optlist" "$@"
return $?
}
###
### Main Logic
###
MAIN_START_TIME=`date +%s`
getArgs $*
path=$WINPATH:/usr/local/bin:/usr/bin:/bin
if [ ! -f "$WINPYTHON" ] ; then
echo "ERROR: You need to edit .bashrc and set WINPYTHON at the top to point at the path of your windows python executable."
@ -58,27 +219,27 @@ fi
if [ $WANTS_CONFIG -eq $TRUE ] ; then
mkdir -p ../logs > /dev/null 2>&1
$WINPYTHON develop.py -G vc80 -t Release configure -DPACKAGE:BOOL=ON -DLL_TESTS:BOOL=OFF 2>&1 | tee $LOG
$WINPYTHON develop.py -G vc80 -t $BTYPE configure -DPACKAGE:BOOL=ON -DLL_TESTS:BOOL=OFF -DVIEWER_CHANNEL:STRING=Firestorm-$CHANNEL -DVIEWER_LOGIN_CHANNEL:STRING=Firestorm-$CHANNEL 2>&1 | tee $LOG
mkdir -p build-vc80/sharedlibs/RelWithDebInfo
mkdir -p build-vc80/sharedlibs/Release
cp fmod.dll ./build-vc80/sharedlibs/RelWithDebInfo
cp fmod.dll ./build-vc80/sharedlibs/Release
fi
if [ $WANTS_BUILD -eq $TRUE ] ; then
echo -n "Setting build version to "
buildVer=`hg summary | grep parent | sed 's/parent: //' | sed 's/:.*//'`
if [ $WANTS_VERSION -eq $TRUE ] ; then
echo -n "Setting build version to "
buildVer=`hg summary | grep parent | sed 's#parent: ##' | sed 's#:.*##'`
echo "$buildVer."
cp llcommon/llversionviewer.h llcommon/llversionviewer.h.build
trap "mv llcommon/llversionviewer.h.build llcommon/llversionviewer.h" INT TERM EXIT
sed -e "s#LL_VERSION_BUILD = [0-9][0-9]*#LL_VERSION_BUILD = ${buildVer}#"\
llcommon/llversionviewer.h.build > llcommon/llversionviewer.h
fi
if [ $WANTS_BUILD -eq $TRUE ] ; then
echo "Building in progress. Check $LOG for verbose status."
$WINPYTHON develop.py -G vc80 -t Release build 2>&1 | tee -a $LOG | grep Build
$WINPYTHON develop.py -G vc80 -t $BTYPE build 2>&1 | tee -a $LOG | grep Build
trap - INT TERM EXIT
mv llcommon/llversionviewer.h.build llcommon/llversionviewer.h
mv -f llcommon/llversionviewer.h.build llcommon/llversionviewer.h
echo "Complete"
fi
popd > /dev/null