From ff2607419be96666a6e4eff72a86a5341335d216 Mon Sep 17 00:00:00 2001 From: Michael Wagner Date: Fri, 19 Oct 2018 15:32:52 +0200 Subject: [PATCH] posaune --- debian/mbuild.changelog | 1 + debian/mbuild.control | 14 +++++++ debian/mbuild.cp | 1 + tools/make/mMakefile | 39 ++++++++++++++++++ tools/make/makefile | 88 ++++++++++++++++++++++++++++++++--------- tools/make/mconfigure | 10 +++-- tools/make/rules | 8 ++-- 7 files changed, 137 insertions(+), 24 deletions(-) create mode 100644 debian/mbuild.control create mode 100644 tools/make/mMakefile diff --git a/debian/mbuild.changelog b/debian/mbuild.changelog index 43d7988..6c503a9 100644 --- a/debian/mbuild.changelog +++ b/debian/mbuild.changelog @@ -3,6 +3,7 @@ projects (0.2-%BUILD%) unstable; urgency=medium * including build script * new options * including pre/post installation scripts + * packing for tgz and versioning -- Michael Wagner Fr 10. Aug 22:54:48 CEST 2018 projects (0.1-%BUILD%) unstable; urgency=medium diff --git a/debian/mbuild.control b/debian/mbuild.control new file mode 100644 index 0000000..4034bfd --- /dev/null +++ b/debian/mbuild.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 index 824975c..e38be77 100755 --- a/debian/mbuild.cp +++ b/debian/mbuild.cp @@ -10,6 +10,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/ +cp tools/make/mMakefile $base/usr/share/mbuild/makefile mkdir -p $base/usr/share/man/man8 gzip -c doc/mbuild.8 >$base/usr/share/man/man8/mbuild.8.gz diff --git a/tools/make/mMakefile b/tools/make/mMakefile new file mode 100644 index 0000000..d6da7bb --- /dev/null +++ b/tools/make/mMakefile @@ -0,0 +1,39 @@ +# Generic makefile for mBuild build process + + +# default parameters +CC = g++ +INSERT_BUILD = /usr/share/mbuild/insert_build.sh + +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) + +make.pre: ~/build/debian/rules.pre + cp ~/build/debian/rules.pre make.pre + +-include make.post +# defile default operations + +#----------------------------------------------------------------- +# Build-Regeln +#----------------------------------------------------------------- +%.pdf : %.tex $(SOURCES) + pdflatex $< && pdflatex $< + cp $*.pdf ~/build + diff --git a/tools/make/makefile b/tools/make/makefile index 9ade437..1bee6f4 100644 --- a/tools/make/makefile +++ b/tools/make/makefile @@ -1,34 +1,85 @@ # 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 -CC = g++ -INSERT_BUILD = /usr/share/mbuild/insert_build.sh +#default parameters +project = default +SOURCES = +COPY_PRE = +# Load project specification include make.pre -# All Target -all: $(DEPS) $(SOURCE:%.cpp=%.o) $(TARGET) +.SUFFIXES: .stamp .zip -# Other Targets -clean: - -rm *.o - -rm $(TARGET) +#----------------------------------------------------------------- +# Hauptziele: +# +# : ohne Parameter wird compiliert +# - zip : packt ZIP file +# - deb : packt Debian package +# +#----------------------------------------------------------------- + +compile: $(COMPILE_TARGET) + # compile ist fertig -.PHONY: all make.post +zip: $(project).zip + # ZIP file ready -%.a: $(SOURCE:%.cpp=%.o) - ar r $(TARGET) *.o +deb: $(project).deb + # Debian package ready -%.so: $(SOURCE:%.cpp=%.o) $(LDLIBS) - $(CXX) -shared -o $(TARGET) *.o $(LDLIBS) $(EXTLIB) +version: $(COMPILE_TARGET) + $(INSERT_BUILD) $(COMPILE_TARGET) $(build) -make.pre: ~/build/debian/rules.pre - cp ~/build/debian/rules.pre make.pre +#----------------------------------------------------------------- +# compile steps +#----------------------------------------------------------------- +compile.stamp: $(SOURCES) + $(COMPILE) + @touch compile.stamp --include make.post -# defile default operations +#----------------------------------------------------------------- +# pack steps +#----------------------------------------------------------------- + +copy.stamp: $(COPY_PRE) + $(COPY) $(project) $(version) ${arch} + @touch copy.stamp + +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 + +$(project).zip: copy.stamp $(project) + $(ZIP) + +$(project).deb: copy.stamp control.stamp + $(DEB) + cp $(project).deb $(project)_$(version)$(_arch).deb + +#----------------------------------------------------------------- +# utilities +#----------------------------------------------------------------- +clean: + -rm *.stamp 2>/dev/null + if [ -e $(project).zip ]; then rm $(project).zip; fi + if [ -e $(project) ]; then rm -rf $(project); fi #----------------------------------------------------------------- # Build-Regeln @@ -36,3 +87,4 @@ make.pre: ~/build/debian/rules.pre %.pdf : %.tex $(SOURCES) pdflatex $< && pdflatex $< + diff --git a/tools/make/mconfigure b/tools/make/mconfigure index c164f10..b2bff6f 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -192,11 +192,15 @@ then rm -rf ../build mkdir ../build fi - debian/$paket.build -prepare + if grep -- "-prepare" debian/$paket.build >/dev/null + then + debian/rules sync + debian/$paket.build -prepare + fi fi # pack prepare - if [ -f debian/$paket.cp -a -f $paket.control ] + if [ -f debian/$paket.cp -a -f debian/$paket.control ] then echo "PACK=binary" >> debian/rules.pre elif [ -f debian/$paket.cp ] @@ -207,7 +211,7 @@ then fi fi -if [ $compile -eq 1 -a ! -e debian/build.sh ] +if [ $compile -eq 1 -a ! -e debian/$paket.build ] then echo "no debian/build.sh: skipping build step" compile=0 diff --git a/tools/make/rules b/tools/make/rules index 13b9e20..9ddc638 100755 --- a/tools/make/rules +++ b/tools/make/rules @@ -5,6 +5,7 @@ # defile default operations NOP = @echo "No operation for target $@" DEB = fakeroot dpkg-deb --build debian/tmp +INSERT_BUILD = /usr/share/mbuild/insert_build.sh include debian/rules.pre @@ -41,8 +42,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) +version: ~/build/$(TARGET) + $(INSERT_BUILD) ~/build/$(TARGET) $(build) + cp ~/build/*$(build)* ../ ../build: mkdir ../build @@ -60,7 +62,7 @@ copy: debian/$(paket).cp debian/tmp/DEBIAN/control: debian/control debian/changelog dpkg-gencontrol -debian/changelog: debian/$(paket).changelog debian/setenv.sh +debian/changelog: debian/$(paket).changelog debian/rules.pre sed "s/%BUILD%/$(build)/" debian/$(paket).changelog > debian/changelog # echo "${pwd} (${build}) unstable; urgency=medium" > debian/changelog # echo " * generated by mbuild" >> debian/changelog -- 2.20.1