diff options
author | James Mills <prologic@shortcircuit.net.au> | 2020-08-06 13:09:29 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 13:09:29 +1000 |
commit | 79c56b71c4567ce947e755b5fbe6d0b4eeffd046 (patch) | |
tree | a0e2d365569b05020f076bd0d3549eb4b477acf7 /packaging | |
parent | 921f9f040c717912330099bf826be1ac0626e9bd (diff) |
Fix Static Netdata to correctly build with Netdata Cloud support. (#9381)
* Revert "Revert "Override linker and include paths for static builds. (#9311)" (#9343)"
This reverts commit 36d5e40dca91a93963e4d96f07af3e38803615d0.
* Run git clean before building anything
* Fix checking out openssl and skip if bind-mounted sources already exist at the given path
* Add --require-cloud flag to the static build scripts
* Add CMAKEFLAGS support to the installer to customize how to build libwebsockets for static builds
* Update packaging/makeself/jobs/50-bash-4.4.18.install.sh
Co-authored-by: Andrew Moss <1043609+amoss@users.noreply.github.com>
* Fix remaining other two tyos
Co-authored-by: Andrew Moss <1043609+amoss@users.noreply.github.com>
Diffstat (limited to 'packaging')
-rwxr-xr-x | packaging/makeself/install-alpine-packages.sh | 2 | ||||
-rwxr-xr-x | packaging/makeself/jobs/20-openssl.install.sh | 5 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-bash-4.4.18.install.sh | 2 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-curl-7.60.0.install.sh | 5 | ||||
-rwxr-xr-x | packaging/makeself/jobs/50-fping-4.2.install.sh | 5 | ||||
-rwxr-xr-x | packaging/makeself/jobs/70-netdata-git.install.sh | 16 |
6 files changed, 23 insertions, 12 deletions
diff --git a/packaging/makeself/install-alpine-packages.sh b/packaging/makeself/install-alpine-packages.sh index 34162804e3..dffbaac82e 100755 --- a/packaging/makeself/install-alpine-packages.sh +++ b/packaging/makeself/install-alpine-packages.sh @@ -24,14 +24,12 @@ apk add --no-cache -U \ libtool \ pkgconfig \ util-linux-dev \ - openssl-dev \ gnutls-dev \ zlib-dev \ libmnl-dev \ libnetfilter_acct-dev \ libuv-dev \ lz4-dev \ - openssl-dev \ snappy-dev \ protobuf-dev \ binutils \ diff --git a/packaging/makeself/jobs/20-openssl.install.sh b/packaging/makeself/jobs/20-openssl.install.sh index 0d99092dee..10863f90f2 100755 --- a/packaging/makeself/jobs/20-openssl.install.sh +++ b/packaging/makeself/jobs/20-openssl.install.sh @@ -9,7 +9,10 @@ version="$(cat "$(dirname "${0}")/../openssl.version")" export LDFLAGS='-static' export PKG_CONFIG="pkg-config --static" -run git clone --branch "${version}" --single-branch git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl" +# Might be bind-mounted +if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then + run git clone --branch "${version}" --single-branch git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl" +fi cd "${NETDATA_MAKESELF_PATH}/tmp/openssl" || exit 1 run ./config no-shared no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl diff --git a/packaging/makeself/jobs/50-bash-4.4.18.install.sh b/packaging/makeself/jobs/50-bash-4.4.18.install.sh index f40ad333bb..b9b139680e 100755 --- a/packaging/makeself/jobs/50-bash-4.4.18.install.sh +++ b/packaging/makeself/jobs/50-bash-4.4.18.install.sh @@ -6,7 +6,7 @@ fetch "bash-4.4.18" "http://ftp.gnu.org/gnu/bash/bash-4.4.18.tar.gz" -export PKG_CONFIG_PATH="/opnessl/lib/pkgconfig" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" run ./configure \ --prefix="${NETDATA_INSTALL_PATH}" \ diff --git a/packaging/makeself/jobs/50-curl-7.60.0.install.sh b/packaging/makeself/jobs/50-curl-7.60.0.install.sh index f55829b5b8..19707ae5e7 100755 --- a/packaging/makeself/jobs/50-curl-7.60.0.install.sh +++ b/packaging/makeself/jobs/50-curl-7.60.0.install.sh @@ -6,9 +6,10 @@ fetch "curl-curl-7_60_0" "https://github.com/curl/curl/archive/curl-7_60_0.tar.gz" -export LDFLAGS="-static" +export CFLAGS="-I/openssl-static/include" +export LDFLAGS="-static -L/openssl-static/lib" export PKG_CONFIG="pkg-config --static" -export PKG_CONFIG_PATH="/opnessl/lib/pkgconfig" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" run ./buildconf diff --git a/packaging/makeself/jobs/50-fping-4.2.install.sh b/packaging/makeself/jobs/50-fping-4.2.install.sh index e9212c8db7..04766bc4a8 100755 --- a/packaging/makeself/jobs/50-fping-4.2.install.sh +++ b/packaging/makeself/jobs/50-fping-4.2.install.sh @@ -6,8 +6,9 @@ fetch "fping-4.2" "https://github.com/schweikert/fping/releases/download/v4.2/fping-4.2.tar.gz" -export CFLAGS="-static" -export PKG_CONFIG_PATH="/opnessl/lib/pkgconfig" +export CFLAGS="-static -I/openssl-static/include" +export LDFLAGS="-static -L/openssl-static/lib" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" run ./configure \ --prefix="${NETDATA_INSTALL_PATH}" \ diff --git a/packaging/makeself/jobs/70-netdata-git.install.sh b/packaging/makeself/jobs/70-netdata-git.install.sh index 6a1bedcc33..21d4fd0ac3 100755 --- a/packaging/makeself/jobs/70-netdata-git.install.sh +++ b/packaging/makeself/jobs/70-netdata-git.install.sh @@ -7,23 +7,31 @@ cd "${NETDATA_SOURCE_PATH}" || exit 1 if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then - export CFLAGS="-static -O3" + export CFLAGS="-static -O3 -I/openssl-static/include" else - export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1" + export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include" fi +export LDFLAGS="-static -L/openssl-static/lib" + # We export this to 'yes', installer sets this to .environment. # The updater consumes this one, so that it can tell whether it should update a static install or a non-static one export IS_NETDATA_STATIC_BINARY="yes" # Set eBPF LIBC to "static" to bundle the `-static` variant of the kernel-collector export EBPF_LIBC="static" -export PKG_CONFIG_PATH="/opnessl/lib/pkgconfig" +export PKG_CONFIG_PATH="/openssl-static/lib/pkgconfig" + +# Set correct CMake flags for building against non-System OpenSSL +# See: https://github.com/warmcat/libwebsockets/blob/master/READMEs/README.build.md +export CMAKE_FLAGS="-DOPENSSL_ROOT_DIR=/openssl-static -DOPENSSL_LIBRARIES=/openssl-static/lib -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/openssl-static -DLWS_OPENSSL_INCLUDE_DIRS=/openssl-static/include -DLWS_OPENSSL_LIBRARIES=/openssl-static/lib/libssl.a;/openssl-static/lib/libcrypto.a" run ./netdata-installer.sh \ --install "${NETDATA_INSTALL_PARENT}" \ --dont-wait \ - --dont-start-it + --dont-start-it \ + --require-cloud \ + --dont-scrub-cflags-even-though-it-may-break-things # Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin. run rm -f "${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf" |