From 6d98500b790e3808cf2fbda4a393717b40b0bbd1 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Mon, 1 Oct 2018 09:11:01 +0200 Subject: [PATCH] posaune --- debian/mbuild.cp | 1 + doc/mbuild.8 | 11 +++++- tools/make/cpp.make | 23 ------------ tools/make/makefile | 87 +++++++++---------------------------------- tools/make/mconfigure | 46 ++++++++++++++--------- tools/make/rules | 10 ++++- 6 files changed, 65 insertions(+), 113 deletions(-) delete mode 100644 tools/make/cpp.make diff --git a/debian/mbuild.cp b/debian/mbuild.cp index d158af6..824975c 100755 --- a/debian/mbuild.cp +++ b/debian/mbuild.cp @@ -9,6 +9,7 @@ cp tools/make/treecopy $base/usr/bin/ mkdir -p $base/usr/share/mbuild/ cp tools/make/rules $base/usr/share/mbuild/ +cp tools/make/insert_build.sh $base/usr/share/mbuild/ mkdir -p $base/usr/share/man/man8 gzip -c doc/mbuild.8 >$base/usr/share/man/man8/mbuild.8.gz diff --git a/doc/mbuild.8 b/doc/mbuild.8 index 6b0e67f..3209b7b 100644 --- a/doc/mbuild.8 +++ b/doc/mbuild.8 @@ -17,6 +17,10 @@ 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. + +If a +.B PAKET.build +file is present in the debian directory, it is called with a -prepare parameter. .TP compile To perform the compile step a @@ -28,7 +32,9 @@ directory. pack To perform the pack step a .B PAKET.cp -script is needed in the debian directory. If pre/post installation scripts +script and a +.B PAKET.control +file are needed in the debian directory. If pre/post installation scripts are needed, these files must be also placed in the .B debian directory. @@ -51,6 +57,9 @@ cp ../build/my_artefact $1/usr/bin/ .TP PAKET.preinst PAKET.postint PAKET.prerm PAKET.postrm Optional pre/post installation scripts +.TP +PAKET.control +Debian control file .PP These files are expected in a .B debian diff --git a/tools/make/cpp.make b/tools/make/cpp.make deleted file mode 100644 index 183afe4..0000000 --- a/tools/make/cpp.make +++ /dev/null @@ -1,23 +0,0 @@ -# Generic cpp makefile for mBuild build process - -# default parameters -CC = g++ - -include make.pre - -# All Target -all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET) - -# Other Targets -clean: - -rm *.o - -rm $(TARGET) - -.PHONY: all make.post - -%.a: $(SOURCE:%.cpp=%.o) - ar r $(TARGET) *.o - -%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS) - $(CXX) -shared -o $(TARGET) *.o $(LDLIBS) $(EXTLIB) --include make.post diff --git a/tools/make/makefile b/tools/make/makefile index 57dc39d..9ade437 100644 --- a/tools/make/makefile +++ b/tools/make/makefile @@ -1,85 +1,34 @@ # Generic makefile for mBuild build process -# defile default operations - -NOP = @echo "No operation for target $@" -COMPILE = $(NOP) -COMPILE_TARGET = compile.stamp -COPY = $(NOP) -ZIP = zip -r $(project).zip $(project) -DEB = fakeroot dpkg-deb --build $(project) -INSERT_BUILD = projects/tools/make/insert_build.sh -#default parameters -project = default -SOURCES = -COPY_PRE = +# default parameters +CC = g++ +INSERT_BUILD = /usr/share/mbuild/insert_build.sh -# Load project specification include make.pre -.SUFFIXES: .stamp .zip - - -#----------------------------------------------------------------- -# Hauptziele: -# -# : ohne Parameter wird compiliert -# - zip : packt ZIP file -# - deb : packt Debian package -# -#----------------------------------------------------------------- - -compile: $(COMPILE_TARGET) - # compile ist fertig - -zip: $(project).zip - # ZIP file ready - -deb: $(project).deb - # Debian package ready - -version: $(COMPILE_TARGET) - $(INSERT_BUILD) $(COMPILE_TARGET) $(build) +# All Target +all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET) -#----------------------------------------------------------------- -# compile steps -#----------------------------------------------------------------- -compile.stamp: $(SOURCES) - $(COMPILE) - @touch compile.stamp +# Other Targets +clean: + -rm *.o + -rm $(TARGET) -#----------------------------------------------------------------- -# pack steps -#----------------------------------------------------------------- -copy.stamp: $(COPY_PRE) - $(COPY) $(project) $(version) ${arch} - @touch copy.stamp +.PHONY: all make.post -control.stamp: $(project).control - mkdir -p $(project)/DEBIAN - cp $(project).control $(project)/DEBIAN/control - if [ -f $(project).preinst ]; then cp $(project).preinst $(project)/DEBIAN/preinst; fi - if [ -f $(project).postinst ]; then cp $(project).postinst $(project)/DEBIAN/postinst; fi - if [ -f $(project).prerm ]; then cp $(project).prerm $(project)/DEBIAN/prerm; fi - if [ -f $(project).postrm ]; then cp $(project).postrm $(project)/DEBIAN/postrm; fi - @touch control.stamp +%.a: $(SOURCE:%.cpp=%.o) + ar r $(TARGET) *.o -$(project).zip: copy.stamp $(project) - $(ZIP) +%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS) + $(CXX) -shared -o $(TARGET) *.o $(LDLIBS) $(EXTLIB) -$(project).deb: copy.stamp control.stamp - $(DEB) - cp $(project).deb $(project)_$(version)$(_arch).deb +make.pre: ~/build/debian/rules.pre + cp ~/build/debian/rules.pre make.pre -#----------------------------------------------------------------- -# utilities -#----------------------------------------------------------------- -clean: - -rm *.stamp 2>/dev/null - if [ -e $(project).zip ]; then rm $(project).zip; fi - if [ -e $(project) ]; then rm -rf $(project); fi +-include make.post +# defile default operations #----------------------------------------------------------------- # Build-Regeln diff --git a/tools/make/mconfigure b/tools/make/mconfigure index 7b6db95..c164f10 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -164,8 +164,11 @@ then # ./. --------------------------------------------- # copy package control - if [ ! -f debian/control ] + if [ -f debian/$paket.control ] then + cp debian/$paket.control debian/control + else + # try old fashoned way control=$(find etc -name $paket.control) || true if [ -z "$control" ] then @@ -180,24 +183,31 @@ then grep -v "Version:" $control |grep -v "Maintainer:" >> debian/control fi fi + + # build prepare + if [ -e debian/$paket.build ] + then + if [ -e ../build ] + then + rm -rf ../build + mkdir ../build + fi + debian/$paket.build -prepare + fi + + # pack prepare + if [ -f debian/$paket.cp -a -f $paket.control ] + then + echo "PACK=binary" >> debian/rules.pre + elif [ -f debian/$paket.cp ] + then + echo "PACK=zip" >> debian/rules.pre + else + echo "PACK=version" >> debian/rules.pre + fi fi -# check for copy file -#if [ ! -f debian/$paket.cp ] -#then -# # search for copy file -# copy=$(find . -name $paket.cp) -# if [ -n "$copy" ] -# then -# echo "ln -sf ../$copy debian/" -# ln -sf ../$copy debian/ -# else -# echo "warning: file $paket.cp missing or not executable:" -# echo " this file is necessary for any package production." -# fi -#fi - -if [ ! -e debian/build.sh ] +if [ $compile -eq 1 -a ! -e debian/build.sh ] then echo "no debian/build.sh: skipping build step" compile=0 @@ -211,6 +221,6 @@ fi if [ $pack -eq 1 ] then # build package - debian/rules binary + debian/rules pack fi diff --git a/tools/make/rules b/tools/make/rules index c16b52a..13b9e20 100755 --- a/tools/make/rules +++ b/tools/make/rules @@ -16,10 +16,13 @@ clean: -rm -rf debian/tmp # Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis -build: debian/build.sh sync - debian/build.sh +build: debian/$(paket).build sync + debian/$(paket).build # Build succeeded +pack: $(PACK) + # packing succeeded + # Bauen der kompilierten architekturabhängigen Programme aus den Quellen im Bauverzeichnis build-arch: @@ -38,6 +41,9 @@ binary-arch: # Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis binary-indep: copy ../$(paket)_$(version)-$(build)$(_arch).deb +version: $(TARGET) + $(INSERT_BUILD) $(TARGET) $(build) + ../build: mkdir ../build -- 2.20.1