projects (0.2-%BUILD%) unstable; urgency=medium
-
* Build in svn-Umgebung
-
- -- Michael Wagner <michael@wagnertech.de> Mon, 18 Apr 2018 09:45:25 +0100
+ * including build script
+ * new options
+ * including pre/post installation scripts
+ -- Michael Wagner <michael@wagnertech.de> Fr 10. Aug 22:54:48 CEST 2018
projects (0.1-%BUILD%) unstable; urgency=medium
-
* Build in neuer git-Umgebung
-
-- Michael Wagner <michael@wagnertech.de> Mon, 12 Feb 2018 09:45:25 +0100
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
+
.\" 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
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 <michael@wagnertech.de> 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
--- /dev/null
+.\" 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)
+
function echo_usage {
echo "usage: mconfigure <package> [options]"
echo " -a <arch>"
- 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 {
version=${tag%%-*}
version=${version##*_}
build=${tag#*-}
+ else
+ echo "No configuration system found. Cannot determine version."
+ exit 1
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
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 .
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
fi
popd >/dev/null
+ # ./. ---------------------------------------------
# copy package control
if [ ! -f debian/control ]
# 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
NOP = @echo "No operation for target $@"
DEB = fakeroot dpkg-deb --build debian/tmp
+include debian/rules.pre
+
default:
echo "no default rule available"
-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:
# 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
# echo " -- Michael Wagner <info@wagnertech.de> 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