]> wagnertech.de Git - projects.git/blobdiff - tools/make/mconfigure
posaune
[projects.git] / tools / make / mconfigure
index d49601ef18eec11b3a9c9953eae4d9599b3ba15b..d329219f5b79ca33db3c0b818df916f7dc31c971 100755 (executable)
@@ -12,10 +12,16 @@ function set_build {
                build=$(svnversion)
        elif [ -e .git ]
        then
-               build=$(git describe --tags 2>/dev/null)
-               test -n "$build" || build="TOP"
+               build=$(git describe --tags 2>/dev/null) || true
+               if test -z "$build"
+               then
+                       build="0.0-TOP"
+               fi
                changes=$(git status -s |grep "^ *M") || true
-               test -z "$changes" || build="${build}M"
+               if test -z "$changes"
+               then
+                       build="${build}M"
+               fi
        fi
 }
 
@@ -29,15 +35,24 @@ then
        exit 1
 fi
 
-#TODO: check, if running in debian-dir
+if [ ! -d debian ]
+then
+       echo "run mconfigure in the project base directory!"
+       exit 2
+fi
 
-paket=$1
+export paket=$1
 shift
 ARCH=""
 cpp_build=0
-delete_src=1
 
 set_build
+export build
+
+# get repository name
+tmp=$(pwd)
+export pwd=${tmp##*/}
+
 echo "building $paket with build $build"
 
 #while getopts ":a" opt; do
@@ -61,17 +76,19 @@ echo "building $paket with build $build"
 #      rm -rf build
 #fi
 #
-#mkdir -p build
-#pushd build >/dev/null
-#
-#ln -sf /usr/share/mbuild/makefile .
 
-if [ -e $paket ]
-then
-       rm -rf $paket
-fi
-rm *.stamp || true
-rm make.pre || true
+pushd debian >/dev/null
+
+ln -sf /usr/share/mbuild/rules .
+
+#if [ -e tmp ]
+#then
+#      rm -rf tmp
+#fi
+#rm *.stamp 2>/dev/null || true
+#rm make.pre 2>/dev/null || true
+
+mkdir -p tmp/DEBIAN
 
 # load util functions for C/C++ - build
 if [ -f $paket.cpp.sh ]
@@ -82,39 +99,48 @@ then
 fi
 
 # copy package control
-control=$(find .. -name $paket.control)
-build_number=${build#*_}
-if [ -z "$control" ]
-then
-       echo "warning: control file not found"
-       echo "  this file is necessary for any package production."
-else   
-       sed "s/%BUILD%/$build_number/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control
-       echo "$paket.control written."
-
-       # extract version
-       version=$(grep Version $paket.control |sed "s/Version: //")
-fi
+#control=$(find .. -name $paket.control)
+#build_number=${build#*_}
+#if [ -z "$control" ]
+#then
+#      echo "warning: control file not found"
+#      echo "  this file is necessary for any package production."
+#else  
+#      sed "s/%BUILD%/$build_number/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control
+#      echo "$paket.control written."
+#
+#      # extract version
+#      version=$(grep Version $paket.control |sed "s/Version: //")
+#fi
 
-# check for copy file
-copy=$(find .. -name $paket.cp)
-if [ -n "$copy" ]
-then
-       ln -sf $copy .
-else
-       echo "warning: file $paket.cp missing or not executable:"
-       echo "  this file is necessary for any package production."
-fi
+popd >/dev/null
+
+# build package
+debian/rules binary
 
-# check for installation scripts
-files=$(find .. -name $paket.preinst)
-files="$files $(find .. -name $paket.postinst)"
-files="$files $(find .. -name $paket.prerm)"
-files="$files $(find .. -name $paket.postrm)"
-for file in $files
-do
-       ln -sf $file .
-done
+## check for copy file
+#if [ ! -f $paket.cp ]
+#then
+#      # search for copy file
+#      copy=$(find .. -name $paket.cp)
+#      if [ -n "$copy" ]
+#      then
+#              ln -sf $copy .
+#      else
+#              echo "warning: file $paket.cp missing or not executable:"
+#              echo "  this file is necessary for any package production."
+#      fi
+#fi
+#
+## check for installation scripts
+#files=$(find .. -name $paket.preinst)
+#files="$files $(find .. -name $paket.postinst)"
+#files="$files $(find .. -name $paket.prerm)"
+#files="$files $(find .. -name $paket.postrm)"
+#for file in $files
+#do
+#      ln -sf $file .
+#done
 
 # create generic make.pre, if not existing
 #if [ ! -f make.pre ]