6 echo "usage: mconfigure <package> [options]"
10 echo " -p : pack default: do all"
13 function check_unversioned {
14 # has to be called in the projects base directory
15 # result: "M" in stdout or nothing
18 project=${project##*/}
20 mCM $project -b -an > /dev/null
21 wc=$(wc $project.batch)
23 if [ "${wc:0:5}" != "0 0 0" ]
36 build="$build$(check_unversioned)"
39 tag=$(git describe --tags 2>/dev/null) || true
45 if [ "$tag_paket" != "$paket" ]
49 changes=$(check_unversioned)
52 version=${version##*_}
55 echo "No configuration system found. Cannot determine version."
60 function check_version {
62 vline=$(head -1 debian/$paket.changelog)
65 if [ $version = "0.0" ]
71 # do no check on a modified git repos
72 if [ "${build: -1}" == "M" ]
77 if [ "$clversion" != $version ]
79 echo "version mismatch: git: $version, changelog: $clversion"
83 # to build a package you need ...
84 # <package>.cp (optional): copy step for package production
85 # <package>.cpp.sh (optional): commands to setup the C++ compile environment
95 echo "run mconfigure in the project base directory with a debian directory in it!"
105 while getopts "a:cdp" opt; do
115 \?) echo "Invalid option: -$OPTARG"
119 :) echo "Option -$OPTARG requires an argument."
126 # if nothing is selected, select all
127 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
134 if [ $configure -eq 1 ]
136 # delete changelog and control
137 rm debian/changelog debian/control || true
139 # mconfigure builds 2 environment files: setenv.sh + rules.pre
145 dpkg-architecture $arch_opt > debian/setenv.sh
146 echo "" > debian/rules.pre
148 echo "paket=$paket" >> debian/setenv.sh
154 echo "version=$version" >> debian/setenv.sh
155 echo "build=$build" >> debian/setenv.sh
157 # get repository name
161 # echo "pwd=$pwd" >> debian/rules.pre
163 echo "building $paket with build $version-$build"
165 pushd debian >/dev/null
166 # ./debian -------------------------------------
168 ln -sf /usr/share/mbuild/rules .
175 # check for pre/post installation scripts
176 if [ -f $paket.preinst ]
178 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
180 if [ -f $paket.postinst ]
182 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
184 if [ -f $paket.prerm ]
186 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
188 if [ -f $paket.postrm ]
190 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
193 cat setenv.sh >> rules.pre
197 # load util functions for C/C++ - build
198 if [ -f $paket.cpp.sh ]
201 . projects/tools/make/c_configure.sh
205 # add export to setenv.sh
206 sed -i "s/^/export /" setenv.sh
209 # ./. ---------------------------------------------
211 # copy package control
212 if [ -f debian/$paket.control ]
217 # try old fashoned way
218 control=$(find etc -name $paket.control) || true
221 echo "warning: control file not found"
222 echo " this file is necessary for any package production."
227 Maintainer: WagnerTech UG <mail@wagnertech.de>
228 " > debian/$paket.control
229 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
234 if [ -e debian/$paket.build ]
241 if grep -- "-prepare" debian/$paket.build >/dev/null
244 debian/$paket.build -prepare
249 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
251 echo "PACK=binary" >> debian/rules.pre
252 elif [ -f debian/$paket.cp ]
254 echo "PACK=zip" >> debian/rules.pre
256 echo "PACK=version" >> debian/rules.pre
260 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
262 echo "no debian/build.sh: skipping build step"
265 if [ $compile -eq 1 ]