From 8d70845d91e3a6397a2fffed8cebebbecf016061 Mon Sep 17 00:00:00 2001 From: Philipp Jungkamp Date: Thu, 6 Jul 2023 16:35:55 +0200 Subject: [PATCH 1/2] Improve deps.sh install selection Signed-off-by: Philipp Jungkamp --- packaging/deps.sh | 142 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 106 insertions(+), 36 deletions(-) diff --git a/packaging/deps.sh b/packaging/deps.sh index 12c82facd..c6d0cf706 100644 --- a/packaging/deps.sh +++ b/packaging/deps.sh @@ -1,28 +1,100 @@ #!/bin/bash +# any failed command aborts the script set -e +# using an undefined variable aborts the script +set -u + +# any failing program in a pipe aborts the script +set -o pipefail + +should_build() { + local id="$1" + local use="$2" + local requirement="${3:-optional}" + + case "$requirement" in + optional) ;; + required) ;; + *) + printf >&2 "ERROR: %s\n" \ + "invalid parameter '$2' for should_build. should be one of 'optional' and 'required', default is 'optional'" + exit 1 + ;; + esac + + local deps="${@:4}" + + if [[ -n "${DEPS_SCAN+x}" ]]; then + printf "%s" "$requirement dependendency $id should be installed $use." + [[ -n "${deps[*]}" ]] && printf "%s" " transitive dependencies: $deps" + printf "\n" + return 1 + fi + + if { [[ "${DEPS_SKIP:-}" == *"$id"* ]] || { [[ -n "${DEPS_INCLUDE+x}" ]] && [[ ! "$DEPS_INCLUDE" == *"$id"* ]]; }; } + then + printf "%s\n" "Skipping $requirement dependency '$id'" + return 1 + fi + + if [[ -z "${DEPS_NONINTERACTIVE+x}" ]] && [[ -t 1 ]]; then + printf "\n" + case "$(read -p "Do you wan't to install '$id' into '$PREFIX'? This is used $use. (y/N)")" in + y | Y) + printf "%s\n" "Installing '$id'" + return 0 + ;; + + *) + printf "%s\n" "Skipping '$id'" + return 1 + ;; + esac + fi + + return 0 +} + +# +# build configuration +# + +# use shallow git clones to speed up downloads +GIT_OPTS+=" --depth=1" + +# install destination PREFIX=${PREFIX:-/usr/local} + +# cross-compile TRIPLET=${TRIPLET:-$(gcc -dumpmachine)} ARCH=${ARCH:-$(uname -m)} -GIT_OPTS+=" --depth=1" -CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}" +# cmake CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}" +# autotools +CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}" + +# make MAKE_THREADS=${MAKE_THREADS:-$(nproc)} MAKE_OPTS+="--jobs=${MAKE_THREADS}" -PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:${PREFIX}/share/pkgconfig +# pkgconfig +PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-}${PKG_CONFIG_PATH:+:}${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:${PREFIX}/share/pkgconfig export PKG_CONFIG_PATH +# build in a temporary directory TMPDIR=$(mktemp -d) -pushd ${TMPDIR} + +printf "entering %s\n" "${TMPDIR}" +pushd ${TMPDIR} >/dev/null # Build & Install Criterion if ! pkg-config "criterion >= 2.4.1" && \ [ "${ARCH}" == "x86_64" ] && \ - [ -z "${SKIP_CRITERION}" ]; then + should_build "criterion" "for unit tests"; then git clone ${GIT_OPTS} --branch v2.3.3 --recursive https://github.com/Snaipe/Criterion mkdir -p Criterion/build pushd Criterion/build @@ -33,7 +105,7 @@ fi # Build & Install libjansson if ! pkg-config "jansson >= 2.13" && \ - [ -z "${SKIP_JANSSON}" ]; then + should_build "jansson" "for configuration parsing" "required"; then git clone ${GIT_OPTS} --branch v2.14 https://github.com/akheron/jansson pushd jansson autoreconf -i @@ -48,8 +120,8 @@ if ! ( pkg-config "lua >= 5.1" || \ pkg-config "lua53" || \ pkg-config "lua52" || \ pkg-config "lua51" || \ - [ -n "${RTLAB_ROOT}" -a -f "/usr/local/include/lua.h" ] \ - ) && [ -z "${SKIP_LUA}" ]; then + { [[ -n "${RTLAB_ROOT:+x}" ]] && [[ -f "/usr/local/include/lua.h" ]]; } \ + ) && should_build "lua" "for the lua hook"; then wget http://www.lua.org/ftp/lua-5.4.4.tar.gz -O - | tar -xz pushd lua-5.4.4 make ${MAKE_OPTS} MYCFLAGS=-fPIC linux @@ -59,7 +131,7 @@ fi # Build & Install mosquitto if ! pkg-config "libmosquitto >= 1.4.15" && \ - [ -z "${SKIP_LIBMOSQUITTO}" ]; then + should_build "mosquitto" "for the MQTT node"; then git clone ${GIT_OPTS} --branch v2.0.15 https://github.com/eclipse/mosquitto mkdir -p mosquitto/build pushd mosquitto/build @@ -74,7 +146,7 @@ fi # Build & Install rabbitmq-c if ! pkg-config "librabbitmq >= 0.13.0" && \ - [ -z "${SKIP_LIBRABBITMQ}" ]; then + should_build "rabbitmq" "for the AMQP node and VILLAScontroller"; then git clone ${GIT_OPTS} --branch v0.11.0 https://github.com/alanxz/rabbitmq-c mkdir -p rabbitmq-c/build pushd rabbitmq-c/build @@ -85,7 +157,7 @@ fi # Build & Install libzmq if ! pkg-config "libzmq >= 2.2.0" && \ - [ -z "${SKIP_LIBZMQ}" ]; then + should_build "zmq" "for the zeromq node"; then git clone ${GIT_OPTS} --branch v4.3.4 https://github.com/zeromq/libzmq mkdir -p libzmq/build pushd libzmq/build @@ -99,8 +171,8 @@ fi # Build & Install EtherLab if ! pkg-config "libethercat >= 1.5.2" && \ - [ -z "${SKIP_ETHERLAB}" ]; then - git clone ${GIT_OPTS} --branch stable-1.5 https://gitlab.com/etherlab.org/ethercat.git + should_build "ethercat" "for the ethercat node"; then + git clone ${GIT_OPTS} --branch stable-1.5 https://gitlab.com/etherlab.org/ethercat.git pushd ethercat ./bootstrap ./configure --enable-userlib=yes --enable-kernel=no ${CONFIGURE_OPTS} @@ -110,7 +182,7 @@ fi # Build & Install libiec61850 if ! pkg-config "libiec61850 >= 1.5.0" && \ - [ -z "${SKIP_LIBIEC61850}" ]; then + should_build "iec61850" "for the iec61850 node"; then git clone ${GIT_OPTS} --branch v1.5.1 https://github.com/mz-automation/libiec61850 mkdir -p libiec61850/build pushd libiec61850/build @@ -123,7 +195,7 @@ fi # Build & Install lib60870 if ! pkg-config "lib60870 >= 2.3.1" && \ - [ -z "${SKIP_LIB60870}" ]; then + should_build "iec60870" "for the iec60870 node"; then git clone ${GIT_OPTS} --branch v2.3.2 https://github.com/mz-automation/lib60870.git mkdir -p lib60870/build pushd lib60870/build @@ -136,7 +208,7 @@ fi # Build & Install librdkafka if ! pkg-config "rdkafka >= 1.5.0" && \ - [ -z "${SKIP_RDKAFKA}" ]; then + should_build "rdkafka" "for the kafka node"; then git clone ${GIT_OPTS} --branch v2.0.1 https://github.com/edenhill/librdkafka mkdir -p librdkafka/build pushd librdkafka/build @@ -151,7 +223,7 @@ fi # Build & Install Graphviz if ! ( pkg-config "libcgraph >= 2.30" && \ pkg-config "libgvc >= 2.30" \ - ) && [ -z "${SKIP_GRAPHVIZ}" ]; then + ) && should_build "graphviz" "for villas-graph"; then git clone ${GIT_OPTS} --branch 2.50.0 https://gitlab.com/graphviz/graphviz.git mkdir -p graphviz/build pushd graphviz/build @@ -162,7 +234,7 @@ fi # Build & Install uldaq if ! pkg-config "libuldaq >= 1.2.0" && \ - [ -z "${SKIP_ULDAQ}" ]; then + should_build "uldaq" "for the uldaq node"; then git clone ${GIT_OPTS} --branch v1.2.1 https://github.com/mccdaq/uldaq pushd uldaq autoreconf -i @@ -176,7 +248,7 @@ fi # Build & Install libnl3 if ! ( pkg-config "libnl-3.0 >= 3.2.25" && \ pkg-config "libnl-route-3.0 >= 3.2.25" \ - ) && [ -z "${SKIP_ULDAQ}" ]; then + ) && should_build "libnl" "for network emulation"; then git clone ${GIT_OPTS} --branch libnl3_7_0 https://github.com/thom311/libnl pushd libnl autoreconf -i @@ -189,7 +261,7 @@ fi # Build & Install libconfig if ! pkg-config "libconfig >= 1.4.9" && \ - [ -z "${SKIP_ULDAQ}" ]; then + should_build "libconfig" "for libconfig configuration syntax"; then git clone ${GIT_OPTS} --branch v1.7.3 https://github.com/hyperrealm/libconfig pushd libconfig autoreconf -i @@ -203,7 +275,7 @@ fi # Build & Install comedilib if ! pkg-config "comedilib >= 0.11.0" && \ - [ -z "${SKIP_COMEDILIB}" ]; then + should_build "comedi" "for the comedi node"; then git clone ${GIT_OPTS} --branch r0_12_0 https://github.com/Linux-Comedi/comedilib.git pushd comedilib ./autogen.sh @@ -216,7 +288,7 @@ fi # Build & Install libre if ! pkg-config "libre >= 2.9.0" && \ - [ -z "${SKIP_LIBRE}" ]; then + should_build "libre" "for the rtp node"; then git clone ${GIT_OPTS} --branch v2.9.0 https://github.com/baresip/re.git pushd re make ${MAKE_OPTS} install @@ -225,7 +297,7 @@ fi # Build & Install nanomsg if ! pkg-config "nanomsg >= 1.0.0" && \ - [ -z "${SKIP_NANOMSG}" ]; then + should_build "nanomsg" "for the nanomsg node"; then git clone ${GIT_OPTS} --branch 1.2 https://github.com/nanomsg/nanomsg.git mkdir -p nanomsg/build pushd nanomsg/build @@ -241,7 +313,7 @@ fi # Build & Install libxil if ! pkg-config "libxil >= 1.0.0" && \ - [ -z "${SKIP_LIBXIL}" ]; then + should_build "libxil" "for the fpga node"; then git clone ${GIT_OPTS} --branch master https://git.rwth-aachen.de/acs/public/villas/fpga/libxil.git mkdir -p libxil/build pushd libxil/build @@ -252,8 +324,7 @@ fi # Build & Install hiredis if ! pkg-config "hiredis >= 1.0.0" && \ - [ -z "${SKIP_HIREDIS}" ] && \ - [ -z "${SKIP_REDIS}" ]; then + should_build "hiredis" "for the redis node"; then git clone ${GIT_OPTS} --branch v1.1.0 https://github.com/redis/hiredis.git mkdir -p hiredis/build pushd hiredis/build @@ -266,8 +337,7 @@ fi # Build & Install redis++ if ! pkg-config "redis++ >= 1.2.3" && \ - [ -z "${SKIP_REDISPP}" ] && \ - [ -z "${SKIP_REDIS}" ]; then + should_build "redis++" "for the redis node"; then git clone ${GIT_OPTS} --branch 1.3.7 https://github.com/sewenew/redis-plus-plus.git mkdir -p redis-plus-plus/build pushd redis-plus-plus/build @@ -285,7 +355,7 @@ fi # Build & Install Fmtlib if ! pkg-config "fmt >= 6.1.2" && \ - [ -z "${SKIP_FMTLIB}" ]; then + should_build "fmt" "for logging" "required"; then git clone ${GIT_OPTS} --branch 6.1.2 --recursive https://github.com/fmtlib/fmt.git mkdir -p fmt/build pushd fmt/build @@ -298,7 +368,7 @@ fi # Build & Install spdlog if ! pkg-config "spdlog >= 1.8.2" && \ - [ -z "${SKIP_SPDLOG}" ]; then + should_build "spdlog" "for logging" "required"; then git clone ${GIT_OPTS} --branch v1.8.2 --recursive https://github.com/gabime/spdlog.git mkdir -p spdlog/build pushd spdlog/build @@ -313,7 +383,7 @@ fi # Build & Install libwebsockets if ! pkg-config "libwebsockets >= 4.3.0" && \ - [ -z "${SKIP_WEBSOCKETS}" ]; then + should_build "libwebsockets" "for the websocket node and VILLASweb" "required"; then git clone ${GIT_OPTS} --branch v4.3-stable https://github.com/warmcat/libwebsockets mkdir -p libwebsockets/build pushd libwebsockets/build @@ -326,8 +396,8 @@ if ! pkg-config "libwebsockets >= 4.3.0" && \ fi # Build & Install libdatachannel -if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST && \ - [ -z "${SKIP_LIBDATACHANNEL}" ]; then +if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST >/dev/null 2>/dev/null && \ + should_build "libdatachannel" "for the webrtc node"; then git clone ${GIT_OPTS} --branch v0.18.4 https://github.com/paullouisageneau/libdatachannel && pushd libdatachannel git submodule update --init --recursive --depth 1 mkdir build && pushd build @@ -338,17 +408,17 @@ if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX cmake -DNO_MEDIA=ON \ -DNO_WEBSOCKET=ON \ - ${CMAKE_DATACHANNEL_USE_NICE} \ + ${CMAKE_DATACHANNEL_USE_NICE-} \ ${CMAKE_OPTS} .. make ${MAKE_OPTS} install popd; popd fi -popd +popd >/dev/null rm -rf ${TMPDIR} # Update linker cache -if [ -z "${SKIP_LDCONFIG}" ]; then +if [ -z "${SKIP_LDCONFIG+x}${DEPS_SCAN+x}" ]; then ldconfig fi From 5adf593f186d5fb2cec2b39ef362565befe46e3e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 10 Jul 2023 10:09:30 +0200 Subject: [PATCH 2/2] Code-style cleanups to deps.sh script Signed-off-by: Steffen Vogel --- packaging/deps.sh | 87 +++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/packaging/deps.sh b/packaging/deps.sh index c6d0cf706..aad2ed70d 100644 --- a/packaging/deps.sh +++ b/packaging/deps.sh @@ -1,12 +1,12 @@ #!/bin/bash -# any failed command aborts the script +# Abort the script on any failed command set -e -# using an undefined variable aborts the script +# Abort the script using on undefined variables set -u -# any failing program in a pipe aborts the script +# Aborts the script on any failing program in a pipe set -o pipefail should_build() { @@ -14,12 +14,11 @@ should_build() { local use="$2" local requirement="${3:-optional}" - case "$requirement" in + case "${requirement}" in optional) ;; required) ;; *) - printf >&2 "ERROR: %s\n" \ - "invalid parameter '$2' for should_build. should be one of 'optional' and 'required', default is 'optional'" + echo >&2 "Error: invalid parameter '$2' for should_build. should be one of 'optional' and 'required', default is 'optional'" exit 1 ;; esac @@ -27,28 +26,28 @@ should_build() { local deps="${@:4}" if [[ -n "${DEPS_SCAN+x}" ]]; then - printf "%s" "$requirement dependendency $id should be installed $use." - [[ -n "${deps[*]}" ]] && printf "%s" " transitive dependencies: $deps" - printf "\n" + echo "${requirement} dependendency ${id} should be installed ${use}." + [[ -n "${deps[*]}" ]] && echo " transitive dependencies: ${deps}" + echo return 1 fi - if { [[ "${DEPS_SKIP:-}" == *"$id"* ]] || { [[ -n "${DEPS_INCLUDE+x}" ]] && [[ ! "$DEPS_INCLUDE" == *"$id"* ]]; }; } + if { [[ "${DEPS_SKIP:-}" == *"${id}"* ]] || { [[ -n "${DEPS_INCLUDE+x}" ]] && [[ ! "${DEPS_INCLUDE}" == *"${id}"* ]]; }; } then - printf "%s\n" "Skipping $requirement dependency '$id'" + echo "Skipping ${requirement} dependency '${id}'" return 1 fi if [[ -z "${DEPS_NONINTERACTIVE+x}" ]] && [[ -t 1 ]]; then - printf "\n" - case "$(read -p "Do you wan't to install '$id' into '$PREFIX'? This is used $use. (y/N)")" in + echo + case "$(read -p "Do you wan't to install '${id}' into '${PREFIX}'? This is used ${use}. (y/N)")" in y | Y) - printf "%s\n" "Installing '$id'" + echo "Installing '${id}'" return 0 ;; *) - printf "%s\n" "Skipping '$id'" + echo "Skipping '${id}'" return 1 ;; esac @@ -57,38 +56,36 @@ should_build() { return 0 } -# -# build configuration -# +## Build configuration -# use shallow git clones to speed up downloads +# Use shallow git clones to speed up downloads GIT_OPTS+=" --depth=1" -# install destination +# Install destination PREFIX=${PREFIX:-/usr/local} -# cross-compile +# Cross-compile TRIPLET=${TRIPLET:-$(gcc -dumpmachine)} ARCH=${ARCH:-$(uname -m)} -# cmake +# CMake CMAKE_OPTS+=" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${PREFIX}" -# autotools +# Autotools CONFIGURE_OPTS+=" --host=${TRIPLET} --prefix=${PREFIX}" -# make +# Make MAKE_THREADS=${MAKE_THREADS:-$(nproc)} MAKE_OPTS+="--jobs=${MAKE_THREADS}" -# pkgconfig +# pkg-config PKG_CONFIG_PATH=${PKG_CONFIG_PATH:-}${PKG_CONFIG_PATH:+:}${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:${PREFIX}/share/pkgconfig export PKG_CONFIG_PATH -# build in a temporary directory +# Build in a temporary directory TMPDIR=$(mktemp -d) -printf "entering %s\n" "${TMPDIR}" +echo "Entering ${TMPDIR}" pushd ${TMPDIR} >/dev/null # Build & Install Criterion @@ -131,7 +128,7 @@ fi # Build & Install mosquitto if ! pkg-config "libmosquitto >= 1.4.15" && \ - should_build "mosquitto" "for the MQTT node"; then + should_build "mosquitto" "for the MQTT node-type"; then git clone ${GIT_OPTS} --branch v2.0.15 https://github.com/eclipse/mosquitto mkdir -p mosquitto/build pushd mosquitto/build @@ -157,7 +154,7 @@ fi # Build & Install libzmq if ! pkg-config "libzmq >= 2.2.0" && \ - should_build "zmq" "for the zeromq node"; then + should_build "zmq" "for the zeromq node-type"; then git clone ${GIT_OPTS} --branch v4.3.4 https://github.com/zeromq/libzmq mkdir -p libzmq/build pushd libzmq/build @@ -171,7 +168,7 @@ fi # Build & Install EtherLab if ! pkg-config "libethercat >= 1.5.2" && \ - should_build "ethercat" "for the ethercat node"; then + should_build "ethercat" "for the ethercat node-type"; then git clone ${GIT_OPTS} --branch stable-1.5 https://gitlab.com/etherlab.org/ethercat.git pushd ethercat ./bootstrap @@ -182,7 +179,7 @@ fi # Build & Install libiec61850 if ! pkg-config "libiec61850 >= 1.5.0" && \ - should_build "iec61850" "for the iec61850 node"; then + should_build "iec61850" "for the iec61850 node-type"; then git clone ${GIT_OPTS} --branch v1.5.1 https://github.com/mz-automation/libiec61850 mkdir -p libiec61850/build pushd libiec61850/build @@ -195,7 +192,7 @@ fi # Build & Install lib60870 if ! pkg-config "lib60870 >= 2.3.1" && \ - should_build "iec60870" "for the iec60870 node"; then + should_build "iec60870" "for the iec60870 node-type"; then git clone ${GIT_OPTS} --branch v2.3.2 https://github.com/mz-automation/lib60870.git mkdir -p lib60870/build pushd lib60870/build @@ -208,7 +205,7 @@ fi # Build & Install librdkafka if ! pkg-config "rdkafka >= 1.5.0" && \ - should_build "rdkafka" "for the kafka node"; then + should_build "rdkafka" "for the kafka node-type"; then git clone ${GIT_OPTS} --branch v2.0.1 https://github.com/edenhill/librdkafka mkdir -p librdkafka/build pushd librdkafka/build @@ -234,7 +231,7 @@ fi # Build & Install uldaq if ! pkg-config "libuldaq >= 1.2.0" && \ - should_build "uldaq" "for the uldaq node"; then + should_build "uldaq" "for the uldaq node-type"; then git clone ${GIT_OPTS} --branch v1.2.1 https://github.com/mccdaq/uldaq pushd uldaq autoreconf -i @@ -275,7 +272,7 @@ fi # Build & Install comedilib if ! pkg-config "comedilib >= 0.11.0" && \ - should_build "comedi" "for the comedi node"; then + should_build "comedi" "for the comedi node-type"; then git clone ${GIT_OPTS} --branch r0_12_0 https://github.com/Linux-Comedi/comedilib.git pushd comedilib ./autogen.sh @@ -288,7 +285,7 @@ fi # Build & Install libre if ! pkg-config "libre >= 2.9.0" && \ - should_build "libre" "for the rtp node"; then + should_build "libre" "for the rtp node-type"; then git clone ${GIT_OPTS} --branch v2.9.0 https://github.com/baresip/re.git pushd re make ${MAKE_OPTS} install @@ -297,7 +294,7 @@ fi # Build & Install nanomsg if ! pkg-config "nanomsg >= 1.0.0" && \ - should_build "nanomsg" "for the nanomsg node"; then + should_build "nanomsg" "for the nanomsg node-type"; then git clone ${GIT_OPTS} --branch 1.2 https://github.com/nanomsg/nanomsg.git mkdir -p nanomsg/build pushd nanomsg/build @@ -313,7 +310,7 @@ fi # Build & Install libxil if ! pkg-config "libxil >= 1.0.0" && \ - should_build "libxil" "for the fpga node"; then + should_build "libxil" "for the fpga node-type"; then git clone ${GIT_OPTS} --branch master https://git.rwth-aachen.de/acs/public/villas/fpga/libxil.git mkdir -p libxil/build pushd libxil/build @@ -324,7 +321,7 @@ fi # Build & Install hiredis if ! pkg-config "hiredis >= 1.0.0" && \ - should_build "hiredis" "for the redis node"; then + should_build "hiredis" "for the redis node-type"; then git clone ${GIT_OPTS} --branch v1.1.0 https://github.com/redis/hiredis.git mkdir -p hiredis/build pushd hiredis/build @@ -337,7 +334,7 @@ fi # Build & Install redis++ if ! pkg-config "redis++ >= 1.2.3" && \ - should_build "redis++" "for the redis node"; then + should_build "redis++" "for the redis node-type"; then git clone ${GIT_OPTS} --branch 1.3.7 https://github.com/sewenew/redis-plus-plus.git mkdir -p redis-plus-plus/build pushd redis-plus-plus/build @@ -397,10 +394,10 @@ fi # Build & Install libdatachannel if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX -DMODE=EXIST >/dev/null 2>/dev/null && \ - should_build "libdatachannel" "for the webrtc node"; then - git clone ${GIT_OPTS} --branch v0.18.4 https://github.com/paullouisageneau/libdatachannel && pushd libdatachannel - git submodule update --init --recursive --depth 1 - mkdir build && pushd build + should_build "libdatachannel" "for the webrtc node-type"; then + git clone ${GIT_OPTS} --recursive --branch v0.18.4 https://github.com/paullouisageneau/libdatachannel + mkdir -p libdatachannel/build + pushd libdatachannel/build if pkg-config "nice >= 0.1.16"; then CMAKE_DATACHANNEL_USE_NICE=-DUSE_NICE=ON @@ -412,7 +409,7 @@ if ! cmake --find-package -DNAME=LibDataChannel -DCOMPILER_ID=GNU -DLANGUAGE=CXX ${CMAKE_OPTS} .. make ${MAKE_OPTS} install - popd; popd + popd fi popd >/dev/null