1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00
VILLASnode/packaging/deps.sh

255 lines
6.9 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
set -e
2020-06-07 01:38:05 +02:00
PREFIX=${PREFIX:-/usr/local}
TRIPLET=${TRIPLET:-x86_64-linux-gnu}
CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}"
CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}"
2020-06-07 01:03:26 +02:00
2021-08-03 15:37:19 -04:00
MAKE_THREADS=${MAKE_THREADS:-$(nproc)}
MAKE_OPTS+="-j${MAKE_THREADS}"
2021-07-20 18:15:11 +02:00
2020-12-04 13:55:22 +01:00
git config --global http.postBuffer 524288000
git config --global core.compression 0
if [ -n "${PACKAGE}" ]; then
TARGET="package"
2020-06-07 01:03:26 +02:00
CMAKE_OPTS+=" -DCPACK_GENERATOR=RPM"
# Prepare rpmbuild dir
mkdir -p ~/rpmbuild/SOURCES
mkdir -p rpms
dnf -y install \
xmlto \
systemd-devel
else
TARGET="install"
fi
2020-06-07 01:38:05 +02:00
DIR=$(mktemp -d)
pushd ${DIR}
# Build & Install Criterion
2020-06-07 01:38:05 +02:00
if ! pkg-config "criterion >= 2.3.1" && \
[ "${ARCH}" == "x86_64" ] && \
[ -z "${SKIP_CRITERION}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch v2.3.3 --depth 1 --recursive https://github.com/Snaipe/Criterion
mkdir -p Criterion/build
pushd Criterion/build
2020-06-07 01:03:26 +02:00
cmake ${CMAKE_OPTS} ..
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
fi
popd
fi
# Build & Install EtherLab
if [ -z "${SKIP_ETHERLAB}" ]; then
hg clone --branch stable-1.5 http://hg.code.sf.net/p/etherlabmaster/code etherlab
pushd etherlab
./bootstrap
./configure --enable-userlib=yes --enable-kernel=no ${CONFIGURE_OPTS}
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
else
wget https://etherlab.org/download/ethercat/ethercat-1.5.2.tar.bz2
cp ethercat-1.5.2.tar.bz2 ~/rpmbuild/SOURCES
rpmbuild -ba ethercat.spec
fi
popd
fi
# Build & Install libiec61850
if ! pkg-config "libiec61850 >= 1.3.1" && \
[ -z "${SKIP_LIBIEC61850}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch v1.4 --depth 1 https://github.com/mz-automation/libiec61850
mkdir -p libiec61850/build
pushd libiec61850/build
2020-06-07 01:03:26 +02:00
cmake ${CMAKE_OPTS} ..
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} ${TARGET}
if [ -n "${PACKAGE}" ]; then
cp libiec61850/build/*.rpm rpms
fi
popd
fi
# Build & Install librdkafka
if ! pkg-config "rdkafka>=1.5.0" && \
[ -z "${SKIP_RDKAFKA}" ]; then
git clone --branch v1.6.0 --depth 1 https://github.com/edenhill/librdkafka.git
mkdir -p librdkafka/build
pushd librdkafka/build
cmake -DRDKAFKA_BUILD_TESTS=OFF \
-DRDKAFKA_BUILD_EXAMPLES=OFF \
${CMAKE_OPTS} ..
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} ${TARGET}
popd
fi
2021-06-16 10:36:19 -04:00
# Build & Install uldaq
if ! pkg-config "libuldaq >= 1.2.0" && \
[ -z "${SKIP_ULDAQ}" ]; then
git clone --branch v1.2.0 --depth 1 https://github.com/mccdaq/uldaq
pushd uldaq
autoreconf -i
2020-06-07 01:38:05 +02:00
./configure --enable-examples=no ${CONFIGURE_OPTS}
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
else
make dist
cp fedora/uldaq_ldconfig.patch libuldaq-1.1.2.tar.gz ~/rpmbuild/SOURCES
rpmbuild -ba fedora/uldaq.spec
fi
popd
fi
# Build & Install comedilib
if ! pkg-config "comedilib >= 0.11.0" && \
[ -z "${SKIP_COMEDILIB}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch r0_12_0 --depth 1 https://github.com/Linux-Comedi/comedilib.git
pushd comedilib
./autogen.sh
2020-06-07 01:38:05 +02:00
./configure ${CONFIGURE_OPTS}
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
else
touch doc/pdf/comedilib.pdf # skip build of PDF which is broken..
make dist
2020-11-11 22:09:38 +01:00
cp comedilib-0.12.0.tar.gz ~/rpmbuild/SOURCES
rpmbuild -ba comedilib.spec
fi
popd
fi
# Build & Install libre
if ! pkg-config "libre >= 0.5.6" && \
[ -z "${SKIP_LIBRE}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch v0.6.1 --depth 1 https://github.com/creytiv/re.git
pushd re
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
else
tar --transform 's|^\.|re-0.6.1|' -czvf ~/rpmbuild/SOURCES/re-0.6.1.tar.gz .
rpmbuild -ba rpm/re.spec
fi
popd
fi
2020-06-06 23:04:17 +02:00
# Build & Install nanomsg
if ! pkg-config "nanomsg >= 1.0.0" && \
[ -z "${SKIP_NANOMSG}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch 1.1.5 --depth 1 https://github.com/nanomsg/nanomsg.git
2020-06-06 23:18:04 +02:00
mkdir -p nanomsg/build
pushd nanomsg/build
2020-06-07 01:03:26 +02:00
cmake ${CMAKE_OPTS} ..
2020-06-06 23:04:17 +02:00
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
2020-06-06 23:04:17 +02:00
fi
popd
fi
2020-06-13 16:08:24 +02:00
# Build & Install libxil
if ! pkg-config "libxil >= 1.0.0" && \
[ -z "${SKIP_LIBXIL}" ]; then
2020-12-04 13:55:22 +01:00
git clone --branch v0.1.0 --depth 1 https://git.rwth-aachen.de/acs/public/villas/fpga/libxil.git
2020-06-13 16:08:24 +02:00
mkdir -p libxil/build
pushd libxil/build
cmake ${CMAKE_OPTS} ..
if [ -z "${PACKAGE}" ]; then
2021-07-20 18:15:11 +02:00
make ${MAKE_OPTS} install
2020-06-13 16:08:24 +02:00
fi
popd
fi
# Build & Install hiredis
if ! pkg-config "hiredis>1.0.0" && \
[ -z "${SKIP_HIREDIS}" -a -z "${SKIP_REDIS}" ]; then
git clone --branch v1.0.0 --depth 1 https://github.com/redis/hiredis.git
mkdir -p hiredis/build
pushd hiredis/build
cmake -DDISABLE_TESTS=ON \
-DENABLE_SSL=ON \
${CMAKE_OPTS} ..
make ${MAKE_OPTS} ${TARGET}
popd
fi
# Build & Install redis++
if [ -z "${SKIP_REDISPP}" -a -z "${SKIP_REDIS}" ]; then
git clone --branch 1.2.3 --depth 1 https://github.com/sewenew/redis-plus-plus.git
mkdir -p redis-plus-plus/build
pushd redis-plus-plus/build
# Somehow redis++ fails to find the hiredis include path on Debian multiarch builds
REDISPP_CMAKE_OPTS+="-DCMAKE_CXX_FLAGS=-I/usr/local/include"
cmake -DREDIS_PLUS_PLUS_BUILD_STATIC=OFF \
-DREDIS_PLUS_PLUS_CXX_STANDARD=17 \
${REDISPP_CMAKE_OPTS} ${CMAKE_OPTS} ..
make ${MAKE_OPTS} ${TARGET} VERBOSE=1
popd
fi
# Build & Install Fmtlib
if ! pkg-config "fmt >= 6.1.2" && \
[ -z "${SKIP_FMTLIB}" ]; then
git clone --branch 6.1.2 --depth 1 --recursive https://github.com/fmtlib/fmt.git
mkdir -p fmt/build
pushd fmt/build
cmake -DBUILD_SHARED_LIBS=1 \
${CMAKE_OPTS} ..
make ${MAKE_OPTS} ${TARGET}
if [ -n "${PACKAGE}" ]; then
cp fmt/build/*.rpm rpms
fi
popd
fi
# Build & Install spdlog
if ! pkg-config "spdlog >= 1.8.2" && \
[ -z "${SKIP_SPDLOG}" ]; then
git clone --branch v1.8.2 --depth 1 --recursive https://github.com/gabime/spdlog.git
mkdir -p spdlog/build
pushd spdlog/build
cmake -DSPDLOG_FMT_EXTERNAL=ON \
-DSPDLOG_BUILD_BENCH=OFF \
-DSPDLOG_BUILD_SHARED=ON \
${CMAKE_OPTS} ..
make ${MAKE_OPTS} ${TARGET}
if [ -n "${PACKAGE}" ]; then
cp spdlog/build/*.rpm rpms
fi
popd
fi
# Build & Install libwebsockets
if ! pkg-config "libwebsockets >= 2.3.0" && \
[ -z "${SKIP_WEBSOCKETS}" ]; then
git clone --branch v4.0-stable --depth 1 https://libwebsockets.org/repo/libwebsockets
mkdir -p libwebsockets/build
pushd libwebsockets/build
cmake -DLWS_WITH_IPV6=ON \
-DLWS_WITHOUT_TESTAPPS=ON \
-DLWS_WITHOUT_EXTENSIONS=OFF \
-DLWS_WITH_SERVER_STATUS=ON \
${CMAKE_OPTS} ..
make ${MAKE_OPTS} ${TARGET}
popd
fi
if [ -n "${PACKAGE}" ]; then
cp ~/rpmbuild/RPMS/x86_64/*.rpm rpms
fi
popd
2020-06-07 01:38:05 +02:00
rm -rf ${DIR}
2020-06-07 01:03:26 +02:00
# Update linker cache
2021-08-03 15:37:19 -04:00
if [ -z "${PACKAGE}" -a -z "${SKIP_LDCONFIG}" ]; then
2020-06-07 01:38:05 +02:00
ldconfig
fi