]> wagnertech.de Git - projects.git/blobdiff - tools/make/mconfigure
Merge branch 'master' of http://wagnertech.de/git/projects
[projects.git] / tools / make / mconfigure
index dda9b97ffc319ed71f2c56050a378e93271d3757..e091ca67a7a9286c79805edaf5148a72c7f8f10b 100755 (executable)
@@ -6,6 +6,31 @@ function echo_usage {
        ./configure -I
 }
 
+function create_conf {
+       if [ -f "debian/$paket.cmake" ]
+       then
+               echo "compile_type=CMAKE" > debian/$paket.conf
+       elif [ -f "debian/$paket.build" ]
+       then
+               if [ -f "debian/$paket.cpp" ]
+               then
+                       echo "compile_type=CPP" > debian/$paket.conf
+               else
+                       echo "compile_type=ANY" > debian/$paket.conf
+               fi
+       else
+               echo "compile_type=NONE" > debian/$paket.conf
+       fi
+       
+       if [ -f "$paket.control" -a -f "$paket.cp" ]
+       then
+               echo "target_type=DEB" >> debian/$paket.conf
+       else
+               echo "target_type=FILE" >> debian/$paket.conf
+       fi
+       echo "$paket.conf created."
+}
+
 ##############################################################################
 # Main program
 ##############################################################################
@@ -49,9 +74,16 @@ fi
 
 if [ ! -f debian/$paket.conf ]
 then
+       # check if any files for $paket are present
+       if ! ls debian/$paket.* 2>/dev/null
+       then
+               echo "$paket is no build target in this repository."
+               exit 5
+       fi
+       
+       # build conf file
        echo "$paket.conf missing. We create it ..."
-       echo "to be implemented ..."
-       exit 5
+       create_conf
 fi
 
 if [ ! -e configure ]
@@ -67,18 +99,23 @@ then
                rm -rf ~/build
                mkdir ~/build
        fi
+       configure_args="$configure_args -d ~/build"
 fi
 
 # perform configure
 . debian/$paket.conf
-if [ -n "$compile_dir" ]
-then
-       configure_args="$configure_args -b $compile_dir"
-fi
-if [ -z "$compile_type" ]
+if [ "$compile_type" != "NONE" ]
 then
-       echo "compile_type required in $paket.conf"
-       exit 51
+       configure_args="$configure_args -b"
+       if [ -n "$compile_dir" ]
+       then
+               configure_args="$configure_args -d $compile_dir"
+       fi
+       if [ -z "$compile_type" ]
+       then
+               echo "compile_type required in $paket.conf"
+               exit 51
+       fi
 fi
 if [ "$target_type" == "FILE" ]
 then
@@ -144,13 +181,21 @@ then
 elif [ "$target_type" == "FILE" ]
 then
        echo "PACK=version" >> debian/rules.pre
-       if [ -z "$compile_target" ]
+       if [ "$compile_type" != "ANY" ]
        then
-               echo "compile_target is needed for target_type FILE"
-               exit 12
+               if [ -z "$compile_target" ]
+               then
+                       echo "compile_target is needed for target_type FILE"
+                       exit 12
+               fi
+               echo "COMPILE_TARGET = $compile_target" >> debian/rules.pre
+               if [ -n "$target_name" ]
+               then
+                       echo "TARGET = $target_name" >> debian/rules.pre
+               else
+                       echo "TARGET = $paket" >> debian/rules.pre
+               fi
        fi
-       echo "TARGET = $compile_target" >> debian/rules.pre
-       
 else
        echo "Unknown target type: $target_type"
        exit 13