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 --match "${paket}_*" 2>/dev/null) || true
44 changes=$(check_unversioned)
47 version=${version##*_}
50 echo "No configuration system found. Cannot determine version."
55 function check_version {
57 vline=$(head -1 debian/$paket.changelog)
60 if [ $version = "0.0" ]
66 # do no check on a modified git repos
67 if [ "${build: -1}" == "M" ]
72 if [ "$clversion" != $version ]
74 echo "version mismatch: git: $version, changelog: $clversion"
78 # to build a package you need ...
79 # <package>.cp (optional): copy step for package production
80 # <package>.cpp.sh (optional): commands to setup the C++ compile environment
90 echo "run mconfigure in the project base directory with a debian directory in it!"
100 while getopts "a:cdpo" opt; do
112 \?) echo "Invalid option: -$OPTARG"
116 :) echo "Option -$OPTARG requires an argument."
123 # if nothing is selected, select all
124 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
131 if [ $configure -eq 1 ]
133 # delete changelog and control
134 rm debian/changelog debian/control 2>/dev/null || true
136 # mconfigure builds 2 environment files: setenv.sh + rules.pre
142 dpkg-architecture $arch_opt > debian/setenv.sh
143 echo "" > debian/rules.pre
145 echo "paket=$paket" >> debian/setenv.sh
146 echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
151 echo "version=$version" >> debian/setenv.sh
152 echo "build=$build" >> debian/setenv.sh
154 # get repository name
158 # echo "pwd=$pwd" >> debian/rules.pre
160 echo "building $paket with build $version-$build"
162 pushd debian >/dev/null
163 # ./debian -------------------------------------
165 ln -sf /usr/share/mbuild/rules .
172 # check for pre/post installation scripts
173 if [ -f $paket.preinst ]
175 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
177 if [ -f $paket.postinst ]
179 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
181 if [ -f $paket.prerm ]
183 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
185 if [ -f $paket.postrm ]
187 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
190 #cat setenv.sh >> rules.pre
194 # load util functions for C/C++ - build
195 if [ -f $paket.cpp.sh ]
198 . projects/tools/make/c_configure.sh
202 # add export to setenv.sh
203 sed -i "s/^/export /" setenv.sh
206 # ./. ---------------------------------------------
208 # copy package control
209 if [ -f debian/$paket.control ]
214 # try old fashoned way
215 control=$(find etc -name $paket.control) || true
218 echo "warning: control file not found"
219 echo " this file is necessary for any package production."
224 Maintainer: WagnerTech UG <mail@wagnertech.de>
225 " > debian/$paket.control
226 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
231 if [ -e debian/$paket.build ]
238 if grep -- "-prepare" debian/$paket.build >/dev/null
241 debian/$paket.build -prepare
246 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
248 echo "PACK=binary" >> debian/rules.pre
249 if grep "^Architecture: *all" debian/$paket.control >/dev/null
251 echo "arch = all" >> debian/rules.pre
252 echo "BINARY_INDEP = copy ../${paket}_$version-${build}_all.deb" >> debian/rules.pre
254 echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
255 echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
257 elif [ -f debian/$paket.cp ]
259 echo "PACK=zip" >> debian/rules.pre
261 echo "PACK=version" >> debian/rules.pre
265 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
267 echo "no debian/build.sh: skipping build step"
270 if [ $compile -eq 1 ]