Skip to content

Commit

Permalink
Merge pull request #8 from emilienlemaire/install-script
Browse files Browse the repository at this point in the history
Update for demo
  • Loading branch information
emilienlemaire committed Oct 3, 2024
2 parents bd2e62c + e1ce2c6 commit 0456c26
Show file tree
Hide file tree
Showing 10 changed files with 261 additions and 39 deletions.
68 changes: 32 additions & 36 deletions scripts/package-superbol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ fi


export SUPERBOL_PACKAGING=1
INSTALLDIR=$(readlink -f "${TARGETDIR:-/home/bas/superbol}")
INSTALLDIR="/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"
export LD_LIBRARY_PATH="${TARGETDIR}/${INSTALLDIR}/lib:${TARGETDIR}/${INSTALLDIR}/lib64"
export LIBRARY_PATH="${TARGETDIR}/${INSTALLDIR}/lib:${TARGETDIR}/${INSTALLDIR}/lib64"
export CFLAGS="-static-libgcc"
export CXXFLAGS="-static-libgcc -static-libstdc++"

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

Expand Down Expand Up @@ -76,7 +78,7 @@ if [ -e padbol ]; then
cd ..
fi
else
git clone -b packaging-build [email protected]:emilienlemaire/padbol --depth 1
git clone -b edit-port [email protected]:emilienlemaire/padbol --depth 1
cd padbol
if [ ! -e _opam ]; then
opam switch link $SWITCHNAME
Expand Down Expand Up @@ -109,34 +111,34 @@ fi

if [ ! -e ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT} ]; then

export CMAKE_PREFIX_PATH=$TARGETDIR
export CMAKE_MODULE_PATH=$TARGETDIR/lib
export PKG_CONFIG_PATH=${TARGETDIR}/lib64/pkgconfig:${TARGETDIR}/lib/pkgconfig
export CMAKE_PREFIX_PATH=$TARGETDIR/$INSTALLDIR
export CMAKE_MODULE_PATH=${TARGETDIR}/${INSTALLDIR}/lib
export PKG_CONFIG_PATH=${TARGETDIR}/${INSTALLDIR}/lib64/pkgconfig:${TARGETDIR}/${INSTALLDIR}/lib/pkgconfig
export CMAKE_FIND_USE_CMAKE_SYSTEM_PATH=FALSE

cd fmt
if [ ! -e "_build/commits/${FMT_COMMIT}" ]; then
mkdir -p _build
cd _build
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGETDIR} -DBUILD_SHARED_LIBS=TRUE -DFMT_TEST=OFF ..
cmake -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR} -DBUILD_SHARED_LIBS=TRUE -DFMT_TEST=OFF ..
make -j
cd ..
fi
cd _build
make install
make DESTDIR=${TARGETDIR} install
rm -rf commits
mkdir commits
touch commits/${FMT_COMMIT}
cd ../..

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

cd spdlog
if [ ! -e "_build/commits/${SPDLOG_COMMIT}" ]; then
mkdir -p _build
cd _build
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGETDIR} \
cmake -DCMAKE_INSTALL_PREFIX:PATH=${INSTALLDIR} \
-DBUILD_SHARED_LIBS=TRUE \
-DSPDLOG_BUILD_EXAMPLE=NO \
-DSPDLOG_BUILD_TESTS=NO \
Expand All @@ -147,7 +149,7 @@ if [ ! -e ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT} ]; then
cd ..
fi
cd _build
make install
make DESTDIR=${TARGETDIR} install
rm -rf commits
mkdir commits
touch commits/${SPDLOG_COMMIT}
Expand All @@ -160,10 +162,10 @@ if [ ! -e ${TARGETDIR}/commits/gixsql-${GIXSQL_COMMIT} ]; then
if [ ! -e "commits/${GIXSQL_COMMIT}" ]; then
touch extra_files.mk
autoreconf -i
./configure --prefix=${TARGETDIR}
./configure --prefix=${INSTALLDIR}
make -j
fi
make install
make DESTDIR=${TARGETDIR} install
mkdir -p commits
touch commits/${GIXSQL_COMMIT}
mkdir -p ${TARGETDIR}/commits/
Expand All @@ -176,53 +178,46 @@ if [ ! -e ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT} ]; then
cd visam-2.2
if [ ! -e _build/version/2.2 ]; then
echo "Not installed: building"
if [ -e Makefile ]; then
make distclean
fi
rm -rf _build
mkdir -p _build
cd _build
../configure --prefix=${TARGETDIR} --enable-vbisamdefault
../configure --prefix=${INSTALLDIR} --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
make DESTDIR=${TARGETDIR} install
ln -s ${TARGETDIR}/${INSTALLDIR}/lib/libvisam.so ${TARGETDIR}/${INSTALLDIR}/lib/libvbisam.so
ln -s ${TARGETDIR}/${INSTALLDIR}/include/visam.h ${TARGETDIR}/${INSTALLDIR}/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
C_INCLUDE_PATH=${TARGETDIR}/${INSTALLDIR}/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} --with-vbisam
../configure --prefix=${INSTALLDIR} --with-vbisam
make -j
rm -rf commits
mkdir commits
touch commits/${GNUCOBOL_COMMIT}
cd ..
fi
cd _build
make install
make DESTDIR=${TARGETDIR} install
mkdir -p ${TARGETDIR}/commits/
touch ${TARGETDIR}/commits/gnucobol-${GNUCOBOL_COMMIT}
cd ../..
fi

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

Expand All @@ -240,11 +235,12 @@ if [ ! -e ${TARGETDIR}/commits/superbol-${SUPERBOL_COMMIT} ]; then
mkdir -p ${TARGETDIR}/bin/
mkdir -p ${TARGETDIR}/lib/

cp -f padbol ${TARGETDIR}/bin/superbol
find superkix/third-parties -name '*.so' -exec cp -f {} ${TARGETDIR}/lib \;
cp -f superkix/target/release/server ${TARGETDIR}/bin/superkix
cp -f superkix/target/release/libsuperkix.so ${TARGETDIR}/lib/
cp -f $(ldd ${TARGETDIR}/bin/superkix | awk '{ print $3 }' | grep -v ${TARGETDIR}) ${TARGETDIR}/lib/
cp -fv padbol ${TARGETDIR}/${INSTALLDIR}/bin/superbol
find superkix/third-parties -name '*.so' -exec cp -fv {} ${TARGETDIR}/${INSTALLDIR}/lib \;
cp -fv superkix/target/release/libsuperkix.so ${TARGETDIR}/${INSTALLDIR}/lib
cp -fv superkix/target/release/server ${TARGETDIR}/${INSTALLDIR}/bin/superkix
cp -fv $(ldd ${TARGETDIR}/${INSTALLDIR}/bin/superkix | awk '{ print $3 }' | grep -v ${TARGETDIR}) ${TARGETDIR}/${INSTALLDIR}/lib/
rm -f ${TARGETDIR}/${INSTALLDIR}/lib/libc.so.*
cd ..

touch ${TARGETDIR}/commits/superbol-${SUPERBOL_COMMIT}
Expand Down
9 changes: 9 additions & 0 deletions scripts/vm-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/usr/bin/bash

pwd

export LD_LIBRARY_PATH=/home/bas/superbol/lib:/usr/host/lib
export PATH=/home/bas/superbol/bin:${PATH}

if [ ! -e Makefile ]; then
cd ${APP_HOME}/cobol_repo
fi

./configure
make
make install
4 changes: 3 additions & 1 deletion scripts/vm-git-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mkdir -p $(dirname $LOG_FILE)


${APP_HOME}/scripts/vm-build.sh >> $LOG_FILE 2>&1
pkill -HUP superkix

# Fonction principale
while true; do
Expand All @@ -26,10 +27,11 @@ while true; do

# Recompiler et installer
echo "Running ./configure && make && make install" >> $LOG_FILE 2>&1
${APP_HOME}/scripts/vm-build.sh
${APP_HOME}/scripts/vm-build.sh >> $LOG_FILE 2>&1

if [ $? -eq 0 ]; then
echo "Build and installation successful." >> $LOG_FILE 2>&1
pkill -HUP superkix
else
echo "Build or installation failed." >> $LOG_FILE 2>&1
fi
Expand Down
23 changes: 23 additions & 0 deletions scripts/vm-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e

# Install the latest release on the VM

INSTALLDIR=$(readlink -f "${INSTALLDIR:-${HOME}/superbol}")

mkdir -p tmp-install

mkdir -p ${INSTALLDIR}/bin
mkdir -p ${INSTALLDIR}/lib
mkdir -p ${INSTALLDIR}/include
mkdir -p ${INSTALLDIR}/share


tar -xvzf superbol-install.tar.gz -C tmp-install

cp -Rf tmp-install/target/home/* /home/

export PATH=${INSTALLDIR}/bin:${PATH}
export LD_LIBRARY_PATH=${INSTALLDIR}/lib:${LD_LIBRARY_PATH}
export C_INCLUDE_PATH=${INSTALLDIR}/include:${C_INCLUDE_PATH}
9 changes: 7 additions & 2 deletions scripts/vm-start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/bash

set -e

cat << EOM
.,,,,,,*
,,,,,,*****
Expand All @@ -18,7 +20,10 @@ cat << EOM
EOM


git clone $COB_GIT_REPO cobol_repo
./scripts/vm-install.sh
git clone $COB_GIT_REPO ${APP_HOME}/cobol_repo
export LD_LIBRARY_PATH=/home/bas/superbol/lib:/usr/host/lib
export PATH=/home/bas/superbol/bin:$PATH
${APP_HOME}/scripts/vm-git-check.sh &
env | sort
/home/bas/superbol/bin/server -v run -c $APP_HOME/cobol_repo/config.toml
/home/bas/superbol/bin/superkix -v run $APP_HOME/cobol_repo
Binary file added superbol-install.tar.gz
Binary file not shown.
Binary file not shown.
95 changes: 95 additions & 0 deletions superkix-server/static/resources/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
@font-face {
font-family: Departure;
src: url(/resources/DepartureMono-Regular.woff2);
}

:root {
background: rgb(9,9,121);
background: radial-gradient(circle, rgba(9,9,121,1) 0%, rgb(0, 70, 140) 100%);
/* color: hsl(214, 100%, 60%); */
color: hsl(214, 100%, 65%);
font-family: sans-serif;
font-size: 110%;
min-height: 100vh;
}

body {
display: grid;
justify-content: center;
gap: 0.3em;

grid-template-columns: fit-content(60em) fit-content(35em);
grid-template-rows: auto;
grid-template-areas:
"header header"
"sub-header sub-header"
"logs connections"
;
}

.widget {
background-color: #222222;
border-radius: 0.3rem;

box-shadow: 0pt 0pt 0.5rem 0.1rem rgba(47, 47, 47, 0.627);

h2 {
background-color: #333333;
color: hsl(214, 100%, 65%);
margin: 0pt;
border-top-left-radius: 0.3rem;
border-top-right-radius: 0.3rem;
}

h2,
.widget-content {
padding: 0.5rem;
}

.widget-content {
font-family: Departure, monospace;
}
}

header {
grid-area: header;
justify-self: center;
color: #ffffff;
}

#logs {
grid-area: logs;
}

#last_config {
grid-area: sub-header;
}

.console {
white-space: pre-wrap;
word-wrap: break-word;
max-height: 30em;
overflow: scroll;
}

#connections {
grid-area: connections;
}

table {
width: 100%;
border-collapse: collapse;
}

table,
th,
td {
border: 1px solid hsla(214, 100%, 65%, 0.566);
;
}

th,
td {
padding: 8px;
text-align: left;
}
Loading

0 comments on commit 0456c26

Please sign in to comment.