Diff comments:
> === modified file 'compile.sh'
> --- compile.sh2014-06-18 17:11:08 +
> +++ compile.sh2014-07-19 14:18:30 +
> @@ -26,15 +26,14 @@
> # TODO user interaction and functions for installation including a check
> # TODO whether the selected directories are writeable and a password check
> # TODO to become root / Administrator if the dirs are not writeable.
> +# TODO(code review): probably no longer needed?
>
>
>
> ##
> # Definition of some local variables #
> ##
> -var_build=0 # 0 == debug(default), 1 == release
> -var_build_lang=0 # 0 = false
> -var_updater=0 # 0 = false
> +buildtool="" #Use ninja by default, fall back to make if that is not
> available.
> ##
>
>
> @@ -49,94 +48,51 @@
>echo " source code."
>exit 1
> fi
> +#TODO(code review): Are these returns in various methods necessary?
> +#It doesn't seem like anything ever checks the return, and in case
> +#of something bad, it just calls exit anyways (see above)
> return 0
>}
>
> - # Ask the user what parts and how Widelands should be build.
> - # And save the values
> - user_interaction () {
> -local_var_ready=0
> -while [ $local_var_ready -eq 0 ]
> -do
> - echo " "
> - echo " Should Widelands be build in [r]elease or [d]ebug mode?"
> - echo " "
> - read local_var_choice
> - echo " "
> - case $local_var_choice in
> -r) echo " -> Release mode selected" ; var_build=1 ;
> local_var_ready=1 ;;
> -d) echo " -> Debug mode selected" ; var_build=0 ; local_var_ready=1
> ;;
> -*) echo " -> Bad choice. Please try again!" ;;
> - esac
> -done
> -local_var_ready=0
> -if [ $var_build -eq 0 ] ; then
> - while [ $local_var_ready -eq 0 ]
> - do
> -echo " "
> -echo " Should translations be build [y]/[n]?"
> -echo " "
> -read local_var_choice
> -echo " "
> -case $local_var_choice in
> - y) echo " -> Translations will be build" ; var_build_lang=1 ;
> local_var_ready=1 ;;
> - n) echo " -> Translations will not be build" ; var_build_lang=0 ;
> local_var_ready=1 ;;
> - *) echo " -> Bad choice. Please try again!" ;;
> -esac
> - done
> + set_buildtool () {
> +#Defaults to ninja, but if that is not found, we use make instead
> +if [ `command -v ninja` ] ; then
> + buildtool="ninja"
> +#On some systems (most notably Fedora), the binary is called ninja-build
> +elif [ `command -v ninja-build` ] ; then
> + buildtool="ninja-build"
> +else
> + buildtool="make"
> fi
> -return 0
>}
>
># Check if directories / links already exists and create / update them if
> needed.
>prepare_directories_and_links () {
> -# remove build/compile directory (this is the old location)
> -if [ -e build/compile ] ; then
> - echo " "
> - echo " The build directory has changed"
> - echo " from ./build/compile to ./build."
> - echo " The old directory ./build/compile can be removed."
> - echo " Please backup any files you might not want to lose."
> - echo " Most users can safely say yes here."
> - echo " Do you want to remove the directory ./build/compile?
> [y]es/[n]o"
> - echo " "
> - read local_var_choice
> - echo " "
> - case $local_var_choice in
> -y) echo " -> Removing directory ./build/compile. This may take a
> while..."
> -rm locale
> -rm -r build/compile || true
> -if [ -e build/compile ] ; then
> - echo " -> Directory could not be removed. This is not fatal,
> continuing."
> -else
> - echo " -> Directory removed."
> -fi ;;
> -n) echo " -> Left the directory untouched." ;;
> -*) echo " -> Bad choice. Please try again!" ;;
> - esac
> -fi
> -
> -test -d build || mkdir -p build
> test -d build/locale || mkdir -p build/locale
> test -e locale || ln -s build/locale
>
> -cd build
> -
> return 0
>}
>
># Compile Widelands
>compile_widelands () {
> -var_build_type=""
> -if [ $var_build -eq 0 ] ; then
> - var_build_type="Debug"
> +echo "Builds a debug build by default. If you want a Release build, "
> +echo "you will need to build it manually passing the"
> +echo "option -DCMAKE_BUILD_TYPE=\"Release\" to cmake"
> +
> +#TODO(code review): WL_PORTABLE might be going away, see
> https://bugs.launchpad.net/widelands/+bug/1342228
> +
> +if [ $buildtool = "ninja" ] || [ $buildtool = "ninja-build" ] ; then
> + cmake -G Ninja -DWL_PORTABLE=true .. -DCMAKE_BUILD_TYPE="Debug"
> else
> - var_build_type="Release"
> + cmake -DWL_PORTABLE=true .. -DCMAKE_BUILD_TYPE="Debug"
> fi
>
> -echo "