cpp-d1064d
[projects.git] / tools / make / mconfigure
index ec5d2a6..adea0e3 100755 (executable)
@@ -26,6 +26,14 @@ function cmake_check {
                fi
                
                cp debian/$paket.cmake CMakeLists.txt
+
+               if [ -n "$cross" ]
+               then
+                       # inject cross toolset
+                       echo "set (CMAKE_MODULE_PATH $cross)" >> CMakeLists.txt
+                       echo "include(toolset)" >> CMakeLists.txt
+               fi
+
                echo "make" > debian/$paket.build
                chmod 755 debian/$paket.build
                cmake .
@@ -175,18 +183,30 @@ then
        echo "" > debian/rules.pre
        if [ -e debian/setenv.sh ]; then rm debian/setenv.sh; fi
        
-       if [ -n "$ARCH" ]
-       then
-               arch_opt="-a $ARCH"
-       fi
        if [ -n "$cross" ]
        then
                if [ ${cross:0:1} != "/" ]
                then
                        cross="/opt/cross/$cross"
+                       #export $cross
                fi
-               . "$cross/setenv.sh"
-               cp $cross/setenv.sh debian/setenv.sh
+               if [ -f "$cross/setenv.sh" ]
+               then
+                       . "$cross/setenv.sh"
+                       cp $cross/setenv.sh debian/setenv.sh
+               fi
+               if [ -z "$ARCH" ]
+               then
+                       # determine architecture
+                       GNU_ARCH=${cross%-*} # assumed format: DEB_HOST_GNU_TYPE-g++version, e.g. arm-linux-gnueabihf-4.9
+                       GNU_ARCH=${GNU_ARCH##*/}
+                       arch_opt="-t $GNU_ARCH"
+               fi
+       fi
+
+       if [ -n "$ARCH" ]
+       then
+               arch_opt="-a $ARCH"
        fi
        dpkg-architecture $arch_opt >> debian/setenv.sh