X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/blobdiff_plain/6c1a75b4924102f180a09bbb1fa243479c6849a7..0b8ae20fd3339cdb7b02aa37ec295cb0ceca6380:/tools/make/configure diff --git a/tools/make/configure b/tools/make/configure index da630c3..2382c1d 100755 --- a/tools/make/configure +++ b/tools/make/configure @@ -4,12 +4,12 @@ set -e function echo_usage { echo "usage: configure [options] " echo " -a " - echo " -c : configure" + echo " -b : extern build in ../build directory" + echo " -c " echo " -C " - echo " -d : compile" echo " -i : install dir. default: /" echo " -I : print this info" - echo " -p : pack default: do all" + echo " -t default: NONE" echo " -v : set version" echo " -V : version set by project" } @@ -97,7 +97,7 @@ function set_build { build=${tag##*-} else echo "No configuration system found. Cannot determine version." - exit 1 + exit 3 fi } @@ -122,7 +122,7 @@ function check_version { if [ "$clversion" != $version ] then echo "version mismatch: git: $version, changelog: $clversion" - exit 1 + exit 4 fi } @@ -131,13 +131,20 @@ 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 "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 @@ -145,17 +152,19 @@ do 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 @@ -167,13 +176,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 +232,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 +241,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 +295,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,59 +302,53 @@ 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 +