add op_lidstate
[pandora-misc.git] / sdk_installer / openpandora_toolchain.sh
index 49861ea..6863588 100755 (executable)
 #   even include some useless things) but only a small number of binaries that
 #   can't be run on the host architecture.
 # * Should be rather easy to keep in sync with upsteam (aka openpandora.org)
-#   version changes.
+#   version changes simply by rerunning the script.
 #
-# The latest version of this script should be available in this forum thread:
+# The latest version of this script should be available in the openpandora.org
+# git repository:
+# http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-misc.git;a=tree;f=sdk_installer
+# 
+# Some more (partly historical) information about this installer script is
+# available in the following forum thread:
 # http://www.gp32x.com/board/index.php?/topic/58443-crosscompiler-toolchain-based-on-openpandora-org-ipks/
 #
 # This script was initially based upon the scripts provided in these threads:
 # http://www.gp32x.com/board/index.php?/topic/52343-pandora-sdk-installer/
 # http://www.gp32x.com/board/index.php?/topic/55453-pandora-sdk-installer-with-opkg/
 #
-# Copyright (C) 2011 by Nils Kneuper <crazy-ivanovic@gmx.net>
+# Copyright (C) 2011, 2012 by Nils Kneuper <crazy-ivanovic@gmx.net>
 #
 #
 # How to use:
@@ -47,7 +52,8 @@
 #   files. Those 700MB will be downloaded using your internetconnection.
 #
 # Known limitations:
-# * This toolchain won't work on a pure 64bit system.
+# * This toolchain won't work on a pure 64bit system (common systems also
+#   install 32bit libs, so this most likely does not affect you!).
 # * Whitespaces as well as quotes won't work inside the path to your PNDSDK_DIR.
 # * It will not automagically install the deps you need later on to run it, some
 #   hints what might be required are at the end of this comment section.
@@ -69,7 +75,7 @@
 # Getting the deps for Gentoo:
 # * If you are using amd64 make sure that the useflag "multilib" is selected.
 # * All required dependencies for this script to work should already be
-# * available.
+#   available.
 #
 #
 # TODO:
@@ -99,6 +105,8 @@ PNDSDK_DIR=$HOME/pandora-dev
 #PNDSDK=$PNDSDK_DIR/arm-2010.09
 #PNDSDK=$PNDSDK_DIR/arm-2011.03
 PNDSDK=$PNDSDK_DIR/arm-2011.09
+#PNDSDK=$PNDSDK_DIR/arm-2013.11
+
 USEFUL_TOOLS_DIR=$PNDSDK_DIR/sdk_utils
 
 TARGET_SYS=arm-none-linux-gnueabi
@@ -116,9 +124,14 @@ TARGET_SYS=arm-none-linux-gnueabi
 TOOLCHAIN_URL=http://sourcery.mentor.com/sgpp/lite/arm/portal/package9728/public/arm-none-linux-gnueabi/arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 TOOLCHAIN_TARBALL_NAME=arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
 TOOLCHAIN_MD5=56d9a77654d012914e703dc8d9383246
+#TOOLCHAIN_URL=https://sourcery.mentor.com/GNUToolchain/package12225/public/arm-none-linux-gnueabi/arm-2013.11-33-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
+#TOOLCHAIN_TARBALL_NAME=arm-2013.11-33-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
+#TOOLCHAIN_MD5=56276ed5d7a8edffa9d536a18284e5e0
+
 OPKG_VERSION=opkg-0.1.8
 OPKG_ARCHIVE_MD5=c714ce0e4863bf1315e3b6913ffe3299
 OPKG_ARCHIVE=$OPKG_VERSION.tar.gz
+
 #PKGCONFIG_VERSION=pkg-config-0.25
 #PKGCONFIG_ARCHIVE_MD5=a3270bab3f4b69b7dc6dbdacbcae9745
 PKGCONFIG_VERSION=pkg-config-0.26
@@ -165,6 +178,16 @@ check_wget_error()
 }
 
 
+check_error()
+{
+       if [ "$?" -ne "0" ];
+       then
+               cecho "ERROR: Sorry, some error occured. Stopping this script now. Please check for the error message above (eg. 'not enough space left') and fix them before retrying the script." $red
+               exit 1
+       fi
+}
+
+
 check_md5sum()
 {
        LOCAL_ARCHIV=${1}
@@ -225,6 +248,7 @@ install_codesourcery_toolchain()
        echo -e
        cecho "Extracting codesourcery toolchain to $PNDSDK_DIR" $green
        tar -xjf $TMPDIR/$TOOLCHAIN_TARBALL_NAME -C $PNDSDK_DIR
+       check_error
 
        #move libstdc++ files that are going to just hurt to some place where they should not be a bother...
        #the version later on installed by the libstdc++ package should be perfectly fine!
@@ -446,12 +470,14 @@ install_libs_via_opkg()
        cecho "Updating opkg package feeds" $green
        #update repository against latest version
        $PNDSDK/bin/opkg-cl --conf=$PNDSDK/opkg.conf --offline-root=$PNDSDK update
+       check_error
 
        echo -e
        cecho "Installing all libs, based on $TMPDIR/packages.txt" $green
        cecho "Error messages from opkg about missing dependencies can be ignored!" $cyan
        #install all possible dev packages adding their deps, too
        $PNDSDK/bin/opkg-cl --conf=$PNDSDK/opkg.conf --cache=$TMPDIR --offline-root=$PNDSDK install `cat $TMPDIR/packages.txt | cut -f 1 -d " " | xargs echo`
+       check_error
        cecho "The error messages from opkg about missing dependencies can be ignored!" $cyan
 
        echo -e
@@ -758,10 +784,10 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 
 #usage sample with the sample case "wesnoth":
 #current 1.10 setup:
-#PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -fno-inline-functions" CXXFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -fno-inline-functions" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLIBINTL_INCLUDE_DIR=$PNDSDK/arm-none-linux-gnueabi/libc/usr/include/ -DPREFERENCES_DIR=wesnoth-1.10_userdata ../wesnoth-1.10.x
+#PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp" CXXFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLIBINTL_INCLUDE_DIR=$PNDSDK/arm-none-linux-gnueabi/libc/usr/include/ -DPREFERENCES_DIR=wesnoth-1.10_userdata ../wesnoth-1.10.x
 #
 #current 1.11 setup:
-#PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -fno-inline-functions" CXXFLAGS="-DPANDORA -O2 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=soft -fno-inline-functions" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLIBINTL_INCLUDE_DIR=$PNDSDK/arm-none-linux-gnueabi/libc/usr/include/ -DPREFERENCES_DIR=wesnoth-1.11_userdata ../wesnoth-1.11.x
+#PATH=$PNDSDK/usr/bin:\$PATH CFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp" CXXFLAGS="-DPANDORA -O3 -pipe -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -ftree-vectorize -mfloat-abi=softfp" cmake -DCMAKE_BUILD_TYPE=release -DENABLE_STRICT_COMPILATION=off -DENABLE_PANDORA=on -DCMAKE_TOOLCHAIN_FILE=$USEFUL_TOOLS_DIR/PandoraToolchain.cmake -DPKG_CONFIG_EXECUTABLE=$PNDSDK/bin/arm-none-linux-gnueabi-pkg-config -DSDL_CONFIG=$PNDSDK/usr/bin/sdl-config -DLIBINTL_INCLUDE_DIR=$PNDSDK/arm-none-linux-gnueabi/libc/usr/include/ -DPREFERENCES_DIR=wesnoth-1.11_userdata ../wesnoth-1.11.x
 _END_
        
        cecho "Creating $USEFUL_TOOLS_DIR/pandora_configure.sh" $green
@@ -1013,7 +1039,7 @@ _END_
                <xs:attribute name="email" use="optional" type="emailAddress" />
        </xs:complexType>
        
-       <!-- type used for version informations (full entry as well as os version) -->
+       <!-- type used for version informations full entry) -->
        <xs:complexType name="app_version_info">
                <xs:attribute name="major" use="required" type="versionNumber" />
                <xs:attribute name="minor" use="required" type="versionNumber" />
@@ -1021,11 +1047,12 @@ _END_
                <xs:attribute name="build" use="required" type="versionNumber" />
                <xs:attribute name="type" use="optional" type="releaseType" />
        </xs:complexType>
+       <!-- type used for OS version information (os version only) -->
        <xs:complexType name="os_version_info">
-               <xs:attribute name="major" use="required" type="versionNumber" />
-               <xs:attribute name="minor" use="required" type="versionNumber" />
-               <xs:attribute name="release" use="required" type="versionNumber" />
-               <xs:attribute name="build" use="required" type="versionNumber" />
+               <xs:attribute name="major" use="required" type="xs:nonNegativeInteger" />
+               <xs:attribute name="minor" use="required" type="xs:nonNegativeInteger" />
+               <xs:attribute name="release" use="required" type="xs:nonNegativeInteger" />
+               <xs:attribute name="build" use="required" type="xs:nonNegativeInteger" />
        </xs:complexType>
        
        <!-- type used for exec entries -->