--- /dev/null
+# mbuild configuration file
+
+# type of compile. Possible values: NONE, CPP, CMAKE, PDF
+compile_type=NONE
+# compile target
+compile_target=
+# compile directory
+compile_dir=
+
+# target type. Possible values: FILE, DEB, ZIP
+target_type=DEB
+
cp tools/make/mMakefile $base/usr/share/mbuild/makefile
cp tools/make/c_configure.sh $base/usr/share/mbuild/
cp tools/make/cpp.make $base/usr/share/mbuild/
+cp tools/make/configure $base/usr/share/mbuild/
cp doc/copyright $base/usr/share/mbuild/
mkdir -p $base/usr/share/man/man8
function echo_usage {
echo "usage: configure [options] <package>"
echo " -a <arch>"
- echo " -c : configure"
+ echo " -b : extern build in ../build directory"
+ echo " -c <compile_dir>"
echo " -C <cross environment>"
- echo " -d : compile"
echo " -i : install dir. default: /"
echo " -I : print this info"
- echo " -p : pack default: do all"
+ echo " -t <compile type: NONE, CPP, CMAKE, PDF> default: NONE"
echo " -v : set version"
echo " -V : version set by project"
}
build=${tag##*-}
else
echo "No configuration system found. Cannot determine version."
- exit 1
+ exit 3
fi
}
if [ "$clversion" != $version ]
then
echo "version mismatch: git: $version, changelog: $clversion"
- exit 1
+ exit 4
fi
}
##############################################################################
install_dir="/"
+compile_type=NONE
+extern_build=0
+
while [ $OPTIND -le "$#" ]
do
- if getopts "a:C:i:Iv:V" opt
+ if getopts "a:bB:C:i:It:v:V" opt
then
case $opt in
a) ARCH=$OPTARG
;;
+ b) extern_build=1
+ ;;
+ c) compile_dir=$OPTARG
+ ;;
C) cross=$OPTARG
;;
i) install_dir=$OPTARG
I) echo_usage
exit 0
;;
+ t) compile_type=$OPTARG
+ ;;
v) optversion=$OPTARG
;;
V) optversion="0.0"
;;
\?) echo "Invalid option: -$OPTARG"
echo_usage
- exit 1
+ exit 5
;;
:) echo "Option -$OPTARG requires an argument."
echo_usage
- exit 1
+ exit 6
;;
esac
else
if [ -z "$paket" ]
then
echo_usage
- exit 1
+ exit 7
+fi
+
+# read build configuration, if existing
+if [ -f debian/$paket.conf ]
+then
+ . debian/$paket.conf
fi
if [ -n "$ARCH" -a -n "$cross" ]
then
echo "invalid options: supply -a for multiarch or -C for explicit cross compile environment"
- exit 1
+ exit 8
fi
if [ ! -e Makefile ]
dpkg-architecture $arch_opt >> debian/setenv.sh
echo "paket=$paket" >> debian/setenv.sh
-echo "oldpack=\"$oldpack\"" >> debian/setenv.sh
set_build
if [ -z "$optversion" ]
version=$optversion
fi
echo "version=$version" >> debian/rules.pre
+echo "version=$version" >> debian/setenv.sh
echo "build=$build" >> debian/rules.pre
+echo "build=$build" >> debian/setenv.sh
# get repository name
# tmp=$(pwd)
popd >/dev/null
# ./. ---------------------------------------------
-# copy package control
-if [ -f debian/$paket.control ]
-then
- # proceed
- echo
-else
- echo "warning: control file not found"
- echo " this file is necessary for any package production."
-fi
-
# build prepare
if [ -x debian/$paket.prepare ]
then
debian/$paket.prepare
fi
-# compile prepare
-if [ -x debian/$paket.build -o -e debian/$paket.cmake ]
+if [ "$compile_type" == "NONE" ]
then
- # build requrired
- echo "BUILD=build" >> debian/rules.pre
- if [ -n "$BUILD_DIR" ]
- then
- BUILD_DIR=.
- fi
-else
echo "BUILD=nobuild" >> debian/rules.pre
-fi
-# .build
-if [ -x debian/$paket.build ]
-then
- if [ -x debian/$paket.prebuild ]
+else
+ echo "BUILD=build" >> debian/rules.pre
+
+ if [ $extern_build -eq 1 ]
then
- pushd $BUILD_DIR >/dev/null
- . debian/setenv.sh
- debian/$paket.prebuild
- popd >/dev/null
+ BUILD_DIR=~/build
+ echo "BUILD_DIR=~/build" >> debian/rules.pre
+ debian/rules sync
fi
-fi
-# .cmake
-if [ -e debian/$paket.cmake ]
-then
- cmake_check
-fi
-# pack prepare
-if [ -f debian/$paket.cp -a -f debian/$paket.control ]
-then
- echo "PACK=binary" >> debian/rules.pre
- if grep "^Architecture: *all" debian/$paket.control >/dev/null
+ # .build
+ if [ "$compile_type" != "CMAKE" ]
then
- echo "arch = all" >> debian/rules.pre
- echo 'BINARY_INDEP = copy ../$(paket)_$(version)-$(build)_all.deb' >> debian/rules.pre
- else
- echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
- echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
+ cp debian/rules.pre $BUILD_DIR/$compile_dir/make.pre
+ pushd $BUILD_DIR/$compile_dir >/dev/null
+ ln -sf /usr/share/mbuild/makefile .
+ if [ -n "$sources_suffix" ]
+ then
+ echo "SOURCES = \\" >> make.pre
+ for suf in $sources_suffix
+ do
+ find . -name "*.$suf" -exec echo " "{}" \\" >> make.pre \;
+ done
+ echo >> make.pre
+ fi
+ popd >/dev/null
fi
- if ! [ -f debian/$paket.changelog ]
+
+ if [ -x debian/$paket.build ]
then
- echo "changelog_source = debian/default.changelog" >> debian/rules.pre
- if [ -f debian/default.changelog ]
+ if [ -x debian/$paket.prebuild ]
then
- rm debian/default.changelog
+ pushd $BUILD_DIR >/dev/null
+ . debian/setenv.sh
+ debian/$paket.prebuild
+ popd >/dev/null
fi
fi
-elif [ -f debian/$paket.cp ]
-then
- echo "PACK=zip" >> debian/rules.pre
-else
- echo "PACK=version" >> debian/rules.pre
+
+ # .cmake
+ if [ -e debian/$paket.cmake ]
+ then
+ cmake_check
+ fi
fi
+
%.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
+#make.pre: ~/build/debian/rules.pre
+# cp ~/build/debian/rules.pre make.pre
-include make.post
# defile default operations
#-----------------------------------------------------------------
%.pdf : %.tex $(SOURCES)
pdflatex $< && pdflatex $<
- cp $*.pdf ~/build
+ #cp $*.pdf ~/build
function echo_usage {
echo "usage: mconfigure [options] <package>"
- echo " -c : copy configure/Makefile"
- echo " -d : compile"
- echo " -p : pack default: do all"
./configure -I
}
fi
configure=0
-compile=0
-pack=0
-confirure_args="-b ../build"
+configure_args="-i debian/tmp"
while [ $OPTIND -le "$#" ]
do
- if getopts "cdp" opt
+ if getopts "c" opt
then
case $opt in
- c) configure=1
- ;;
- d) compile=1
- ;;
- p) pack=1
- ;;
\?) $confirure_args="$configure_ars -$OPTARG"
if [ $OPTARG="a" -o $OPTARG="C" -o $OPTARG="i" -o $OPTARG="v" ]
then
;;
:) echo "Option -$OPTARG requires an argument."
echo_usage
- exit 1
+ exit 3
;;
esac
else
if [ -z "$paket" ]
then
echo_usage
- exit 1
+ exit 4
fi
-if [ $configure -eq 1 ]
+if [ ! -f debian/$paket.conf ]
then
- # installation of configure file
- cp /usr/share/mbuild/configure .
-else
- if [ ! -e configure ]
- then
- ln -s /usr/share/mbuild/configure .
- fi
+ echo "$paket.conf missing. We create it ..."
+ echo "to be implemented ..."
+ exit 5
fi
-configure_args="$configure_args $paket"
-if [ -x debian/$paket.preconfigure ]
+if [ ! -e configure ]
then
- # if necessary $configure_args can be added to setenv.sh
- debian/$paket.preconfigure
+ ln -s /usr/share/mbuild/configure .
fi
-#-> configure
-# .build or .cmake
-if [ -x debian/$paket.build -o -e debian/$paket.cmake ]
+# clean build directory
+if [ "$compile_type" != "NONE" ]
then
- echo "BUILD_DIR=../build" >> debian/setenv.sh
- if [ -e ../build ]
+ if [ -e ~/build ]
then
- rm -rf ../build
- mkdir ../build
+ rm -rf ~/build
+ mkdir ~/build
fi
+fi
+
+# perform configure
+. debian/$paket.conf
+if [ -n "$compile_dir" ]
+then
+ configure_args="$configure_args -b $compile_dir"
+fi
+if [ -z "$compile_type" ]
+then
+ echo "compile_type required in $paket.conf"
+ exit 51
+fi
+if [ "$target_type" == "FILE" ]
+then
+ # no version needed
+ configure_args="$configure_args -V"
+fi
+configure_args="$configure_args $paket"
+echo "Executing ./configure $configure_args ..."
+./configure $configure_args
+
+if [ "$compile_type" != "NONE" ]
+then
if grep -- "-prepare" debian/$paket.build >/dev/null
then
echo "prepare in <paket>.build no longer supported. Use <paket>.prebuild"
- exit 2
+ exit 6
fi
# sync build dir
. debian/setenv.sh
debian/rules sync
+ make
fi
-# perform configure
-. debian/setenv.sh
-./configure $configure_args
-
-# if nothing is selected, select all
-if [ $compile -eq 0 -a $pack -eq 0 ]
+# pack prepare
+if [ "$target_type" == "DEB" ]
then
- compile=1
- pack=1
-fi
-
-if [ $compile -eq 1 ]
+ if [ ! -f debian/$paket.cp ]
+ then
+ echo "debian/$paket.cp missing for target type DEB"
+ exit 9
+ fi
+ if [ ! -f debian/$paket.control ]
+ then
+ echo "debian/$paket.control missing for target type DEB"
+ exit 10
+ fi
+
+ echo "PACK=binary" >> debian/rules.pre
+ if grep "^Architecture: *all" debian/$paket.control >/dev/null
+ then
+ echo "arch = all" >> debian/rules.pre
+ echo 'BINARY_INDEP = copy ../$(paket)_$(version)-$(build)_all.deb' >> debian/rules.pre
+ else
+ echo 'arch = ${DEB_HOST_ARCH}' >> debian/rules.pre
+ echo "BINARY_ARCH = copy ../${paket}_$version-${build}_"'$(arch).deb' >> debian/rules.pre
+ fi
+ if ! [ -f debian/$paket.changelog ]
+ then
+ echo "changelog_source = debian/default.changelog" >> debian/rules.pre
+ if [ -f debian/default.changelog ]
+ then
+ rm debian/default.changelog
+ fi
+ fi
+elif [ "$target_type" == "ZIP" ]
then
- # build
- make
-fi
-
-if [ $pack -eq 1 ]
+ echo "PACK=zip" >> debian/rules.pre
+ if [ ! -f debian/$paket.cp ]
+ then
+ echo "debian/$paket.cp missing for target type ZIP"
+ exit 11
+ fi
+elif [ "$target_type" == "FILE" ]
then
- # build package
- debian/rules pack
+ echo "PACK=version" >> debian/rules.pre
+ if [ -z "$compile_target" ]
+ then
+ echo "compile_target is needed for target_type FILE"
+ exit 12
+ fi
+ echo "TARGET = $compile_target" >> debian/rules.pre
+
+else
+ echo "Unknown target type: $target_type"
+ exit 13
fi
+# build package
+debian/rules pack
+
# defile default operations
NOP = @echo "No operation for target $@"
-DEB = fakeroot dpkg-deb --build $(oldpack) debian/tmp
+DEB = fakeroot dpkg-deb --build debian/tmp
INSERT_BUILD = /usr/share/mbuild/insert_build.sh
RSYNC_OPT = -av --exclude="build" --exclude="debian/tmp" --exclude="Packages" --exclude="*Aktuell" --exclude=".*"
+BUILD_DIR = .
std_inst_tgt = debian/tmp/usr/share/doc/$(paket)/copyright debian/tmp/usr/share/doc/$(paket)/README.debian
changelog_source = debian/$(paket).changelog
-rm -rf debian/tmp
# Bauen der kompilierten Programme und formatierten Dokumente aus den Quellen im Bauverzeichnis
-build: ../build/debian/$(paket).build sync
- cd ../build ; debian/$(paket).build
+build: $(BUILD_DIR)/debian/$(paket).build sync
+ cd $(BUILD_DIR) ; debian/$(paket).build
# Build succeeded
nobuild:
install:
debian/$(paket).cp $(INSTALL_DIR)
+
pack: $(PACK)
# packing succeeded
# Erstellen Architektur-unabhängiger (Architecture: all) Binärpakete im übergeordneten Verzeichnis
binary-indep: $(BINARY_INDEP)
-version: ~/build/$(TARGET)
- $(INSERT_BUILD) ~/build/$(TARGET) $(build)
- cp ~/build/*$(build)* ../
+version: $(BUILD_DIR)/$(TARGET)
+ $(INSERT_BUILD) $(BUILD_DIR)/$(TARGET) $(build)
+ cp $(BUILD_DIR)/*$(build)* ../
-../build:
- mkdir ../build
+$(BUILD_DIR):
+ mkdir $(BUILD_DIR)
-sync: ../build
- rsync $(RSYNC_OPT) ./ ../build/
+sync: $(BUILD_DIR)
+ rsync $(RSYNC_OPT) ./ $(BUILD_DIR)/
-copy: debian/$(paket).cp
- debian/$(paket).cp debian/tmp
+copy: debian/$(paket).cp install
create-conffiles debian/tmp
touch debian/tmp