From: Michael Wagner Date: Thu, 19 Feb 2026 18:50:29 +0000 (+0100) Subject: libcob-ocesql build X-Git-Tag: v_0.0-15 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/projects.git/commitdiff_plain/7514c7ba24f06f8caa395ff545860f5532815d92 libcob-ocesql build --- diff --git a/Configure b/Configure index 9eddd7d..ecc04ce 100755 --- a/Configure +++ b/Configure @@ -27,6 +27,89 @@ projects (%VERSION%-%BUILD%) unstable; urgency=medium CHANGELOG } +function write_eclipse_control { + # $1: package name + cat <debian/$1.control +Source: projects +Section: main +Priority: optional +Maintainer: Michael Wagner +Build-Depends: git, mbuild + +Package: $1 +Architecture: _DEB_HOST_ARCH +Depends: $2 +Description: http://eclipse.org +CONTROL +} + +function write_eclipse_cp { + # $1: package name + cat <debian/$1.cp +#!/bin/bash +set -e + +mkdir -p \$1/opt/$1/ +cp -a Downloads/eclipse/* \$1/opt/$1/ +CP +} + +function write_eclipse_postinst { + # $1: package name + cat <debian/$1.postinst +#!/bin/bash +set -e + +for user in user nutzer kurs; do + if [ -d /home/\$user ]; then + echo "Install eclipse for user \$user" + pushd /home/\$user >/dev/null + + if [ -d Schreibtisch ]; then + pushd Schreibtisch >/dev/null + su \$user -c "ln -sf /opt/eclipse-cpp/eclipse ." + popd >/dev/null + fi + + if [ -d Desktop ]; then + pushd Desktop >/dev/null + su \$user -c "ln -sf /opt/eclipse-cpp/eclipse ." + popd >/dev/null + fi + popd >/dev/null + fi +done +POSTINST +} + +function write_eclipse_prepare { + # $1: package name + # $2: ECLIPSE_PATTERN + cat <debian/$1.prepare +#!/bin/bash +set -e + +debian/eclipse.prepare $2 +PREPARE +} + +function configure_eclipse { + # $1: package name + # $2: ECLIPSE_PATTERN + # $3: additional dependencies + + write_deb $1 NONE + write_changelog $1 + write_eclipse_control $1 "$3" + write_eclipse_cp $1 + chmod 755 debian/$1.cp + write_eclipse_postinst $1 + chmod 755 debian/$1.postinst + write_eclipse_prepare $1 $2 + chmod 755 debian/$1.prepare + mconfigure -V $1 +} + if [ -z "$1" ]; then usage exit 7 @@ -35,14 +118,20 @@ fi case $1 in eclipse-cpp) - write_deb eclipse-cpp NONE - write_changelog eclipse-cpp - mconfigure -V eclipse-cpp + configure_eclipse eclipse-cpp "eclipse-cpp*.tar.gz" "build-essential,gdb" + ;; + +eclipse-php) + configure_eclipse eclipse-php "eclipse-php*.tar.gz" php ;; libcob-ocesql) + if [ -z "$2" ]; then + echo "supply version as 2nd parameter" + exit 131 + fi write_deb libcob-ocesql ANY - mconfigure -v 1.4 libcob-ocesql + mconfigure -v $2 libcob-ocesql ;; mconnect) diff --git a/debian/eclipse-cpp.control b/debian/eclipse-cpp.control deleted file mode 100644 index 7fa2a84..0000000 --- a/debian/eclipse-cpp.control +++ /dev/null @@ -1,11 +0,0 @@ -Source: projects -Section: main -Priority: optional -Maintainer: Michael Wagner -Build-Depends: git, mbuild - -Package: eclipse-cpp -Architecture: _DEB_HOST_ARCH -Depends: build-essential, gdb -Description: http://eclipse.org - diff --git a/debian/eclipse-cpp.cp b/debian/eclipse-cpp.cp deleted file mode 100755 index f1c5305..0000000 --- a/debian/eclipse-cpp.cp +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -e - -mkdir -p $1/opt/eclipse-cpp/ -cp -a Downloads/eclipse/* $1/opt/eclipse-cpp/ - diff --git a/debian/eclipse-cpp.postinst b/debian/eclipse-cpp.postinst deleted file mode 100755 index 83b1889..0000000 --- a/debian/eclipse-cpp.postinst +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -set -e - -for user in user nutzer kurs; do - if [ -d /home/$user ]; then - echo "Install eclipse for user $user" - pushd /home/$user >/dev/null - - if [ -d Schreibtisch ]; then - pushd Schreibtisch >/dev/null - su $user -c "ln -sf /opt/eclipse-cpp/eclipse ." - popd >/dev/null - fi - - if [ -d Desktop ]; then - pushd Desktop >/dev/null - su $user -c "ln -sf /opt/eclipse-cpp/eclipse ." - popd >/dev/null - fi - popd >/dev/null - fi -done - diff --git a/debian/eclipse-cpp.prepare b/debian/eclipse-cpp.prepare deleted file mode 100755 index 169b64f..0000000 --- a/debian/eclipse-cpp.prepare +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -set -e - -ECPP_PATTERN="eclipse-cpp*.tar.gz" - -# check, if there is exactly 1 eclipse-cpp*.tar.gz in Downloads -pushd Downloads >/dev/null - if [ $(ls $ECPP_PATTERN| wc -l) -ne 1 ]; then - echo "Es muss genau ein $ECPP_PATTERN in Downloads sein." - exit 8 - fi - eclipse_cpp_tgz=$(ls $ECPP_PATTERN) - - # entpacke tar.gz - if [ -d eclipse ]; then - rm -r eclipse - fi - tar xf $eclipse_cpp_tgz -popd >/dev/null - -# bestimme eclipse version -eversion=${eclipse_cpp_tgz#eclipse-cpp-} -eversion=${eversion%-linux*} -echo "version=$eversion" >> debian/rules.pre -echo "export version=$eversion" >> debian/setenv.sh - -# bestimme arch -arch=${eclipse_cpp_tgz#*gtk-} -arch=${arch%.tar.gz} -echo "arch=$arch" >> debian/rules.pre -echo "export arch=$arch" >> debian/setenv.sh - - diff --git a/debian/eclipse.prepare b/debian/eclipse.prepare new file mode 100755 index 0000000..6a39aa3 --- /dev/null +++ b/debian/eclipse.prepare @@ -0,0 +1,37 @@ +#!/bin/bash +set -e + +if [ -z "$1" ]; then + echo "usage eclipse.prepare ECLIPSE_PATTERN" + exit 6 +fi +ECLIPSE_PATTERN=$1 + +# check, if there is exactly 1 eclipse-cpp*.tar.gz in Downloads +pushd Downloads >/dev/null + if [ $(ls $ECLIPSE_PATTERN| wc -l) -ne 1 ]; then + echo "Es muss genau ein $ECLIPSE_PATTERN in Downloads sein." + exit 8 + fi + eclipse_tgz=$(ls $ECLIPSE_PATTERN) + + # entpacke tar.gz + if [ -d eclipse ]; then + rm -r eclipse + fi + tar xf $eclipse_tgz +popd >/dev/null + +# bestimme eclipse version +eversion=${eclipse_tgz#eclipse-*-} +eversion=${eversion%-linux*} +echo "version=$eversion" >> debian/rules.pre +echo "export version=$eversion" >> debian/setenv.sh + +# bestimme arch +arch=${eclipse_tgz#*gtk-} +arch=${arch%.tar.gz} +echo "arch=$arch" >> debian/rules.pre +echo "export arch=$arch" >> debian/setenv.sh + + diff --git a/debian/libcob-ocesql.build b/debian/libcob-ocesql.build index 1a51ab1..9d1845f 100755 --- a/debian/libcob-ocesql.build +++ b/debian/libcob-ocesql.build @@ -1,4 +1,21 @@ #!/bin/bash set -e -echo "NYI" +# this stuff is necessary here: doing it in the prebuild +# is useless: There is an sync step directly before the build +# and recreated .ac files are overwtritten + +build_base=$(pwd) + +cd Downloads/Open-COBOL-ESQL +autoreconf +aclocal +libtoolize + +#pushd dblib >/dev/null +# libtoolize +#popd >/dev/null + +./configure --prefix $build_base/debian/tmp/usr + +make diff --git a/debian/libcob-ocesql.cp b/debian/libcob-ocesql.cp index 51a20e4..27ede25 100755 --- a/debian/libcob-ocesql.cp +++ b/debian/libcob-ocesql.cp @@ -1,15 +1,21 @@ #!/bin/bash set -e -mkdir -p $1/usr/local/lib -cp ../Open-COBOL-ESQL-$version/dblib/.libs/libocesql.a $1/usr/local/lib -cp ../Open-COBOL-ESQL-$version/dblib/libocesql.la $1/usr/local/lib -cp ../Open-COBOL-ESQL-$version/dblib/.libs/libocesql.so.0.1.0 $1/usr/local/lib -pushd $1/usr/local/lib >/dev/null - ln -s libocesql.so.0.1.0 libocesql.so - ln -s libocesql.so.0.1.0 libocesql.so.0 +#mkdir -p $1/usr/local/lib +#cp ../Open-COBOL-ESQL-$version/dblib/.libs/libocesql.a $1/usr/local/lib +#cp ../Open-COBOL-ESQL-$version/dblib/libocesql.la $1/usr/local/lib +#cp ../Open-COBOL-ESQL-$version/dblib/.libs/libocesql.so.0.1.0 $1/usr/local/lib +#pushd $1/usr/local/lib >/dev/null +# ln -s libocesql.so.0.1.0 libocesql.so +# ln -s libocesql.so.0.1.0 libocesql.so.0 +#popd >/dev/null + +pushd ~/build/Downloads/Open-COBOL-ESQL >/dev/null + make install popd >/dev/null +rsync -a ~/build/debian/tmp/ ./debian/tmp/ + mkdir -p $1/usr/bin cat << 'OCERUN' > $1/usr/bin/ocerun #!/bin/bash @@ -20,9 +26,44 @@ if [ -z "$1" ] ;then exit 1 fi -export LD_LIBRARY_PATH="/usr/local/lib" +export LD_LIBRARY_PATH="/usr/lib" export OCDB_DB_CHAR=UTF-8 $1 OCERUN chmod 755 $1/usr/bin/ocerun + +cat << 'OCECOBC' > $1/usr/bin/ocecobc +#!/bin/bash +set -e + +usage="ocecobc [-x] DATEI" + +exec_flag="" + +if [ -z "$1" ]; then + echo "Usage: $usage" + exit 46 +fi +file=$1 + +if [ $1 == "-x" ]; then + exec_flag="-x" + if [ -z "$2 ]; then + echo "File missing." + echo "Usage: $usage" + exit 43 + fi + file=$2 +fi + +export COB_LDFLAGS=-Wl,--no-as-needed +export LD_LIBRARY_PATH="/usr/lib" +export COBCPY=/usr/share/open-cobol-esql/copy + +base_name=${file%.*} + +ocesql $file $base_name.cob +cobc $exec_flag -locesql $base_name.cob +OCECOBC +chmod 755 $1/usr/bin/ocecobc diff --git a/debian/libcob-ocesql.prepare b/debian/libcob-ocesql.prepare new file mode 100755 index 0000000..ae217a4 --- /dev/null +++ b/debian/libcob-ocesql.prepare @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +echo 'RSYNC_OPT = -av --exclude="build" --exclude="debian/tmp" --exclude="Packages" --exclude="*Aktuell" --exclude=".*" --exclude="Makefile"' >> debian/rules.pre + +dpkg -s bison flex pkg-config make build-essential g++ automake libtool >/dev/null + +if [ ! -d Downloads ]; then + mkdir Downloads +fi + +cd Downloads +if [ -d Open-COBOL-ESQL ]; then + cd Open-COBOL-ESQL +else + git clone https://github.com/opensourcecobol/Open-COBOL-ESQL + cd Open-COBOL-ESQL +fi +git checkout v$version diff --git a/debian/mdjango.postinst b/debian/mdjango.postinst index 28982ba..d6b8a6f 100755 --- a/debian/mdjango.postinst +++ b/debian/mdjango.postinst @@ -8,6 +8,7 @@ systemctl reload apache2 if ! grep "### MDJANGO ###" /opt/mysite/mysite/settings.py >/dev/null then echo "add mdjango settings to settings.py" + echo "*** Attention ALLOWED_HOSTS is set to '*' ***" cat << EOF >> /opt/mysite/mysite/settings.py ### MDJANGO ### DATABASES = { @@ -21,11 +22,17 @@ DATABASES = { }, } STATIC_ROOT = '/var/mysite/static' +STATIC_URL = '/mdjangostat/' DEBUG = False +ALLOWED_HOSTS = ["*"] ### MDJANGO-END ### EOF fi +# change admin to mdjangoad +sed -i "s/path('admin/path('mdjangoad/" /opt/mysite/mysite/settings.py + + # check existence of /var/mysite if [ ! -d /var/mysite ] then @@ -89,7 +96,9 @@ fi # check existence of superuser #if [ $(sqlite3 /var/mysite/default.sqlite3 'SELECT id FROM auth_user WHERE is_staff=1;' |wc -l) -eq 0 ] -if [ $(su postgres -c "psql mdjango -c 'SELECT id FROM auth_user WHERE is_staff=1;' " |wc -l) -eq 0 ] +#if [ $(su postgres -c "psql mdjango -c 'SELECT id FROM auth_user WHERE is_staff=t;' " |wc -l) -eq 0 ] +if [ $(su postgres -c "psql mdjango -c \"SELECT id FROM auth_user WHERE is_staff='t';\" " |wc -l) -eq 0 ] + then echo "There is no django superuser in the system. Install one? (Y/n)" read a diff --git a/mdjango/etc/mysite.conf b/mdjango/etc/mysite.conf index ee352ef..027e985 100644 --- a/mdjango/etc/mysite.conf +++ b/mdjango/etc/mysite.conf @@ -1,4 +1,4 @@ -Alias /static/ /var/mysite/static +Alias /mdjangostat/ /var/mysite/static Require all granted