5 echo "usage: mconfigure <package> [options]"
9 echo " -p : pack default: do all"
10 echo " -o : support old Debian 7 format"
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:cdpo" opt; do
117 \?) echo "Invalid option: -$OPTARG"
121 :) echo "Option -$OPTARG requires an argument."
128 # if nothing is selected, select all
129 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
136 if [ $configure -eq 1 ]
138 # delete changelog and control
139 rm debian/changelog debian/control 2>/dev/null || true
141 # mconfigure builds 2 environment files: setenv.sh + rules.pre
147 dpkg-architecture $arch_opt > debian/setenv.sh
148 echo "" > debian/rules.pre
150 echo "paket=$paket" >> debian/setenv.sh
151 echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
156 echo "version=$version" >> debian/setenv.sh
157 echo "build=$build" >> debian/setenv.sh
159 # get repository name
163 # echo "pwd=$pwd" >> debian/rules.pre
165 echo "building $paket with build $version-$build"
167 pushd debian >/dev/null
168 # ./debian -------------------------------------
170 ln -sf /usr/share/mbuild/rules .
177 # check for pre/post installation scripts
178 if [ -f $paket.preinst ]
180 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
182 if [ -f $paket.postinst ]
184 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
186 if [ -f $paket.prerm ]
188 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
190 if [ -f $paket.postrm ]
192 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
195 #cat setenv.sh >> rules.pre
199 # load util functions for C/C++ - build
200 if [ -f $paket.cpp.sh ]
203 . projects/tools/make/c_configure.sh
207 # add export to setenv.sh
208 sed -i "s/^/export /" setenv.sh
211 # ./. ---------------------------------------------
213 # copy package control
214 if [ -f debian/$paket.control ]
219 # try old fashoned way
220 control=$(find etc -name $paket.control) || true
223 echo "warning: control file not found"
224 echo " this file is necessary for any package production."
229 Maintainer: WagnerTech UG <mail@wagnertech.de>
230 " > debian/$paket.control
231 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
236 if [ -e debian/$paket.build ]
243 if grep -- "-prepare" debian/$paket.build >/dev/null
246 debian/$paket.build -prepare
251 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
253 echo "PACK=binary" >> debian/rules.pre
254 if grep "^Architecture: *all" debian/$paket.control >/dev/null
256 echo "arch = all" >> debian/rules.pre
257 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
259 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
260 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
262 elif [ -f debian/$paket.cp ]
264 echo "PACK=zip" >> debian/rules.pre
266 echo "PACK=version" >> debian/rules.pre
270 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
272 echo "no debian/build.sh: skipping build step"
275 if [ $compile -eq 1 ]