5 echo "usage: mconfigure <package> [options]"
9 echo " -p : pack default: do all"
12 function check_unversioned {
13 # has to be called in the projects base directory
14 # result: "M" in stdout or nothing
17 project=${project##*/}
19 mCM $project -b -an > /dev/null
20 wc=$(wc $project.batch)
22 if [ "${wc:0:5}" != "0 0 0" ]
36 build="$build$(check_unversioned)"
40 tag=$(git describe --tags 2>/dev/null) || true
46 if [ "$tag_paket" != "$paket" ]
50 changes=$(check_unversioned)
53 version=${version##*_}
56 echo "No configuration system found. Cannot determine version."
61 function check_version {
63 vline=$(head -1 debian/$paket.changelog)
66 if [ $version = "0.0" ]
72 # do no check on a modified git repos
73 if [ "${build: -1}" == "M" ]
78 if [ "$clversion" != $version ]
80 echo "version mismatch: git: $version, changelog: $clversion"
84 # to build a package you need ...
85 # <package>.cp (optional): copy step for package production
86 # <package>.cpp.sh (optional): commands to setup the C++ compile environment
96 echo "run mconfigure in the project base directory with a debian directory in it!"
106 while getopts ":acdp" opt; do
116 \?) echo "Invalid option: -$OPTARG"
120 :) echo "Option -$OPTARG requires an argument."
127 # if nothing is selected, select all
128 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
135 if [ $configure -eq 1 ]
137 # delete changelog and control
138 rm debian/changelog debian/control || true
140 # mconfigure builds 2 environment files: setenv.sh + rules.pre
141 # setenv.sh is finally appended to rules.pre
143 dpkg-architecture > debian/setenv.sh
144 echo "" > debian/rules.pre
146 echo "paket=$paket" >> debian/setenv.sh
153 echo "version=$version" >> debian/setenv.sh
154 echo "build=$build" >> debian/setenv.sh
156 # get repository name
160 # echo "pwd=$pwd" >> debian/rules.pre
162 echo "building $paket with build $version-$build"
164 pushd debian >/dev/null
165 # ./debian -------------------------------------
167 ln -sf /usr/share/mbuild/rules .
174 # check for pre/post installation scripts
175 if [ -f $paket.preinst ]
177 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
179 if [ -f $paket.postinst ]
181 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
183 if [ -f $paket.prerm ]
185 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
187 if [ -f $paket.postrm ]
189 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
192 cat setenv.sh >> rules.pre
196 # load util functions for C/C++ - build
197 if [ -f $paket.cpp.sh ]
200 . projects/tools/make/c_configure.sh
205 # ./. ---------------------------------------------
207 # copy package control
208 if [ -f debian/$paket.control ]
213 # try old fashoned way
214 control=$(find etc -name $paket.control) || true
217 echo "warning: control file not found"
218 echo " this file is necessary for any package production."
223 Maintainer: WagnerTech UG <mail@wagnertech.de>
224 " > debian/$paket.control
225 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
230 if [ -e debian/$paket.build ]
237 if grep -- "-prepare" debian/$paket.build >/dev/null
240 debian/$paket.build -prepare
245 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
247 echo "PACK=binary" >> debian/rules.pre
248 elif [ -f debian/$paket.cp ]
250 echo "PACK=zip" >> debian/rules.pre
252 echo "PACK=version" >> debian/rules.pre
256 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
258 echo "no debian/build.sh: skipping build step"
261 if [ $compile -eq 1 ]