Skip to content

Commit

Permalink
Build vbisam + QOL improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
emilienlemaire committed Sep 26, 2024
1 parent b80c1c0 commit ef2b39a
Showing 1 changed file with 88 additions and 26 deletions.
114 changes: 88 additions & 26 deletions scripts/package-superbol.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -ev

# Compile the latest versions of padbol:master and gnucobol:gnucobol-3.x
# and generate a binary archive
Expand All @@ -19,32 +19,49 @@ fi
# Alternatively, you can pass as first argument a bash script defining
# TARGETDIR, BUILDIR and/or SWITCHNAME to override their default values.


export SUPERBOL_PACKAGING=1
INSTALLDIR=$(readlink -f "${TARGETDIR:-/home/bas/superbol}")
BUILDDIR=$(readlink -f "${BUILDDIR:-$(pwd)/tmp-builddir}")
SWITCHNAME="${SWITCHNAME:-for-padbol}"
TARGETDIR=$(readlink -f "${TARGETDIR:-INSTALL_DIR}")

echo "Packaging SuperBOL into ${TARGETDIR}"

export LD_LIBRARY_PATH="${TARGETDIR}/lib:${TARGETDIR}/lib64"
export LIBRARY_PATH="${TARGETDIR}/lib:${TARGETDIR}/lib64"

DATE=$(date +%Y%m%d%H%M)

#rm -rf ${TARGETDIR}
#rm -rf ${BUILDDIR}

mkdir -p ${BUILDDIR}
cd ${BUILDDIR}

if [ -e gixsql ]; then
git -C gixsql pull
else
if [ ! -e fmt ]; then
git clone [email protected]:fmtlib/fmt.git
git -C fmt checkout 10.2.1
fi

if [ -e spdlog ]; then
git -C spdlog pull
else
git clone [email protected]:gabime/spdlog.git
fi

if [ -e gixsql ]; then
git -C gixsql pull
else
git clone -b multiline-declare-section [email protected]:emilienlemaire/gixsql.git
fi

if [ -e visam-2.2.tar.Z ]; then
if [ ! -e visam-2.2 ]; then
tar -xvzf visam-2.2.tar.Z
fi
else
wget http://inglenet.ca/Products/GnuCOBOL/visam-2.2.tar.Z
tar -xvzf visam-2.2.tar.Z
fi

if [ -e gnucobol ]; then
git -C gnucobol pull
else
Expand All @@ -53,11 +70,20 @@ fi

if [ -e padbol ]; then
git -C padbol pull
if [ ! -e padbol/_opam ]; then
cd padbol
opam switch link $SWITCHNAME
cd ..
fi
else
git clone [email protected]:OCamlPro/padbol --depth 1
(cd padbol; opam switch link $SWITCHNAME)
git clone -b packaging-build [email protected]:emilienlemaire/padbol --depth 1
cd padbol
if [ ! -e _opam ]; then
opam switch link $SWITCHNAME
fi
cd ..
git -C padbol submodule update --recursive --init
fi
git -C padbol submodule update --recursive --init

FMT_COMMIT=$(git -C fmt rev-parse --short HEAD)
SPDLOG_COMMIT=$(git -C spdlog rev-parse --short HEAD)
Expand Down Expand Up @@ -94,13 +120,14 @@ if [ ! -e ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT} ]; then
cd _build
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGETDIR} -DBUILD_SHARED_LIBS=TRUE -DFMT_TEST=OFF ..
make -j
make install
rm -rf commits
mkdir commits
touch commits/${FMT_COMMIT}
cd ..
fi
cd ..
cd _build
make install
rm -rf commits
mkdir commits
touch commits/${FMT_COMMIT}
cd ../..

export CXXFLAGS="$(pkg-config --cflags fmt)"
export LIBS="$(pkg-config --libs fmt) $LIBS"
Expand All @@ -109,39 +136,74 @@ if [ ! -e ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT} ]; then
if [ ! -e "_build/commits/${SPDLOG_COMMIT}" ]; then
mkdir -p _build
cd _build
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGETDIR} -DBUILD_SHARED_LIBS=TRUE -DSPDLOG_BUILD_EXAMPLE=NO -DSPDLOG_BUILD_TESTS=NO -DSPDLOG_FMT_EXTERNAL=ON -DCMAKE_CXX_FLAGS="-fPIC" ..
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGETDIR} \
-DBUILD_SHARED_LIBS=TRUE \
-DSPDLOG_BUILD_EXAMPLE=NO \
-DSPDLOG_BUILD_TESTS=NO \
-DSPDLOG_FMT_EXTERNAL=ON \
-DCMAKE_CXX_FLAGS="-fPIC" \
..
make -j
make install
rm -rf commits
mkdir commits
touch commits/${SPDLOG_COMMIT}
cd ..
fi
cd ..
cd _build
make install
rm -rf commits
mkdir commits
touch commits/${SPDLOG_COMMIT}
cd ../..

export CXXFLAGS="$(pkg-config --cflags spdlog) $CXXFLAGS"
export LIBS="$(pkg-config --libs spdlog) $LIBS"

cd gixsql
if [ ! -e "_build/commits/gixsql-${GIXSQL_COMMIT}" ]; then
if [ ! -e "commits/${GIXSQL_COMMIT}" ]; then
touch extra_files.mk
autoreconf -i
./configure --prefix=${TARGETDIR}
make -j
make install
fi
make install
mkdir -p commits
touch commits/${GIXSQL_COMMIT}
mkdir -p ${TARGETDIR}/commits/
echo > ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT}
cd ..
fi

if [ ! -e ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT} ]; then
echo "Checking for vbisam install"
cd visam-2.2
if [ ! -e _build/version/2.2 ]; then
echo "Not installed: building"
rm -rf _build
mkdir -p _build
cd _build
../configure --prefix=${TARGETDIR} --enable-vbisamdefault
make -j
cd ..
else
echo "Installed"
fi
cd _build
make install
ln -s ${TARGETDIR}/lib/libvisam.so ${TARGETDIR}/lib/libvbisam.so
ln -s ${TARGETDIR}/include/visam.h ${TARGETDIR}/include/vbisam.h
mkdir -p version
touch version/2.2
cd ../..
LD_LIBRARY_PATH=${TARGETDIR}/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
LIBRARY_PATH=${LD_LIBRARY_PATH}
export LIBRARY_PATH
C_INCLUDE_PATH=${TARGETDIR}/include
export C_INCLUDE_PATH
cd gnucobol
if [ ! -e _build/commits/${GNUCOBOL_COMMIT} ]; then
mkdir -p _build
cd _build
../autogen.sh install
../configure --prefix=${TARGETDIR}
../configure --prefix=${TARGETDIR} --with-vbisam
make -j
rm -rf commits
mkdir commits
Expand All @@ -151,7 +213,7 @@ if [ ! -e ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT} ]; then
cd _build
make install
mkdir -p ${TARGETDIR}/commits/
echo > ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT}
touch ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT}
cd ../..
fi

Expand Down Expand Up @@ -185,7 +247,7 @@ if [ ! -e ${TARGETDIR}/commits/superbol-${SUPERBOL_COMMIT} ]; then
cp -f $(ldd ${TARGETDIR}/bin/superkix | awk '{ print $3 }' | grep -v ${TARGETDIR}) ${TARGETDIR}/lib/
cd ..

echo > ${TARGETDIR}/commits/superbol-${SUPERBOL_COMMIT}
touch ${TARGETDIR}/commits/superbol-${SUPERBOL_COMMIT}
fi

cd $(dirname ${TARGETDIR})
Expand Down

0 comments on commit ef2b39a

Please sign in to comment.