2020-05-05 23:35:09 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-05-11 12:50:15 +02:00
|
|
|
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
|
|
|
|
2020-12-04 13:55:22 +01:00
|
|
|
git config --global http.postBuffer 524288000
|
|
|
|
git config --global core.compression 0
|
|
|
|
|
2020-05-11 12:50:15 +02:00
|
|
|
if [ -n "${PACKAGE}" ]; then
|
|
|
|
TARGET="package"
|
2020-06-07 01:03:26 +02:00
|
|
|
CMAKE_OPTS+=" -DCPACK_GENERATOR=RPM"
|
2020-05-11 12:50:15 +02:00
|
|
|
|
|
|
|
# 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}
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install Criterion
|
2020-06-07 01:38:05 +02:00
|
|
|
if ! pkg-config "criterion >= 2.3.1" && \
|
2020-11-12 00:17:43 +01:00
|
|
|
[ "${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
|
2020-06-02 23:48:42 +02:00
|
|
|
mkdir -p Criterion/build
|
|
|
|
pushd Criterion/build
|
2020-06-07 01:03:26 +02:00
|
|
|
cmake ${CMAKE_OPTS} ..
|
2020-06-02 23:48:42 +02:00
|
|
|
if [ -z "${PACKAGE}" ]; then
|
|
|
|
make -j$(nproc) install
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install EtherLab
|
2020-12-04 13:37:09 +01:00
|
|
|
if [ -z "${SKIP_ETHERLAB}" ]; then
|
2020-11-12 00:17:43 +01:00
|
|
|
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
|
|
|
|
make -j$(nproc) 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
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install Fmtlib
|
2020-12-04 13:37:09 +01:00
|
|
|
if ! pkg-config "fmt >= 6.1.2" && \
|
|
|
|
[ -z "${SKIP_FMTLIB}" ]; then
|
2020-12-04 13:55:22 +01:00
|
|
|
git clone --branch 6.1.2 --depth 1 --recursive https://github.com/fmtlib/fmt.git
|
2020-06-06 22:59:32 +02:00
|
|
|
mkdir -p fmt/build
|
|
|
|
pushd fmt/build
|
2021-01-08 19:59:36 +01:00
|
|
|
cmake -DBUILD_SHARED_LIBS=1 \
|
|
|
|
${CMAKE_OPTS} ..
|
2020-06-06 22:59:32 +02:00
|
|
|
make -j$(nproc) ${TARGET}
|
|
|
|
if [ -n "${PACKAGE}" ]; then
|
|
|
|
cp fmt/build/*.rpm rpms
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install spdlog
|
2021-02-16 14:15:14 +01:00
|
|
|
if ! pkg-config "spdlog >= 1.8.2" && \
|
2020-12-04 13:37:09 +01:00
|
|
|
[ -z "${SKIP_SPDLOG}" ]; then
|
2021-02-16 14:15:14 +01:00
|
|
|
git clone --branch v1.8.2 --depth 1 --recursive https://github.com/gabime/spdlog.git
|
2020-06-06 22:59:32 +02:00
|
|
|
mkdir -p spdlog/build
|
|
|
|
pushd spdlog/build
|
2021-01-08 19:59:36 +01:00
|
|
|
cmake -DSPDLOG_FMT_EXTERNAL=ON \
|
|
|
|
-DSPDLOG_BUILD_BENCH=OFF \
|
|
|
|
-DSPDLOG_BUILD_SHARED=ON \
|
|
|
|
${CMAKE_OPTS} ..
|
2020-06-06 22:59:32 +02:00
|
|
|
make -j$(nproc) ${TARGET}
|
|
|
|
if [ -n "${PACKAGE}" ]; then
|
|
|
|
cp spdlog/build/*.rpm rpms
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install libiec61850
|
2020-12-04 13:37:09 +01:00
|
|
|
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
|
2020-06-06 22:59:32 +02:00
|
|
|
mkdir -p libiec61850/build
|
|
|
|
pushd libiec61850/build
|
2020-06-07 01:03:26 +02:00
|
|
|
cmake ${CMAKE_OPTS} ..
|
2020-06-06 22:59:32 +02:00
|
|
|
make -j$(nproc) ${TARGET}
|
|
|
|
if [ -n "${PACKAGE}" ]; then
|
|
|
|
cp libiec61850/build/*.rpm rpms
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
2020-06-06 22:04:29 +02:00
|
|
|
# Build & Install libwebsockets
|
2020-12-04 13:37:09 +01:00
|
|
|
if ! pkg-config "libwebsockets >= 2.3.0" && \
|
|
|
|
[ -z "${SKIP_WEBSOCKETS}" ]; then
|
2020-12-04 13:55:22 +01:00
|
|
|
git clone --branch v4.0-stable --depth 1 https://libwebsockets.org/repo/libwebsockets
|
2020-06-06 22:59:32 +02:00
|
|
|
mkdir -p libwebsockets/build
|
|
|
|
pushd libwebsockets/build
|
2021-01-08 19:59:36 +01:00
|
|
|
cmake -DLWS_WITH_IPV6=ON \
|
|
|
|
-DLWS_WITHOUT_TESTAPPS=ON \
|
|
|
|
-DLWS_WITHOUT_EXTENSIONS=OFF \
|
|
|
|
-DLWS_WITH_SERVER_STATUS=ON \
|
|
|
|
${CMAKE_OPTS} ..
|
2020-06-06 22:59:32 +02:00
|
|
|
make -j$(nproc) ${TARGET}
|
|
|
|
popd
|
|
|
|
fi
|
2020-06-06 22:04:29 +02:00
|
|
|
|
2020-05-05 23:35:09 +02:00
|
|
|
# Build & Install uldaq
|
2020-06-07 01:38:05 +02:00
|
|
|
if ! pkg-config "libuldaq >= 1.0.0" && \
|
2020-12-04 13:37:09 +01:00
|
|
|
[ "${DISTRO}" != "debian-multiarch" ] && \
|
|
|
|
[ -z "${SKIP_ULDAQ}" ]; then
|
2020-12-04 13:55:22 +01:00
|
|
|
git clone --branch rpmbuild --depth 1 https://github.com/stv0g/uldaq
|
2020-06-06 22:59:32 +02:00
|
|
|
pushd uldaq
|
|
|
|
autoreconf -i
|
2020-06-07 01:38:05 +02:00
|
|
|
./configure --enable-examples=no ${CONFIGURE_OPTS}
|
2020-06-06 22:59:32 +02:00
|
|
|
if [ -z "${PACKAGE}" ]; then
|
|
|
|
make -j$(nproc) install
|
|
|
|
else
|
|
|
|
make dist
|
|
|
|
cp fedora/uldaq_ldconfig.patch libuldaq-1.1.2.tar.gz ~/rpmbuild/SOURCES
|
|
|
|
rpmbuild -ba fedora/uldaq.spec
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install comedilib
|
2020-12-04 13:37:09 +01:00
|
|
|
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
|
2020-06-06 22:59:32 +02:00
|
|
|
pushd comedilib
|
|
|
|
./autogen.sh
|
2020-06-07 01:38:05 +02:00
|
|
|
./configure ${CONFIGURE_OPTS}
|
2020-06-06 22:59:32 +02:00
|
|
|
if [ -z "${PACKAGE}" ]; then
|
|
|
|
make -j$(nproc) 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
|
2020-06-06 22:59:32 +02:00
|
|
|
rpmbuild -ba comedilib.spec
|
|
|
|
fi
|
|
|
|
popd
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
|
|
|
# Build & Install libre
|
2020-11-12 00:17:43 +01:00
|
|
|
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
|
2020-06-06 22:59:32 +02:00
|
|
|
pushd re
|
|
|
|
if [ -z "${PACKAGE}" ]; then
|
|
|
|
make -j$(nproc) 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
|
2020-05-11 12:50:15 +02:00
|
|
|
fi
|
2020-05-05 23:35:09 +02:00
|
|
|
|
2020-06-06 23:04:17 +02:00
|
|
|
# Build & Install nanomsg
|
2020-12-04 13:37:09 +01:00
|
|
|
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
|
|
|
|
make -j$(nproc) install
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2020-06-13 16:08:24 +02:00
|
|
|
# Build & Install libxil
|
2020-12-04 13:37:09 +01:00
|
|
|
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
|
|
|
|
make -j$(nproc) install
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
2020-05-11 12:50:15 +02:00
|
|
|
if [ -n "${PACKAGE}" ]; then
|
|
|
|
cp ~/rpmbuild/RPMS/x86_64/*.rpm rpms
|
|
|
|
fi
|
|
|
|
|
2020-06-02 23:48:42 +02:00
|
|
|
popd
|
2020-06-07 01:38:05 +02:00
|
|
|
rm -rf ${DIR}
|
2020-06-07 01:03:26 +02:00
|
|
|
|
|
|
|
# Update linker cache
|
2020-06-07 01:38:05 +02:00
|
|
|
if [ -z "${PACKAGE}" ]; then
|
|
|
|
ldconfig
|
|
|
|
fi
|