From: Michael Wagner Date: Tue, 27 Mar 2018 13:00:03 +0000 (+0200) Subject: posaune X-Git-Tag: sysd2sysv_0.1-1~2^2~7 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1dd818ead588216487bfcd91c2a7767b1bdabbe8;p=projects.git posaune --- diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..baf5d7d --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: projects +Section: main +Priority: optional +Maintainer: Michael Wagner +Build-Depends: git + +Package: mbuild +Architecture: all +Depends: dpkg-dev +Description: WagnerTech build environment + Simple build environment for Debian packages + . + This package contains scripts and makefiles for + script and C/C++ packages. diff --git a/debian/mbuild.cp b/debian/mbuild.cp deleted file mode 120000 index ee9aa00..0000000 --- a/debian/mbuild.cp +++ /dev/null @@ -1 +0,0 @@ -../etc/mbuild.cp \ No newline at end of file diff --git a/debian/mbuild.cp b/debian/mbuild.cp new file mode 100755 index 0000000..ca1ddaf --- /dev/null +++ b/debian/mbuild.cp @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +base=$1 + +mkdir -p $base/usr/bin/ +cp tools/make/mconfigure $base/usr/bin/ + +mkdir -p $base/usr/share/mbuild/ +cp tools/make/rules $base/usr/share/mbuild/ + diff --git a/tools/make/mconfigure b/tools/make/mconfigure index d49601e..d329219 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -12,10 +12,16 @@ function set_build { build=$(svnversion) elif [ -e .git ] then - build=$(git describe --tags 2>/dev/null) - test -n "$build" || build="TOP" + build=$(git describe --tags 2>/dev/null) || true + if test -z "$build" + then + build="0.0-TOP" + fi changes=$(git status -s |grep "^ *M") || true - test -z "$changes" || build="${build}M" + if test -z "$changes" + then + build="${build}M" + fi fi } @@ -29,15 +35,24 @@ then exit 1 fi -#TODO: check, if running in debian-dir +if [ ! -d debian ] +then + echo "run mconfigure in the project base directory!" + exit 2 +fi -paket=$1 +export paket=$1 shift ARCH="" cpp_build=0 -delete_src=1 set_build +export build + +# get repository name +tmp=$(pwd) +export pwd=${tmp##*/} + echo "building $paket with build $build" #while getopts ":a" opt; do @@ -61,17 +76,19 @@ echo "building $paket with build $build" # rm -rf build #fi # -#mkdir -p build -#pushd build >/dev/null -# -#ln -sf /usr/share/mbuild/makefile . -if [ -e $paket ] -then - rm -rf $paket -fi -rm *.stamp || true -rm make.pre || true +pushd debian >/dev/null + +ln -sf /usr/share/mbuild/rules . + +#if [ -e tmp ] +#then +# rm -rf tmp +#fi +#rm *.stamp 2>/dev/null || true +#rm make.pre 2>/dev/null || true + +mkdir -p tmp/DEBIAN # load util functions for C/C++ - build if [ -f $paket.cpp.sh ] @@ -82,39 +99,48 @@ then fi # copy package control -control=$(find .. -name $paket.control) -build_number=${build#*_} -if [ -z "$control" ] -then - echo "warning: control file not found" - echo " this file is necessary for any package production." -else - sed "s/%BUILD%/$build_number/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control - echo "$paket.control written." - - # extract version - version=$(grep Version $paket.control |sed "s/Version: //") -fi +#control=$(find .. -name $paket.control) +#build_number=${build#*_} +#if [ -z "$control" ] +#then +# echo "warning: control file not found" +# echo " this file is necessary for any package production." +#else +# sed "s/%BUILD%/$build_number/" $control |sed "s/%ARCH%/$ARCH/" >$paket.control +# echo "$paket.control written." +# +# # extract version +# version=$(grep Version $paket.control |sed "s/Version: //") +#fi -# check for copy file -copy=$(find .. -name $paket.cp) -if [ -n "$copy" ] -then - ln -sf $copy . -else - echo "warning: file $paket.cp missing or not executable:" - echo " this file is necessary for any package production." -fi +popd >/dev/null + +# build package +debian/rules binary -# check for installation scripts -files=$(find .. -name $paket.preinst) -files="$files $(find .. -name $paket.postinst)" -files="$files $(find .. -name $paket.prerm)" -files="$files $(find .. -name $paket.postrm)" -for file in $files -do - ln -sf $file . -done +## check for copy file +#if [ ! -f $paket.cp ] +#then +# # search for copy file +# copy=$(find .. -name $paket.cp) +# if [ -n "$copy" ] +# then +# ln -sf $copy . +# else +# echo "warning: file $paket.cp missing or not executable:" +# echo " this file is necessary for any package production." +# fi +#fi +# +## check for installation scripts +#files=$(find .. -name $paket.preinst) +#files="$files $(find .. -name $paket.postinst)" +#files="$files $(find .. -name $paket.prerm)" +#files="$files $(find .. -name $paket.postrm)" +#for file in $files +#do +# ln -sf $file . +#done # create generic make.pre, if not existing #if [ ! -f make.pre ] diff --git a/tools/make/rules b/tools/make/rules new file mode 100755 index 0000000..68ba315 --- /dev/null +++ b/tools/make/rules @@ -0,0 +1,60 @@ +#!/usr/bin/make -f + +# Generic rules for mBuild build process + +# defile default operations +NOP = @echo "No operation for target $@" +DEB = fakeroot dpkg-deb --build debian/tmp + +default: + echo "no default rule available" + +# Löschen aller kompilierten, erzeugten und nicht benötigten Dateien im Bauverzeichnis +clean: + -rm -rf debian/tmp + -rm debian/changelog + +# Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis +build: + +# Bauen der kompilierten architekturabhängigen Programme aus den Quellen im Bauverzeichnis +build-arch: + +# Bauen der architekturunabhängigen formatierten Dokumente aus den Quellen im Bauverzeichnis +build-indep: + +# Installieren der Dateien in einen Verzeichnisbaum unterhalb des Verzeichnisses debian für jedes Binärpaket. Falls sie festgelegt wurden, hängen binary*-Ziele effektiv von diesem Ziel ab (optional) +install: + +# Erstellen aller Binärpakete (effektiv ist dies die Kombination der binary-arch- und binary-indep-Ziele) +binary: debian/tmp/DEBIAN/control binary-arch binary-indep + +# Erstellen Architektur-abhängiger (Architecture: any) Binärpakete im übergeordneten Verzeichnis +binary-arch: + +# Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis +binary-indep: copy ../$(paket)_$(build)$(_arch).deb + +copy: debian/$(paket).cp + debian/$(paket).cp debian/tmp + +../$(paket)_$(build)$(_arch).deb: + $(DEB) + mv debian/tmp.deb ../$(paket)_$(build)$(_arch).deb + +debian/tmp/DEBIAN/control: debian/control debian/changelog + dpkg-gencontrol + +debian/changelog: + echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog + echo " * generated by mbuild" >> debian/changelog + echo " -- Michael Wagner Sun, 11 Feb 2018 20:03:04 +0100" >> debian/changelog +# mb_create_changelog + +# Load project specification +-include rules.post + +# if debian/control is missing, try old mbuild way +#debian/control: +# if [ -e debian/$(paket).control ]; then echo "trallala"; fi +