5 echo "usage: mconfigure [options] <package>"
8 echo " -C <cross environment>"
10 echo " -p : pack default: do all"
11 echo " -o : support old Debian 7 format"
14 function check_unversioned {
15 # has to be called in the projects base directory
16 # result: "M" in stdout or nothing
19 # check if build is running in a sandbox
20 if ! [ -f .cm.ignore ]
23 echo ".cm.ignore" > .cm.ignore
24 echo "debian.*" >> .cm.ignore
25 echo "up.*" >> .cm.ignore
29 project=${project##*/}
31 mCM $project -b -an > /dev/null
32 wc=$(wc $project.batch)
34 if [ "${wc:0:5}" != "0 0 0" ]
48 build="$build$(check_unversioned)"
51 tag=$(git describe --tags --match "${paket}_*" 2>/dev/null) || true
56 changes=$(check_unversioned)
59 version=${version##*_}
62 echo "No configuration system found. Cannot determine version."
67 function check_version {
70 vline=$(head -1 debian/$paket.changelog)
73 if [ $version = "0.0" ]
79 # do no check on a modified git repos
80 if [ "${build: -1}" == "M" ]
85 if [ "$clversion" != $version ]
87 echo "version mismatch: git: $version, changelog: $clversion"
94 echo "run mconfigure in the project base directory with a debian directory in it!"
101 while getopts "a:cC:dpo" opt; do
115 \?) echo "Invalid option: -$OPTARG"
119 :) echo "Option -$OPTARG requires an argument."
135 if [ -n "$ARCH" -a -n "$cross" ]
137 echo "invalid options: supply -a for multiarch or -C for explicit cross compile environment"
141 # if nothing is selected, select all
142 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
149 if [ $configure -eq 1 ]
151 # delete changelog and control
152 rm debian/changelog debian/control 2>/dev/null || true
154 # mconfigure builds 2 environment files: setenv.sh + rules.pre
155 echo "" > debian/rules.pre
156 if [ -e debian/setenv.sh ]; then rm debian/setenv.sh; fi
164 if [ ${cross:0:1} != "/" ]
166 cross="/opt/cross/$cross"
169 cp $cross/setenv.sh debian/setenv.sh
171 dpkg-architecture $arch_opt >> debian/setenv.sh
173 echo "paket=$paket" >> debian/setenv.sh
174 echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
178 echo "version=$version" >> debian/setenv.sh
179 echo "build=$build" >> debian/setenv.sh
181 # get repository name
185 # echo "pwd=$pwd" >> debian/rules.pre
187 echo "building $paket with build $version-$build"
189 pushd debian >/dev/null
190 # ./debian -------------------------------------
192 ln -sf /usr/share/mbuild/rules .
199 # check for pre/post installation scripts
200 if [ -f $paket.preinst ]
202 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
204 if [ -f $paket.postinst ]
206 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
208 if [ -f $paket.prerm ]
210 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
212 if [ -f $paket.postrm ]
214 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
219 # add export to setenv.sh
220 sed -i "s/^/export /" setenv.sh
223 # ./. ---------------------------------------------
225 # copy package control
226 if [ -f debian/$paket.control ]
231 echo "warning: control file not found"
232 echo " this file is necessary for any package production."
236 if [ -x debian/$paket.prepare ]
239 debian/$paket.prepare
241 if [ -e debian/$paket.cmake ]
244 touch debian/$paket.build
246 if [ -e debian/$paket.build ]
253 if grep -- "-prepare" debian/$paket.build >/dev/null
255 echo "prepare in <paket>.build no longer supported. Use <paket>.prebuild"
265 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
267 echo "PACK=binary" >> debian/rules.pre
268 if grep "^Architecture: *all" debian/$paket.control >/dev/null
270 echo "arch = all" >> debian/rules.pre
271 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
273 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
274 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
276 elif [ -f debian/$paket.cp ]
278 echo "PACK=zip" >> debian/rules.pre
280 echo "PACK=version" >> debian/rules.pre
284 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
286 echo "no debian/$paket.build: skipping build step"
289 if [ $compile -eq 1 ]