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
}
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
# 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 ]
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 ]
--- /dev/null
+#!/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 <info@wagnertech.de> 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
+