X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/blobdiff_plain/5e8e2b2380cd6697b8634a765cdfd0b9e07c502c..821fa83fccab0589fb06f6c111768dfcb78bf4f7:/tools/make/configure diff --git a/tools/make/configure b/tools/make/configure index da630c3..2eb9f91 100755 --- a/tools/make/configure +++ b/tools/make/configure @@ -3,17 +3,35 @@ set -e function echo_usage { echo "usage: configure [options] " - echo " -a " - echo " -c : configure" - echo " -C " - echo " -d : compile" - echo " -i : install dir. default: /" - echo " -I : print this info" - echo " -p : pack default: do all" - echo " -v : set version" - echo " -V : version set by project" + echo "--- general options ---" + echo " -h : print this info" + echo "--- compile options ---" + echo " -a " + echo " -c default: NONE" + echo " -C " + echo " -d " + echo " -e " + echo "--- build target options ---" + echo " -i : install dir. default: /, nec. for make install" + echo " -n : default: " + echo " -t , nec. for make pack" + echo " -v : set version" + echo " -V : version set by project" } +function create_build { + pushd $BUILD_DIR >/dev/null + if [ "$compile_type" == "PDF" ] + then + echo "cd $compile_dir" > debian/$paket.build + echo "make $compile_target" >> debian/$paket.build + chmod 755 debian/$paket.build + else + echo "build for compile_type not implemented." + exit 10 + fi + popd >/dev/null +} function cmake_check { pushd ../build >/dev/null # do checks @@ -56,6 +74,14 @@ function check_unversioned { echo "debian.*" >> .cm.ignore echo "up.*" >> .cm.ignore fi + + # add auto created files to .cm.ignore + if ! grep Makefile .cm.ignore >/dev/null ; then echo "Makefile" >>.cm.ignore; fi + if ! grep configure .cm.ignore >/dev/null ; then echo "configure" >>.cm.ignore; fi + if ! grep debian/rules .cm.ignore >/dev/null ; then echo "debian/rules" >>.cm.ignore; fi + if ! grep debian/rules.pre .cm.ignore >/dev/null ; then echo "debian/rules.pre" >>.cm.ignore; fi + if ! grep debian/setenv.sh .cm.ignore >/dev/null ; then echo "debian/setenv.sh" >>.cm.ignore; fi + if ! grep debian/tmp .cm.ignore >/dev/null ; then echo "debian/tmp" >>.cm.ignore; fi project=$(pwd) project=${project##*/} @@ -63,7 +89,7 @@ function check_unversioned { mCM $project -b -an > /dev/null wc=$(wc $project.batch) rm $project.batch - if [ "${wc:0:5}" != "0 0 0" ] + if [ "${wc:0:1}" != "1" ] then echo "M" fi @@ -97,7 +123,7 @@ function set_build { build=${tag##*-} else echo "No configuration system found. Cannot determine version." - exit 1 + exit 3 fi } @@ -122,7 +148,24 @@ function check_version { if [ "$clversion" != $version ] then echo "version mismatch: git: $version, changelog: $clversion" - exit 1 + exit 4 + fi +} + +function add_sources { + echo "Anz: $#" + for suf in $* + do + find . -name "*.$suf" -exec echo " "{}" \\" >> make.pre \; + done + if [ $# -eq 2 ] + then + rm make.tmp || true + find . -name "*.$2" -exec echo {} >> make.tmp \; + while read line + do + echo " ${line/\.$2/\.$1} \\" >> make.pre + done < make.tmp fi } @@ -131,19 +174,34 @@ function check_version { ############################################################################## install_dir="/" +compile_type=NONE +extern_build=0 + while [ $OPTIND -le "$#" ] do - if getopts "a:C:i:Iv:V" opt + if getopts "ha:bc:C:d:e:i:n:t:v:V" opt then case $opt in + h) echo_usage + exit 0 + ;; a) ARCH=$OPTARG ;; + b) extern_build=1 + ;; + c) compile_type=$OPTARG + ;; C) cross=$OPTARG ;; + d) compile_dir=$OPTARG + ;; + d) compile_target=$OPTARG + ;; i) install_dir=$OPTARG ;; - I) echo_usage - exit 0 + n) target_name=$OPTARG + ;; + t) target_type=$OPTARG ;; v) optversion=$OPTARG ;; @@ -151,11 +209,11 @@ do ;; \?) echo "Invalid option: -$OPTARG" echo_usage - exit 1 + exit 5 ;; :) echo "Option -$OPTARG requires an argument." echo_usage - exit 1 + exit 6 ;; esac else @@ -167,13 +225,19 @@ done 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 ] @@ -217,7 +281,6 @@ fi dpkg-architecture $arch_opt >> debian/setenv.sh echo "paket=$paket" >> debian/setenv.sh -echo "oldpack=\"$oldpack\"" >> debian/setenv.sh set_build if [ -z "$optversion" ] @@ -227,7 +290,9 @@ else 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) @@ -279,16 +344,6 @@ sed -i "s/^/export /" setenv.sh 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 @@ -296,21 +351,45 @@ 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=nobuild" >> debian/rules.pre +else echo "BUILD=build" >> debian/rules.pre - if [ -n "$BUILD_DIR" ] + + if [ $extern_build -eq 1 ] then - BUILD_DIR=. + BUILD_DIR=~/build + echo "BUILD_DIR=~/build" >> debian/rules.pre + debian/rules sync + fi + + # .build + if [ "$compile_type" != "CMAKE" -a "$compile_type" != "ANY" ] + then + 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 [ "$compile_type" == "PDF" ] + then + pushd $BUILD_DIR/$compile_dir >/dev/null + echo "SOURCES = \\" >> make.pre + add_sources tex xml + echo >> make.pre + popd >/dev/null fi -else - echo "BUILD=nobuild" >> debian/rules.pre -fi -# .build -if [ -x debian/$paket.build ] -then if [ -x debian/$paket.prebuild ] then pushd $BUILD_DIR >/dev/null @@ -318,37 +397,16 @@ then debian/$paket.prebuild popd >/dev/null 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 + if ! [ -x debian/$paket.build -o -f debian/$paket.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 + create_build fi - if ! [ -f debian/$paket.changelog ] + + # .cmake + if [ -e debian/$paket.cmake ] then - echo "changelog_source = debian/default.changelog" >> debian/rules.pre - if [ -f debian/default.changelog ] - then - rm debian/default.changelog - fi + cmake_check fi -elif [ -f debian/$paket.cp ] -then - echo "PACK=zip" >> debian/rules.pre -else - echo "PACK=version" >> debian/rules.pre fi +