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" ]
35 build="$build$(check_unversioned)"
38 tag=$(git describe --tags 2>/dev/null) || true
44 if [ "$tag_paket" != "$paket" ]
48 changes=$(check_unversioned)
51 version=${version##*_}
54 echo "No configuration system found. Cannot determine version."
59 function check_version {
61 vline=$(head -1 debian/$paket.changelog)
64 if [ $version = "0.0" ]
70 # do no check on a modified git repos
71 if [ "${build: -1}" == "M" ]
76 if [ "$clversion" != $version ]
78 echo "version mismatch: git: $version, changelog: $clversion"
82 # to build a package you need ...
83 # <package>.cp (optional): copy step for package production
84 # <package>.cpp.sh (optional): commands to setup the C++ compile environment
94 echo "run mconfigure in the project base directory with a debian directory in it!"
104 while getopts "a:cdp" opt; do
114 \?) echo "Invalid option: -$OPTARG"
118 :) echo "Option -$OPTARG requires an argument."
125 # if nothing is selected, select all
126 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
133 if [ $configure -eq 1 ]
135 # delete changelog and control
136 rm debian/changelog debian/control 2>/dev/null || true
138 # mconfigure builds 2 environment files: setenv.sh + rules.pre
144 dpkg-architecture $arch_opt > debian/setenv.sh
145 echo "" > debian/rules.pre
147 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
204 # add export to setenv.sh
205 sed -i "s/^/export /" setenv.sh
208 # ./. ---------------------------------------------
210 # copy package control
211 if [ -f debian/$paket.control ]
216 # try old fashoned way
217 control=$(find etc -name $paket.control) || true
220 echo "warning: control file not found"
221 echo " this file is necessary for any package production."
226 Maintainer: WagnerTech UG <mail@wagnertech.de>
227 " > debian/$paket.control
228 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
233 if [ -e debian/$paket.build ]
240 if grep -- "-prepare" debian/$paket.build >/dev/null
243 debian/$paket.build -prepare
248 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
250 echo "PACK=binary" >> debian/rules.pre
251 if grep "^Architecture: *all" debian/$paket.control >/dev/null
253 echo "arch = all" >> debian/rules.pre
254 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
256 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
257 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
259 elif [ -f debian/$paket.cp ]
261 echo "PACK=zip" >> debian/rules.pre
263 echo "PACK=version" >> debian/rules.pre
267 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
269 echo "no debian/build.sh: skipping build step"
272 if [ $compile -eq 1 ]