From: Michael Wagner Date: Mon, 10 Oct 2022 15:25:15 +0000 (+0200) Subject: Merge branch 'master' of http://wagnertech.de/git/projects X-Git-Tag: v_0.0-7~11 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/commitdiff_plain/86a732a68de475c303c2e80dd4da44357f8e55ed?hp=5207ac53667b528bf98e061b2b49e813c34d924e Merge branch 'master' of http://wagnertech.de/git/projects --- diff --git a/debian/mbuild.conf b/debian/mbuild.conf new file mode 100644 index 0000000..ecd5950 --- /dev/null +++ b/debian/mbuild.conf @@ -0,0 +1,12 @@ +# mbuild configuration file + +# type of compile. Possible values: NONE, CPP, CMAKE, PDF, OLD (for downward compatibility) +compile_type=NONE +# compile target +compile_target= +# compile directory +compile_dir= + +# target type. Possible values: FILE, DEB, ZIP +target_type=DEB + diff --git a/debian/mbuild.cp b/debian/mbuild.cp index 628589c..b7efd86 100755 --- a/debian/mbuild.cp +++ b/debian/mbuild.cp @@ -14,6 +14,7 @@ cp tools/make/insert_build.sh $base/usr/share/mbuild/ 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 diff --git a/debian/verleihnix.cp b/debian/verleihnix.cp index 5ca08da..e0d9765 100755 --- a/debian/verleihnix.cp +++ b/debian/verleihnix.cp @@ -4,6 +4,9 @@ set -e mkdir -p $1/usr/share/php/verleihnix cp -a verleihnix/* $1/usr/share/php/verleihnix +# fetch local util +cp -a /usr/share/php/SysAl/util $1/usr/share/php/verleihnix/ + mkdir -p $1/etc/apache2/sites-available/ cp verleihnix/etc/verleihnix.conf $1/etc/apache2/sites-available/ diff --git a/tools/make/configure b/tools/make/configure index da630c3..acf16cb 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 @@ -97,7 +115,7 @@ function set_build { build=${tag##*-} else echo "No configuration system found. Cannot determine version." - exit 1 + exit 3 fi } @@ -122,7 +140,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 +166,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 +201,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 +217,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 +273,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 +282,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 +336,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 +343,44 @@ 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 -else - echo "BUILD=nobuild" >> debian/rules.pre -fi -# .build -if [ -x debian/$paket.build ] -then + + # .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 if [ -x debian/$paket.prebuild ] then pushd $BUILD_DIR >/dev/null @@ -318,37 +388,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 + diff --git a/tools/make/mMakefile b/tools/make/mMakefile index d6da7bb..22101bf 100644 --- a/tools/make/mMakefile +++ b/tools/make/mMakefile @@ -24,8 +24,8 @@ clean: %.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 @@ -37,3 +37,6 @@ make.pre: ~/build/debian/rules.pre pdflatex $< && pdflatex $< cp $*.pdf ~/build +%.tex : %.xml + mdoc-extract $< ${DOC_CLASS} + diff --git a/tools/make/mconfigure b/tools/make/mconfigure index b102ad7..e091ca6 100755 --- a/tools/make/mconfigure +++ b/tools/make/mconfigure @@ -3,12 +3,34 @@ set -e function echo_usage { echo "usage: mconfigure [options] " - echo " -c : copy configure/Makefile" - echo " -d : compile" - echo " -p : pack default: do all" ./configure -I } +function create_conf { + if [ -f "debian/$paket.cmake" ] + then + echo "compile_type=CMAKE" > debian/$paket.conf + elif [ -f "debian/$paket.build" ] + then + if [ -f "debian/$paket.cpp" ] + then + echo "compile_type=CPP" > debian/$paket.conf + else + echo "compile_type=ANY" > debian/$paket.conf + fi + else + echo "compile_type=NONE" > debian/$paket.conf + fi + + if [ -f "$paket.control" -a -f "$paket.cp" ] + then + echo "target_type=DEB" >> debian/$paket.conf + else + echo "target_type=FILE" >> debian/$paket.conf + fi + echo "$paket.conf created." +} + ############################################################################## # Main program ############################################################################## @@ -20,20 +42,12 @@ then 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 @@ -43,7 +57,7 @@ do ;; :) echo "Option -$OPTARG requires an argument." echo_usage - exit 1 + exit 3 ;; esac else @@ -55,67 +69,138 @@ done 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 ] + # check if any files for $paket are present + if ! ls debian/$paket.* 2>/dev/null then - ln -s /usr/share/mbuild/configure . + echo "$paket is no build target in this repository." + exit 5 fi + + # build conf file + echo "$paket.conf missing. We create it ..." + create_conf 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 + configure_args="$configure_args -d ~/build" +fi + +# perform configure +. debian/$paket.conf +if [ "$compile_type" != "NONE" ] +then + configure_args="$configure_args -b" + if [ -n "$compile_dir" ] + then + configure_args="$configure_args -d $compile_dir" + fi + if [ -z "$compile_type" ] + then + echo "compile_type required in $paket.conf" + exit 51 + fi +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 .build no longer supported. Use .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 [ "$compile_type" != "ANY" ] + then + if [ -z "$compile_target" ] + then + echo "compile_target is needed for target_type FILE" + exit 12 + fi + echo "COMPILE_TARGET = $compile_target" >> debian/rules.pre + if [ -n "$target_name" ] + then + echo "TARGET = $target_name" >> debian/rules.pre + else + echo "TARGET = $paket" >> debian/rules.pre + fi + fi +else + echo "Unknown target type: $target_type" + exit 13 fi +# build package +debian/rules pack + diff --git a/tools/make/rules b/tools/make/rules index e84acf9..e54228c 100755 --- a/tools/make/rules +++ b/tools/make/rules @@ -4,9 +4,10 @@ # 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 @@ -22,8 +23,8 @@ clean: -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: @@ -31,6 +32,7 @@ nobuild: install: debian/$(paket).cp $(INSTALL_DIR) + pack: $(PACK) # packing succeeded @@ -52,18 +54,20 @@ binary-arch: $(BINARY_ARCH) # 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_DIR)/$(TARGET): $(BUILD_DIR)/$(COMPILE_TARGET) + cp $(BUILD_DIR)/$(COMPILE_TARGET) $(BUILD_DIR)/$(TARGET) -../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