diff --git a/patches/CMakeLists.txt.oglft.patch b/patches/CMakeLists.txt.oglft.patch new file mode 100644 index 0000000000000000000000000000000000000000..6bf46126eff2d05533b0ab3f40092d5cafd82755 --- /dev/null +++ b/patches/CMakeLists.txt.oglft.patch @@ -0,0 +1,10 @@ +--- CMakeLists.txt ++++ CMakeLists.txt.new 2008-05-21 14:11:05.000000000 +0200 +@@ -4,7 +4,6 @@ + set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/config ) + + find_package( OpenGL REQUIRED ) +-find_package( Freetype REQUIRED ) + + if( ENABLE_QT ) + find_package( Qt REQUIRED ) diff --git a/setup.sh b/setup.sh index 091ff65a4f893811ac6322a726e4f2c2b2bdce68..fa718f277a312e23f9fcab7437a3a3d8f45dfb83 100755 --- a/setup.sh +++ b/setup.sh @@ -25,8 +25,34 @@ # error level checking (break in case of error, always 2>&1 for make logging) # more refactoring (every lib in dedicated function? per traget?) +### globals ############################################################### + +ROOT=`pwd` +DATE=`date` +LOGFILE=$ROOT/setup.log +TARGET=0 + ### functions ############################################################# +failure() +{ + echo "************************************" | tee -a + echo "Error detected! Stopping setup run!" | tee -a $LOGFILE + echo "$DATE" | tee -a $LOGFILE + + if [ -f "$LOGFILE" ]; then + echo "------------------------------------" + echo "Please check logfile: `basename $LOGFILE`" + echo "These are the final ten lines:" + echo "------------------------------------" + tail -10 $LOGFILE + fi + + echo "************************************" | tee -a $LOGFILE + + exit 1 +} + check_prerequisites() { echo "Checking prerequisites..." @@ -49,66 +75,66 @@ prepare_generic() { cd $ROOT - echo "Preparing source tree..." | tee -a $ROOT/setup.log - mkdir -p 3rdparty/oglft >> $ROOT/setup.log - mkdir -p 3rdparty/boinc >> $ROOT/setup.log + echo "Preparing source tree..." | tee -a $LOGFILE + mkdir -p 3rdparty/oglft >> $LOGFILE + mkdir -p 3rdparty/boinc >> $LOGFILE - echo "Preparing build tree..." | tee -a $ROOT/setup.log - mkdir -p build/sdl >> $ROOT/setup.log - mkdir -p build/freetype2 >> $ROOT/setup.log - mkdir -p build/oglft >> $ROOT/setup.log - mkdir -p build/boinc >> $ROOT/setup.log - mkdir -p build/framework >> $ROOT/setup.log - mkdir -p build/orc >> $ROOT/setup.log - mkdir -p build/starsphere >> $ROOT/setup.log + echo "Preparing build tree..." | tee -a $LOGFILE + mkdir -p build/sdl >> $LOGFILE + mkdir -p build/freetype2 >> $LOGFILE + mkdir -p build/oglft >> $LOGFILE + mkdir -p build/boinc >> $LOGFILE + mkdir -p build/framework >> $LOGFILE + mkdir -p build/orc >> $LOGFILE + mkdir -p build/starsphere >> $LOGFILE - echo "Preparing install tree..." | tee -a $ROOT/setup.log - mkdir -p install/bin >> $ROOT/setup.log - mkdir -p install/include >> $ROOT/setup.log - mkdir -p install/lib >> $ROOT/setup.log + echo "Preparing install tree..." | tee -a $LOGFILE + mkdir -p install/bin >> $LOGFILE + mkdir -p install/include >> $LOGFILE + mkdir -p install/lib >> $LOGFILE # prepare additional sources - mkdir -p 3rdparty/sdl >> $ROOT/setup.log + mkdir -p 3rdparty/sdl >> $LOGFILE cd $ROOT/3rdparty/sdl if [ -d .svn ]; then - echo "Updating SDL..." | tee -a $ROOT/setup.log - svn update >> $ROOT/setup.log + echo "Updating SDL..." | tee -a $LOGFILE + svn update >> $LOGFILE else - echo "Retrieving SDL (this may take a while)..." | tee -a $ROOT/setup.log - svn checkout http://svn.libsdl.org/branches/SDL-1.2 . >> $ROOT/setup.log + echo "Retrieving SDL (this may take a while)..." | tee -a $LOGFILE + svn checkout http://svn.libsdl.org/branches/SDL-1.2 . >> $LOGFILE fi # cd $ROOT/3rdparty -# echo "Retrieving SDL (this may take a while)..." | tee -a $ROOT/setup.log -# wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz >> $ROOT/setup.log 2>&1 -# tar -xzf SDL-1.2.14.tar.gz >> $ROOT/setup.log -# rm SDL-1.2.14.tar.gz >> $ROOT/setup.log -# mv SDL-1.2.14 sdl >> $ROOT/setup.log +# echo "Retrieving SDL (this may take a while)..." | tee -a $LOGFILE +# wget http://www.libsdl.org/release/SDL-1.2.14.tar.gz >> $LOGFILE 2>&1 +# tar -xzf SDL-1.2.14.tar.gz >> $LOGFILE +# rm SDL-1.2.14.tar.gz >> $LOGFILE +# mv SDL-1.2.14 sdl >> $LOGFILE cd $ROOT/3rdparty - echo "Retrieving Freetype2 (this may take a while)..." | tee -a $ROOT/setup.log - wget http://mesh.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.5.tar.bz2 >> $ROOT/setup.log 2>&1 - tar -xjf freetype-2.3.5.tar.bz2 >> $ROOT/setup.log - rm freetype-2.3.5.tar.bz2 >> $ROOT/setup.log - mv freetype-2.3.5 freetype2 >> $ROOT/setup.log + echo "Retrieving Freetype2 (this may take a while)..." | tee -a $LOGFILE + wget http://mesh.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.5.tar.bz2 >> $LOGFILE 2>&1 + tar -xjf freetype-2.3.5.tar.bz2 >> $LOGFILE + rm freetype-2.3.5.tar.bz2 >> $LOGFILE + mv freetype-2.3.5 freetype2 >> $LOGFILE cd $ROOT/3rdparty/oglft if [ -d .svn ]; then - echo "Updating OGLFT..." | tee -a $ROOT/setup.log + echo "Updating OGLFT..." | tee -a $LOGFILE svn update >> ../../setup.log else - echo "Retrieving OGLFT (this may take a while)..." | tee -a $ROOT/setup.log - svn checkout https://oglft.svn.sourceforge.net/svnroot/oglft/trunk . >> $ROOT/setup.log + echo "Retrieving OGLFT (this may take a while)..." | tee -a $LOGFILE + svn checkout https://oglft.svn.sourceforge.net/svnroot/oglft/trunk . >> $LOGFILE fi cd $ROOT/3rdparty/boinc if [ -d .svn ]; then - echo "Updating BOINC..." | tee -a $ROOT/setup.log - svn update >> $ROOT/setup.log + echo "Updating BOINC..." | tee -a $LOGFILE + svn update >> $LOGFILE else - echo "Retrieving BOINC (this may take a while)..." | tee -a $ROOT/setup.log - svn checkout http://boinc.berkeley.edu/svn/trunk/boinc . >> $ROOT/setup.log + echo "Retrieving BOINC (this may take a while)..." | tee -a $LOGFILE + svn checkout http://boinc.berkeley.edu/svn/trunk/boinc . >> $LOGFILE fi return 0 @@ -119,24 +145,24 @@ prepare_win32() { cd $ROOT - echo "Preparing MinGW source tree..." | tee -a $ROOT/setup.log - mkdir -p 3rdparty/mingw/xscripts >> $ROOT/setup.log + echo "Preparing MinGW source tree..." | tee -a $LOGFILE + mkdir -p 3rdparty/mingw/xscripts >> $LOGFILE cd 3rdparty/mingw/xscripts if [ -d CVS ]; then - echo "Updating MinGW build script..." | tee -a $ROOT/setup.log - cvs update -C >> $ROOT/setup.log 2>&1 + echo "Updating MinGW build script..." | tee -a $LOGFILE + cvs update -C >> $LOGFILE 2>&1 else cd .. - echo "Retrieving MinGW build script (this may take a while)..." | tee -a $ROOT/setup.log - cvs -z3 -d:pserver:anonymous@mingw.cvs.sourceforge.net:/cvsroot/mingw checkout -P xscripts >> $ROOT/setup.log 2>&1 + echo "Retrieving MinGW build script (this may take a while)..." | tee -a $LOGFILE + cvs -z3 -d:pserver:anonymous@mingw.cvs.sourceforge.net:/cvsroot/mingw checkout -P xscripts >> $LOGFILE 2>&1 fi cd $ROOT/3rdparty/mingw/xscripts - echo "Preparing MinGW build script..." | tee -a $ROOT/setup.log + echo "Preparing MinGW build script..." | tee -a $LOGFILE # note: svn has no force/overwrite switch. the file might not be updated when patched - patch x86-mingw32-build.sh.conf < $ROOT/patches/x86-mingw32-build.sh.conf.patch >> $ROOT/setup.log - chmod +x x86-mingw32-build.sh >> $ROOT/setup.log + patch x86-mingw32-build.sh.conf < $ROOT/patches/x86-mingw32-build.sh.conf.patch >> $LOGFILE + chmod +x x86-mingw32-build.sh >> $LOGFILE return 0 } @@ -145,47 +171,53 @@ prepare_win32() build_generic() { cd $ROOT/3rdparty/sdl - echo "Building SDL (this may take a while)..." | tee -a $ROOT/setup.log - ./autogen.sh >> $ROOT/setup.log + echo "Building SDL (this may take a while)..." | tee -a $LOGFILE + ./autogen.sh >> $LOGFILE cd $ROOT/build/sdl - $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed SDL!" | tee -a $ROOT/setup.log + $ROOT/3rdparty/sdl/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed SDL!" | tee -a $LOGFILE cd $ROOT/3rdparty/freetype2 - echo "Building Freetype2 (this may take a while)..." | tee -a $ROOT/setup.log - chmod +x autogen.sh >> $ROOT/setup.log - chmod +x configure >> $ROOT/setup.log - ./autogen.sh >> $ROOT/setup.log + echo "Building Freetype2 (this may take a while)..." | tee -a $LOGFILE + chmod +x autogen.sh >> $LOGFILE + chmod +x configure >> $LOGFILE + ./autogen.sh >> $LOGFILE cd $ROOT/build/freetype2 # note: freetype (or sdl?) probably doesn't need *no* configure when static -> ansi build, see readme! - $ROOT/3rdparty/freetype2/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed Freetype2!" | tee -a $ROOT/setup.log + $ROOT/3rdparty/freetype2/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed Freetype2!" | tee -a $LOGFILE + cd $ROOT/3rdparty/oglft + echo "Patching OGLFT..." | tee -a $LOGFILE + # note: svn has no force/overwrite switch. patched files might not be updated + # patch: use fixed settings for freetype, deactivate FindFreetype + FREETYPE2_INCLUDE_DIR="$ROOT/install/include" + FREETYPE2_LIBRARIES="$ROOT/install/lib/liboglft.a" + patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.oglft.patch >> $LOGFILE + # patch: build static lib instead of shared cd $ROOT/3rdparty/oglft/liboglft - echo "Building OGLFT..." | tee -a $ROOT/setup.log - # note: svn has no force/overwrite switch. the file might not be updated when patched - patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.liboglft.patch >> $ROOT/setup.log - # TODO: patch CMakeLists.txt in case FindFreetype.cmake is not available! + patch CMakeLists.txt < $ROOT/patches/CMakeLists.txt.liboglft.patch >> $LOGFILE + echo "Building OGLFT..." | tee -a $LOGFILE cd $ROOT/build/oglft - cmake $ROOT/3rdparty/oglft >> $ROOT/setup.log - make >> $ROOT/setup.log - mkdir -p $ROOT/install/include/oglft >> $ROOT/setup.log - cp OGLFT.h $ROOT/install/include/oglft >> $ROOT/setup.log - cp liboglft/liboglft.a $ROOT/install/lib >> $ROOT/setup.log - echo "Successfully built and installed OGLFT!" | tee -a $ROOT/setup.log + cmake -DFREETYPE2_INCLUDE_DIR="$FREETYPE2_INCLUDE_DIR" -DFREETYPE2_LIBRARIES="$FREETYPE2_LIBRARIES" $ROOT/3rdparty/oglft >> $LOGFILE + make >> $LOGFILE + mkdir -p $ROOT/install/include/oglft >> $LOGFILE + cp OGLFT.h $ROOT/install/include/oglft >> $LOGFILE + cp liboglft/liboglft.a $ROOT/install/lib >> $LOGFILE + echo "Successfully built and installed OGLFT!" | tee -a $LOGFILE cd $ROOT/3rdparty/boinc - echo "Building BOINC (this may take a while)..." | tee -a $ROOT/setup.log - ./_autosetup >> $ROOT/setup.log + echo "Building BOINC (this may take a while)..." | tee -a $LOGFILE + ./_autosetup >> $LOGFILE cd $ROOT/build/boinc - $ROOT/3rdparty/boinc/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --disable-server --disable-client >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed BOINC!" | tee -a $ROOT/setup.log + $ROOT/3rdparty/boinc/configure --prefix=$ROOT/install --enable-shared=no --enable-static=yes --disable-server --disable-client >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed BOINC!" | tee -a $LOGFILE return 0 } @@ -201,33 +233,33 @@ build_mingw() build_starsphere() { - echo "Building Starsphere [ORC]..." | tee -a $ROOT/setup.log + echo "Building Starsphere [ORC]..." | tee -a $LOGFILE export ORC_SRC=$ROOT/src/orc export ORC_INSTALL=$ROOT/install cd $ROOT/build/orc - cp $ROOT/src/orc/Makefile . >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed Starsphere [ORC]!" | tee -a $ROOT/setup.log + cp $ROOT/src/orc/Makefile . >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed Starsphere [ORC]!" | tee -a $LOGFILE - echo "Building Starsphere [Framework]..." | tee -a $ROOT/setup.log + echo "Building Starsphere [Framework]..." | tee -a $LOGFILE export FRAMEWORK_SRC=$ROOT/src/framework export FRAMEWORK_INSTALL=$ROOT/install cd $ROOT/build/framework - cp $ROOT/src/framework/Makefile . >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed Starsphere [Framework]!" | tee -a $ROOT/setup.log + cp $ROOT/src/framework/Makefile . >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed Starsphere [Framework]!" | tee -a $LOGFILE - echo "Building Starsphere [Application]..." | tee -a $ROOT/setup.log + echo "Building Starsphere [Application]..." | tee -a $LOGFILE export STARSPHERE_SRC=$ROOT/src/starsphere export STARSPHERE_INSTALL=$ROOT/install cd $ROOT/build/starsphere - cp $ROOT/src/starsphere/Makefile . >> $ROOT/setup.log - cp $ROOT/src/starsphere/*.res . >> $ROOT/setup.log - make >> $ROOT/setup.log - make install >> $ROOT/setup.log - echo "Successfully built and installed Starsphere [Application]!" | tee -a $ROOT/setup.log + cp $ROOT/src/starsphere/Makefile . >> $LOGFILE + cp $ROOT/src/starsphere/*.res . >> $LOGFILE + make >> $LOGFILE + make install >> $LOGFILE + echo "Successfully built and installed Starsphere [Application]!" | tee -a $LOGFILE return 0 } @@ -282,8 +314,9 @@ check_last_build() LASTBUILD=`cat .lastbuild 2>/dev/null` if [[ ( -f .lastbuild ) && ( "$LASTBUILD" != "$1" ) ]]; then - # TODO: clean build dirs when different target! - echo "Not yet implemented: cleanup in check_lastbuild()" + cd $ROOT + rm -rf build + rm -rf install fi echo "$1" > .lastbuild @@ -305,7 +338,7 @@ print_usage() echo " --win32" echo "*************************" - echo "Wrong usage. Stopping!" >> $ROOT/setup.log + echo "Wrong usage. Stopping!" >> $LOGFILE return 0 } @@ -313,18 +346,14 @@ print_usage() ### main control ########################################################## -ROOT=`pwd` -DATE=`date` - -TARGET=0 TARGET_LINUX=1 TARGET_MAC=2 TARGET_WIN32=3 -echo "************************************" >> $ROOT/setup.log -echo "Starting new setup run!" >> $ROOT/setup.log -echo "$DATE" >> $ROOT/setup.log -echo "************************************" >> $ROOT/setup.log +echo "************************************" >> $LOGFILE +echo "Starting new setup run!" >> $LOGFILE +echo "$DATE" >> $LOGFILE +echo "************************************" >> $LOGFILE # crude command line parsing :-) @@ -337,17 +366,17 @@ case "$1" in "--linux") TARGET=$TARGET_LINUX check_last_build "$1" - echo "Building linux version:" | tee -a $ROOT/setup.log + echo "Building linux version:" | tee -a $LOGFILE ;; "--mac") TARGET=$TARGET_MAC check_last_build "$1" - echo "Building mac version:" | tee -a $ROOT/setup.log + echo "Building mac version:" | tee -a $LOGFILE ;; "--win32") TARGET=$TARGET_WIN32 check_last_build "$1" - echo "Building win32 version:" | tee -a $ROOT/setup.log + echo "Building win32 version:" | tee -a $LOGFILE ;; "--distclean") distclean