diff --git a/packaging/deps.sh b/packaging/deps.sh index 52f1548aa..2dc84f20a 100644 --- a/packaging/deps.sh +++ b/packaging/deps.sh @@ -1,5 +1,23 @@ #!/bin/bash +set -e + +if [ -n "${PACKAGE}" ]; then + TARGET="package" + 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 + +rm -rf thirdparty mkdir -p thirdparty pushd thirdparty @@ -9,15 +27,23 @@ mkdir -p Criterion/build pushd Criterion/build git checkout v2.3.3 cmake -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 .. -make -j$(nproc) install +if [ -z "${PACKAGE}" ]; then + make -j$(nproc) install +fi popd # Build & Install EtherLab 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 --enable-tool=no -make -j$(nproc) install +./configure --enable-userlib=yes --enable-kernel=no +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 # Build & Install Fmtlib @@ -25,8 +51,11 @@ git clone --recursive https://github.com/fmtlib/fmt.git mkdir -p fmt/build pushd fmt/build git checkout 5.2.0 -cmake3 -DBUILD_SHARED_LIBS=1 .. -make -j$(nproc) install +cmake -DBUILD_SHARED_LIBS=1 ${CMAKE_OPTS} .. +make -j$(nproc) ${TARGET} +if [ -n "${PACKAGE}" ]; then + cp fmt/build/*.rpm rpms +fi popd # Build & Install spdlog @@ -34,32 +63,38 @@ git clone --recursive https://github.com/gabime/spdlog.git mkdir -p spdlog/build pushd spdlog/build git checkout v1.3.1 -cmake3 -DCMAKE_BUILD_TYPE=Release -DSPDLOG_FMT_EXTERNAL=1 -DSPDLOG_BUILD_BENCH=OFF .. -make -j$(nproc) install +cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_FMT_EXTERNAL=1 -DSPDLOG_BUILD_BENCH=OFF ${CMAKE_OPTS} .. +make -j$(nproc) ${TARGET} +if [ -n "${PACKAGE}" ]; then + cp spdlog/build/*.rpm rpms +fi popd # Build & Install libiec61850 -git clone -b v1.3.1 https://github.com/mz-automation/libiec61850 +git clone https://github.com/mz-automation/libiec61850 mkdir -p libiec61850/build pushd libiec61850/build -cmake3 -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 .. -make -j$(nproc) install +git checkout v1.3.1 +cmake -DCMAKE_INSTALL_LIBDIR=/usr/local/lib64 ${CMAKE_OPTS} .. +make -j$(nproc) ${TARGET} +if [ -n "${PACKAGE}" ]; then + cp libiec61850/build/*.rpm rpms +fi popd # Build & Install uldaq -git clone -b rpm https://github.com/stv0g/uldaq +git clone https://github.com/stv0g/uldaq pushd uldaq +git checkout rpmbuild autoreconf -i ./configure --enable-examples=no -make -j$(nproc) install -popd - -# Build & Install EtherLab -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 --enable-tool=no -make -j$(nproc) install +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 # Build & Install comedilib @@ -68,14 +103,30 @@ pushd comedilib git checkout r0_11_0 ./autogen.sh ./configure -make -j$(nproc) install +if [ -z "${PACKAGE}" ]; then + make -j$(nproc) install +else + touch doc/pdf/comedilib.pdf # skip build of PDF which is broken.. + make dist + cp comedilib-0.11.0.tar.gz ~/rpmbuild/SOURCES + rpmbuild -ba comedilib.spec +fi popd # Build & Install libre git clone https://github.com/creytiv/re.git pushd re git checkout v0.6.1 -make -j$(nproc) install +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 +if [ -n "${PACKAGE}" ]; then + cp ~/rpmbuild/RPMS/x86_64/*.rpm rpms +fi + popd \ No newline at end of file