5 echo "usage: mconfigure <package> [options]"
9 echo " -p : pack default: do all"
20 tag=$(git describe --tags 2>/dev/null) || true
26 if [ "$tag_paket" != "$paket" ]
30 changes=$(git status -s |grep "^ *M") || true
36 version=${version##*_}
39 echo "No configuration system found. Cannot determine version."
44 function check_version {
46 vline=$(head -1 debian/$paket.changelog)
49 if [ $version = "0.0" ]
55 # do no check on a modified git repos
56 if [ "${build: -1}" == "M" ]
61 if [ "$clversion" != $version ]
63 echo "version mismatch: git: $version, changelog: $clversion"
67 # to build a package you need ...
68 # <package>.cp (optional): copy step for package production
69 # <package>.cpp.sh (optional): commands to setup the C++ compile environment
79 echo "run mconfigure in the project base directory with a debian directory in it!"
89 while getopts ":acdp" opt; do
99 \?) echo "Invalid option: -$OPTARG"
103 :) echo "Option -$OPTARG requires an argument."
110 # if nothing is selected, select all
111 if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ]
118 if [ $configure -eq 1 ]
120 # delete changelog and control
121 rm debian/changelog debian/control || true
123 # mconfigure builds 2 environment files: setenv.sh + rules.pre
124 # setenv.sh is finally appended to rules.pre
126 dpkg-architecture > debian/setenv.sh
127 echo "" > debian/rules.pre
129 echo "paket=$paket" >> debian/setenv.sh
136 echo "version=$version" >> debian/setenv.sh
137 echo "build=$build" >> debian/setenv.sh
139 # get repository name
143 # echo "pwd=$pwd" >> debian/rules.pre
145 echo "building $paket with build $version-$build"
147 pushd debian >/dev/null
148 # ./debian -------------------------------------
150 ln -sf /usr/share/mbuild/rules .
157 # check for pre/post installation scripts
158 if [ -f $paket.preinst ]
160 echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre
162 if [ -f $paket.postinst ]
164 echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre
166 if [ -f $paket.prerm ]
168 echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre
170 if [ -f $paket.postrm ]
172 echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre
175 cat setenv.sh >> rules.pre
179 # load util functions for C/C++ - build
180 if [ -f $paket.cpp.sh ]
183 . projects/tools/make/c_configure.sh
188 # ./. ---------------------------------------------
190 # copy package control
191 if [ -f debian/$paket.control ]
196 # try old fashoned way
197 control=$(find etc -name $paket.control) || true
200 echo "warning: control file not found"
201 echo " this file is necessary for any package production."
206 Maintainer: WagnerTech UG <mail@wagnertech.de>
207 " > debian/$paket.control
208 grep -v "Version:" $control |grep -v "Maintainer:" >> debian/$paket.control
213 if [ -e debian/$paket.build ]
220 if grep -- "-prepare" debian/$paket.build >/dev/null
223 debian/$paket.build -prepare
228 if [ -f debian/$paket.cp -a -f debian/$paket.control ]
230 echo "PACK=binary" >> debian/rules.pre
231 elif [ -f debian/$paket.cp ]
233 echo "PACK=zip" >> debian/rules.pre
235 echo "PACK=version" >> debian/rules.pre
239 if [ $compile -eq 1 -a ! -e debian/$paket.build ]
241 echo "no debian/build.sh: skipping build step"
244 if [ $compile -eq 1 ]