echo "usage: configure <package> <revision> [options]"
echo " -b <branch-rev>"
echo " -a <arch>"
+ echo " -g <alternative repository>"
+ echo " -n : do not delete src dir"
}
# to build a package you need ...
paket=$1
build=$2
+shift 2
ARCH=""
cpp_build=0
+alt_repos=""
+delete_src=1
-shift 2
-while getopts "b:a:" opt
-do
+while getopts ":a:b:g:n" opt; do
case $opt in
- a) ARCH=$OPTARG
- ;;
- b) echo "branching not implemented"
- ;;
- *) exit 1
- ;;
+ a) ARCH=$OPTARG
+ ;;
+ b) branch=$OPTARG
+ ;;
+ g) alt_repos="-g $OPTARG"
+ ;;
+ n) delete_src=0
+ ;;
+ \?) echo "Invalid option: -$OPTARG"
+ echo_usage
+ exit 1
+ ;;
+ :) echo "Option -$OPTARG requires an argument."
+ echo_usage
+ exit 1
+ ;;
esac
done
-# checkout build utilities
-if [ ! -d projects ]; then
- git clone https://github.com/wagner-tech/projects/
-fi
ln -sf projects/tools/make/makefile .
# check standard files
fi
# clean dirs and check out
-if [ -d src ]
+if [ -d src -a $delete_src -eq 1 ]
then
- echo "Shall I delete src dir? [y]/n"
- read key
- if [ "$key" != "n" ]
- then
- rm -rf src
- fi
+ rm -rf src
fi
if [ -e $paket ]
# checkout
pushd src >/dev/null
- ../$paket.co $build
+ ../$paket.co $alt_repos $build
popd >/dev/null
# load util functions for C/C++ - build
# append version to make.pre
echo "version = $version" >> make.pre
+echo "build = $build" >> make.pre
--- /dev/null
+#!/bin/bash
+set -e
+
+usage="insert_build.sh <file> <build>"
+
+# inserts _<build> before last dot of filename
+# example: "insert_build.sh 45 foo.pdf" leads to "foo_45.pdf"
+
+if [ $# -ne 2 ]; then
+ echo $usage
+ exit 1
+fi
+
+stem=${1%.*}
+ext=${1##*.}
+
+cp $1 ${stem}_$2.$ext
+
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
deb: $(project).deb
# Debian package ready
+version: $(COMPILE_TARGET)
+ $(INSERT_BUILD) $(COMPILE_TARGET) $(build)
+
#-----------------------------------------------------------------
# compile steps
#-----------------------------------------------------------------
# Build-Regeln
#-----------------------------------------------------------------
%.pdf : %.tex $(SOURCES)
- pdflatex $<
+ pdflatex $< && pdflatex $<