cpp-d1064k
authorMichael Wagner <michael@wagnertech.de>
Tue, 12 Jan 2021 12:52:45 +0000 (13:52 +0100)
committerMichael Wagner <michael@wagnertech.de>
Tue, 12 Jan 2021 12:52:45 +0000 (13:52 +0100)
debian/mbuild.changelog
tools/make/cmake_check [new file with mode: 0755]
tools/make/mconfigure
tools/make/rules

index 4ac574d..0b08a5c 100644 (file)
@@ -1,3 +1,8 @@
+projects (1.0-%BUILD%) unstable; urgency=medium
+  * prebuild in <paket>.build no longer supported
+  * support of cmake builds
+ -- Michael Wagner <michael@wagnertech.de>  Tue, 12 Jan 2021 22:54:48 +0100
+  
 projects (0.6-%BUILD%) unstable; urgency=medium
   * calls PAKET.prepare (if present) in config step
   * RSYNC_OPTS in rules.pre
diff --git a/tools/make/cmake_check b/tools/make/cmake_check
new file mode 100755 (executable)
index 0000000..aa85d8c
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/bash
+set -e
+cd ../build
+if [ -e debian/$paket.cmake ]
+then
+       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 95e0006..691825d 100755 (executable)
@@ -5,6 +5,7 @@ function echo_usage {
        echo "usage: mconfigure [options] <package>"
        echo "  -a <arch>"
        echo "  -c : configure"
+       echo "  -C <cross environment>"
        echo "  -d : compile"
        echo "  -p : pack default: do all"
        echo "  -o : support old Debian 7 format"
@@ -97,7 +98,7 @@ fi
 configure=0
 compile=0
 pack=0
-while getopts "a:cdpo" opt; do
+while getopts "a:cC:dpo" opt; do
        case $opt in
                a) ARCH=$OPTARG
                        ;;
@@ -105,6 +106,8 @@ while getopts "a:cdpo" opt; do
                        ;;
                d)      compile=1
                        ;;
+               C) cross=$OPTARG
+                       ;;
                p)      pack=1
                        ;;
                o)      oldpack="-Zgzip"
@@ -129,6 +132,12 @@ fi
 
 paket=$1
 
+if [ -n "$ARCH" -a -n "$cross" ]
+then
+       echo "invalid options: supply -a for multiarch or -C for explicit cross compile environment"
+       exit 1
+fi
+
 # if nothing is selected, select all
 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
 then
@@ -143,13 +152,23 @@ then
        rm debian/changelog debian/control 2>/dev/null || true
        
        # mconfigure builds 2 environment files: setenv.sh + rules.pre
+       echo "" > debian/rules.pre
+       if [ -e debian/setenv.sh ]; then rm debian/setenv.sh; fi
        
        if [ -n "$ARCH" ]
        then
                arch_opt="-a $ARCH"
        fi
-       dpkg-architecture $arch_opt > debian/setenv.sh
-       echo "" > debian/rules.pre
+       if [ -n "$cross" ]
+       then
+               if [ ${cross:0:1} != "/" ]
+               then
+                       cross="/opt/cross/$cross"
+               fi
+               . "$cross/setenv.sh"
+               cp $cross/setenv.sh debian/setenv.sh
+       fi
+       dpkg-architecture $arch_opt >> debian/setenv.sh
        
        echo "paket=$paket" >> debian/setenv.sh
        echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
@@ -219,6 +238,11 @@ then
                . debian/setenv.sh
                debian/$paket.prepare
        fi
+       if [ -e debian/$paket.cmake ]
+       then
+               # trigger build
+               touch debian/$paket.build
+       fi              
        if [ -e debian/$paket.build ]
        then
                if [ -e ../build ]
@@ -227,21 +251,14 @@ then
                        mkdir ../build
                fi
                if grep -- "-prepare" debian/$paket.build >/dev/null
-               then
-                       debian/rules sync
-                       debian/$paket.build -prepare
+               then                    
+                       echo "prepare in <paket>.build no longer supported. Use <paket>.prebuild"
+                       exit 2
                fi
                # sync build dir
-               . debian/setenv.sh
-               debian/rules sync
+#              . debian/setenv.sh
+#              debian/rules sync
                
-               # executing prebuild
-               if [ -x debian/$paket.prebuild ]
-               then
-                       pushd ~/build >/dev/null
-                       debian/$paket.prebuild
-                       popd >/dev/null
-               fi
        fi
        
        # pack prepare
@@ -271,7 +288,7 @@ then
 fi
 if [ $compile -eq 1 ]
 then
-       # build artefacts
+       # build package 
        . debian/setenv.sh
        debian/rules build
 fi
index e446d53..8c57576 100755 (executable)
@@ -18,7 +18,7 @@ clean:
        -rm -rf debian/tmp
 
 # Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis
-build: debian/$(paket).build sync
+build: debian/$(paket).build prebuild
        cd ../build ; debian/$(paket).build
        # Build succeeded
 
@@ -55,6 +55,13 @@ version: ~/build/$(TARGET)
 sync: ../build
        rsync $(RSYNC_OPT) ./ ../build/
 
+../build/cmake_check:
+       /usr/share/mbuild/cmake_check
+       touch ../build/cmake_check
+
+prebuild: sync ../build/cmake_check
+       cd ../build ; if [ -x debian/$(paket).prebuild ]; then debian/$(paket).prebuild; fi
+
 copy: debian/$(paket).cp
        debian/$(paket).cp debian/tmp