From 75dbf967302821bca0e792236754a188c806a631 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 5 Mar 2013 19:56:23 +0000 Subject: [PATCH] - cmake bug fix for open suse (and fedora) --- CMakeLists.txt | 4 ++- build-mg.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 08af47348..e915af542 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,10 +64,11 @@ file(READ ${PROJECT_SOURCE_DIR}/source/glest_game/facilities/game_util.cpp MG_VE #string (REGEX MATCH "\"v(.*).(.*).(.*)\"" _threePartMatch ${MG_VERSION_H_CONTENTS}) #string (REGEX MATCH "\"v[^.]*.[^.]*(.[^.])?\"" _threePartMatch ${MG_VERSION_H_CONTENTS}) # +MESSAGE(STATUS "Determining version number system type to use:") # "v([0-9]).([0-9].*)([0-9].*)?"; string (REGEX MATCH "\"v([0-9]).([0-9]).([0-9].*)[^\";]" _threePartMatch ${MG_VERSION_H_CONTENTS}) if(NOT _threePartMatch) - MESSAGE(STATUS "******* Trying 2 part versioning] ") + MESSAGE(STATUS "** Trying 2 part versioning] ") string (REGEX MATCH "\"v([0-9]).([0-9].*)[^\";]" _threePartMatch ${MG_VERSION_H_CONTENTS}) if (_threePartMatch) @@ -83,6 +84,7 @@ if(NOT _threePartMatch) endif() # parse the version string else() + MESSAGE(STATUS "** Trying 3 part versioning] ") if (_threePartMatch) # parse the parts of the version string STRING(REGEX REPLACE "\"v([0-9])\\.[0-9]\\.[0-9].*" "\\1" VER_MAJOR "${_threePartMatch}") diff --git a/build-mg.sh b/build-mg.sh index c1bee246b..a1c644ccc 100755 --- a/build-mg.sh +++ b/build-mg.sh @@ -18,8 +18,98 @@ if [ -f 'CMakeCache.txt' ]; then rm -f 'CMakeCache.txt'; fi # this script looks for google-breakpad in the main root folder, you may link to the real path using: # ln -s ../../google-breakpad/ google-breakpad +LANG=C +svnversion=`readlink -f $0 | xargs dirname | xargs svnversion` +architecture=`uname -m` + +# Is the lsb_release command supported? +if [ `which lsb_release`'x' = 'x' ] +then + lsb=0 + if [ -e /etc/debian_version ]; then distribution='Debian'; release='unknown release version'; codename=`cat /etc/debian_version`; fi + if [ -e /etc/SuSE-release ]; then distribution='SuSE'; release='unknown release version'; codename=`cat /etc/SuSE-release`; fi + if [ -e /etc/fedora-release ]; then distribution='Fedora'; release='unknown release version'; codename=`cat /etc/fedora-release`; fi + if [ -e /etc/redhat-release ]; then distribution='Redhat'; release='unknown release version'; codename=`cat /etc/redhat-release`; fi + if [ -e /etc/mandrake-release ]; then distribution='Mandrake'; release='unknown release version'; codename=`cat /etc/mandrake-release`; fi +else + lsb=1 + + # lsb_release output by example: + # + # $ lsb_release -i + # Distributor ID: Ubuntu + # + # $ lsb_release -d + # Description: Ubuntu 12.04 LTS + # + # $ lsb_release -r + # Release: 12.04 + # + # $ lsb_release -c + # Codename: precise + + distribution=`lsb_release -i | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'` + release=`lsb_release -r | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'` + codename=`lsb_release -c | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'` + + # Some distribution examples: + # + # OpenSuSE 11.4 + #LSB Version: n/a + #Distributor ID: SUSE LINUX + #Description: openSUSE 11.4 (x86_64) + #Release: 11.4 + #Codename: Celadon + # + # OpenSuSE 12.1 + #LSB support: 1 + #Distribution: SUSE LINUX + #Release: 12.1 + #Codename: Asparagus + # + # Arch + #LSB Version: n/a + #Distributor ID: archlinux + #Description: Arch Linux + #Release: rolling + #Codename: n/a + # + # Ubuntu 12.04 + #Distributor ID: Ubuntu + #Description: Ubuntu 12.04 LTS + #Release: 12.04 + #Codename: precise +fi + +echo 'We have detected the following system:' +echo ' [ '"$distribution"' ] [ '"$release"' ] [ '"$codename"' ] [ '"$architecture"' ]' + +EXTRA_CMAKE_OPTIONS= + +case $distribution in + SuSE|SUSE?LINUX|Opensuse) + case $release in + *) + echo 'Turning ON dynamic CURL ...' + EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DFORCE_CURL_DYNAMIC_LIBS=ON" + ;; + esac + ;; + + Fedora) + case $release in + *) + echo 'Turning ON dynamic CURL ...' + EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DFORCE_CURL_DYNAMIC_LIBS=ON" + ;; + esac + ;; +esac + +#exit 1; + CURRENTDIR="$(dirname $(readlink -f $0))" -cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON -DWANT_STATIC_LIBS=ON -DBREAKPAD_ROOT=${CURRENTDIR}/../google-breakpad/ .. +cmake -DCMAKE_INSTALL_PREFIX='' -DWANT_DEV_OUTPATH=ON -DWANT_STATIC_LIBS=ON -DBREAKPAD_ROOT=${CURRENTDIR}/../google-breakpad/ ${EXTRA_CMAKE_OPTIONS} .. if [ $? -ne 0 ]; then echo 'ERROR: CMAKE failed.' >&2; exit 1 fi