From: Michael Wagner Date: Sun, 19 Aug 2018 15:35:33 +0000 (+0200) Subject: posaune X-Git-Tag: sysd2sysv_0.2-2~13 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=40ce709909bf3094e77db91b111035ac0bd0ce54;p=projects.git posaune --- diff --git a/debian/mbuild.changelog b/debian/mbuild.changelog index 5346c34..43d7988 100644 --- a/debian/mbuild.changelog +++ b/debian/mbuild.changelog @@ -1,12 +1,11 @@ projects (0.2-%BUILD%) unstable; urgency=medium - * Build in svn-Umgebung - - -- Michael Wagner Mon, 18 Apr 2018 09:45:25 +0100 + * including build script + * new options + * including pre/post installation scripts + -- Michael Wagner Fr 10. Aug 22:54:48 CEST 2018 projects (0.1-%BUILD%) unstable; urgency=medium - * Build in neuer git-Umgebung - -- Michael Wagner Mon, 12 Feb 2018 09:45:25 +0100 diff --git a/debian/mbuild.cp b/debian/mbuild.cp index 0a78def..d158af6 100755 --- a/debian/mbuild.cp +++ b/debian/mbuild.cp @@ -10,3 +10,7 @@ cp tools/make/treecopy $base/usr/bin/ mkdir -p $base/usr/share/mbuild/ cp tools/make/rules $base/usr/share/mbuild/ +mkdir -p $base/usr/share/man/man8 +gzip -c doc/mbuild.8 >$base/usr/share/man/man8/mbuild.8.gz +gzip -c doc/mconfigure.1 >$base/usr/share/man/man8/mconfigure.1.gz + diff --git a/doc/mbuild.8 b/doc/mbuild.8 index 0f7b4f1..6b0e67f 100644 --- a/doc/mbuild.8 +++ b/doc/mbuild.8 @@ -1,6 +1,6 @@ .\" Manpage for mbuild. .\" Contact mail@wagnertech.de to correct errors or typos. -.TH man 8 "12 Jul 2018" "0.1" "mbuild man page" +.TH mbuild 8 "Jul 2018" GNU "WagnerTech Utilities" .SH NAME mbuild \- build system of WagnerTech UG .SH SYNOPSIS @@ -13,25 +13,50 @@ consists of 3 phases: configuration - compile - pack configuration is done by the .B mconfigure -script. It determins the verion number from the git/subversion status. Per +script. It determins the verion number from the git/subversion status. A +.B PAKET.changelog +file is needed. Per default this script also performs compile and pack step. .TP compile To perform the compile step a .B PAKET.build -script is needed in the debian directory. +script is needed in the +.B debian +directory. .TP pack To perform the pack step a .B PAKET.cp -script is needed in the debian directory. - +script is needed in the debian directory. If pre/post installation scripts +are needed, these files must be also placed in the +.B debian +directory. .SH FILES +.TP +PAKET.changelog +Example: +.br +projects (0.2-%BUILD%) unstable; urgency=medium + * Build in svn-Umgebung + -- Michael Wagner Fr 10. Aug 22:54:48 CEST 2018 +.TP PAKET.build - +Any executable script file executing the build in the ../build directory +.TP PAKET.cp +An executable script file copying the artefacts to target paths preposed by $1: +.br +cp ../build/my_artefact $1/usr/bin/ +.TP +PAKET.preinst PAKET.postint PAKET.prerm PAKET.postrm +Optional pre/post installation scripts +.PP +These files are expected in a +.B debian +directory, placed below the projects main directory. .SH SEE ALSO -make(1), mconfigure(8) +make(1), mconfigure(1) .SH BUGS No known bugs. .SH AUTHOR diff --git a/doc/mconfigure.1 b/doc/mconfigure.1 new file mode 100644 index 0000000..c5b2eb6 --- /dev/null +++ b/doc/mconfigure.1 @@ -0,0 +1,35 @@ +.\" Manpage for mconfigure. +.\" Contact mail@wagnertech.de to correct errors or typos. +.TH mconfigure 1 "Aug 2018" "GNU" "WagnerTech Utilities" +.SH NAME +mconfigure \- interface to build system of WagnerTech UG +.SH SYNOPSIS +.B mconfigure +.I paket +.B [-cdp] +.SH DESCRIPTION +mconfigure builds the package +.I paket. +mconfigure has to be called in the projects base directory containing a directoty named +.B debian, +that contains the files described in +.B mbuild(8). +.SH OPTIONS +.TP +-c +select configuration step +.TP +-d +select compile step +.TP +-p +select pack step +.PP +If no steps are selected all steps are performed. +.SH SEE ALSO +mbuild(8): Overview description +.SH BUGS +No known bugs. +.SH AUTHOR +Michael Wagner (michael@wagnertech.de) + diff --git a/tools/make/mconfigure b/tools/make/mconfigure index f745eff..438321e 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -4,9 +4,9 @@ set -e function echo_usage { echo "usage: mconfigure [options]" echo " -a " - echo " -c : configure only, no compile, pack" - echo " -d : compile only" - echo " -p : pack only" + echo " -c : configure" + echo " -d : compile" + echo " -p : pack default: do all" } function set_build { @@ -30,6 +30,9 @@ function set_build { version=${tag%%-*} version=${version##*_} build=${tag#*-} + else + echo "No configuration system found. Cannot determine version." + exit 1 fi } @@ -66,21 +69,19 @@ fi paket=$1 -configure=1 -compile=1 -pack=1 -while getopts ":ap" opt; do +configure=0 +compile=0 +pack=0 +shift +while getopts ":acdp" opt; do case $opt in a) ARCH=$OPTARG ;; - c) compile=0 - pack=0 + c) configure=1 ;; - d) configure=0 - pack=0 + d) compile=1 ;; - p) configure=0 - compile=0 + p) pack=1 ;; \?) echo "Invalid option: -$OPTARG" echo_usage @@ -93,27 +94,36 @@ while getopts ":ap" opt; do esac done +# if nothing is selected, select all +if [ $configure -eq 0 -a $compile -eq 0 -a $pack -eq 0 ] +then + configure=1 + compile=1 + pack=1 +fi + if [ $configure -eq 1 ] then - echo "export paket=$1" > debian/setenv.sh - shift + echo "paket=$paket" > debian/rules.pre +# shift ARCH="" cpp_build=0 set_build check_version - echo "export version=$version" >> debian/setenv.sh - echo "export build=$build" >> debian/setenv.sh + echo "version=$version" >> debian/rules.pre + echo "build=$build" >> debian/rules.pre # get repository name - tmp=$(pwd) - pwd=${tmp##*/} - pwd=${pwd,,*} - echo "export pwd=$pwd" >> debian/setenv.sh +# tmp=$(pwd) +# pwd=${tmp##*/} +# pwd=${pwd,,*} +# echo "pwd=$pwd" >> debian/rules.pre echo "building $paket with build $version-$build" pushd debian >/dev/null + # ./debian ------------------------------------- ln -sf /usr/share/mbuild/rules . @@ -121,8 +131,24 @@ then then rm -rf tmp fi - #rm *.stamp 2>/dev/null || true - #rm make.pre 2>/dev/null || true + + # check for pre/post installation scripts + if [ -f $paket.preinst ] + then + echo "add_inst_tgt += debian/tmp/DEBIAN/preinst" >> rules.pre + fi + if [ -f $paket.postinst ] + then + echo "add_inst_tgt += debian/tmp/DEBIAN/postinst" >> rules.pre + fi + if [ -f $paket.prerm ] + then + echo "add_inst_tgt += debian/tmp/DEBIAN/prerm" >> rules.pre + fi + if [ -f $paket.postrm ] + then + echo "add_inst_tgt += debian/tmp/DEBIAN/postrm" >> rules.pre + fi mkdir -p tmp/DEBIAN @@ -135,6 +161,7 @@ then fi popd >/dev/null + # ./. --------------------------------------------- # copy package control if [ ! -f debian/control ] @@ -170,17 +197,20 @@ fi # fi #fi +if [ ! -e debian/build.sh ] +then + echo "no debian/build.sh: skipping build step" + compile=0 +fi if [ $compile -eq 1 ] then # build artefacts - . debian/setenv.sh debian/rules build fi if [ $pack -eq 1 ] then # build package - . debian/setenv.sh debian/rules binary fi diff --git a/tools/make/rules b/tools/make/rules index da98ee5..c16b52a 100755 --- a/tools/make/rules +++ b/tools/make/rules @@ -6,6 +6,8 @@ NOP = @echo "No operation for target $@" DEB = fakeroot dpkg-deb --build debian/tmp +include debian/rules.pre + default: echo "no default rule available" @@ -14,7 +16,9 @@ clean: -rm -rf debian/tmp # Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis -build: +build: debian/build.sh sync + debian/build.sh + # Build succeeded # Bauen der kompilierten architekturabhängigen Programme aus den Quellen im Bauverzeichnis build-arch: @@ -34,10 +38,16 @@ binary-arch: # Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis binary-indep: copy ../$(paket)_$(version)-$(build)$(_arch).deb +../build: + mkdir ../build + +sync: + bash -c 'for dirs in $$(ls); do rsync -av $$dirs ../build; done' + copy: debian/$(paket).cp debian/$(paket).cp debian/tmp -../$(paket)_$(version)-$(build)$(_arch).deb:debian/tmp/DEBIAN/control +../$(paket)_$(version)-$(build)$(_arch).deb:debian/tmp/DEBIAN/control $(add_inst_tgt) $(DEB) mv debian/tmp.deb ../$(paket)_$(version)-$(build)$(_arch).deb @@ -51,6 +61,18 @@ debian/changelog: debian/$(paket).changelog debian/setenv.sh # echo " -- Michael Wagner Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog # mb_create_changelog +debian/tmp/DEBIAN/preinst: debian/$(paket).preinst + cp debian/$(paket).preinst debian/tmp/DEBIAN/preinst + +debian/tmp/DEBIAN/postinst: debian/$(paket).postinst + cp debian/$(paket).postinst debian/tmp/DEBIAN/postinst + +debian/tmp/DEBIAN/prerm: debian/$(paket).prerm + cp debian/$(paket).prerm debian/tmp/DEBIAN/prerm + +debian/tmp/DEBIAN/postrm: debian/$(paket).postrm + cp debian/$(paket).postrm debian/tmp/DEBIAN/postrm + # Load project specification -include rules.post