cpp-d1064d mbuild_1.1-0
authorMichael Wagner <michael@wagnertech.de>
Fri, 22 Jan 2021 22:37:00 +0000 (23:37 +0100)
committerMichael Wagner <michael@wagnertech.de>
Fri, 22 Jan 2021 22:37:00 +0000 (23:37 +0100)
debian/mbuild.changelog
tools/make/cmake_check [deleted file]
tools/make/mconfigure

index dde0f6b..35c75c3 100644 (file)
@@ -1,3 +1,7 @@
+projects (1.1-%BUILD%) unstable; urgency=medium
+  * support of cross compile environments with cmake
+ -- Michael Wagner <michael@wagnertech.de>  Tue, 12 Jan 2021 22:54:48 +0100
+  
 projects (1.0-%BUILD%) unstable; urgency=medium
   * prebuild in <paket>.build no longer supported
   * support of cmake builds
diff --git a/tools/make/cmake_check b/tools/make/cmake_check
deleted file mode 100755 (executable)
index 22f6eb4..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-set -e
-cd ../build
-if [ -e debian/$paket.cmake ]
-then
-       # do checks
-       if [ -e debian/$paket.build ]
-       then
-               echo "cmake is not compatible with other builds. Remove $paket.build"
-               exit 1
-       fi
-       if [ -e debian/$paket.prebuild ]
-       then
-               echo "cmake is not compatible with other builds. Remove $paket.prebuild"
-               exit 2
-       fi
-       
-       cp debian/$paket.cmake CMakeLists.txt
-       echo "make" > debian/$paket.build
-       chmod 755 debian/$paket.build
-       echo "cmake ." > debian/$paket.prebuild
-       chmod 755 debian/$paket.prebuild
-fi
-
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