Added static builds for ARMv7l and ARMv8a (#11490)
* Generic fixes for cross-arch static image builds. * Fixed handling of ARM static builds. * Add ARMv7l and ARMv8a static builds. * Fix static build deps. * Fix static build checks. * Bump OpenSSL version and optimize OpenSSL build. * Optimize bash build. * Bump cURL version and optimize cURL build. * Fix static build deps. * Fix bash build. * Further build fixes. * Fix cURL build. * Fix emulation handling.
Austin S. Hemmelgarn committed
Oct 12, 2021 at 07:58 UTC
f49103aa8a04f451c670efb970687f0bf6bdbfd3
12 files changed
+54
-30
.github/scripts/build-static.sh
+1
-1
@@ -10,7 +10,7 @@ set -e
10
BUILDARCH="${1}"
11
NAME="${NAME:-netdata}"
12
VERSION="${VERSION:-"$(git describe)"}"
13
-BASENAME="$NAME-$VERSION"
13
+BASENAME="$NAME-$BUILDARCH-$VERSION"
14
15
prepare_build() {
16
progress "Preparing build"
.github/workflows/build-and-install.yml
+3
-1
@@ -14,7 +14,9 @@ jobs:
14
strategy:
15
matrix:
16
arch:
17
- - 'x86_64'
17
+ - x86_64
18
+ - armv7l
19
+ - aarch64
20
steps:
21
- name: Git clone repository
22
uses: actions/checkout@v2
.travis/create_artifacts.sh
+1
-1
@@ -52,7 +52,7 @@ make dist
52
mv "${BASENAME}.tar.gz" artifacts/
53
54
echo "--- Create self-extractor ---"
55
-sxarches="x86_64"
55
+sxarches="x86_64 armv7l aarch64"
56
for arch in ${sxarches}; do
57
git clean -d -f
58
rm -rf packating/makeself/tmp
netdata-installer.sh
+1
-1
@@ -1048,7 +1048,7 @@ fi
1048
if [ -d ./.git ] ; then
1049
echo >&2
1050
progress "Updating tags in git to ensure a consistent version number"
1051
- run git fetch <remote> 'refs/tags/*:refs/tags/*' || true
1051
+ run git fetch -t || true
1052
fi
1053
1054
# -----------------------------------------------------------------------------
packaging/makeself/build-static.sh
+6
-3
@@ -11,7 +11,7 @@ set -e
11
12
case ${BUILDARCH} in
13
x86_64) platform=linux/amd64 ;;
14
- arm7) platform=linux/arm/v7 ;;
14
+ armv7l) platform=linux/arm/v7 ;;
15
aarch64) platform=linux/arm64/v8 ;;
16
*)
17
echo "Unknown target architecture '${BUILDARCH}'."
@@ -21,7 +21,7 @@ esac
21
22
DOCKER_CONTAINER_NAME="netdata-package-${BUILDARCH}-static-alpine312"
23
24
-if [ "${BUILDARCH}" != "x86_64" ]; then
24
+if [ "${BUILDARCH}" != "$(uname -m)" ]; then
25
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes || exit 1
26
fi
27
@@ -39,7 +39,10 @@ if ! docker inspect "${DOCKER_CONTAINER_NAME}" > /dev/null 2>&1; then
39
# inside the container and runs the script install-alpine-packages.sh
40
# (also inside the container)
41
#
42
- run docker pull alpine:3.12
42
+ if docker inspect alpine:3.12 > dev/null 2>&1; then
43
+ run docker image remove alpine:3.12
44
+ run docker pull --platform=${platform} alpine:3.12
45
+ fi
46
47
run docker run --platform=${platform} -v "$(pwd)":/usr/src/netdata.git:rw alpine:3.12 \
48
/bin/sh /usr/src/netdata.git/packaging/makeself/install-alpine-packages.sh
packaging/makeself/build.sh
+4
@@ -38,6 +38,8 @@ if [ ! -f ../../netdata-installer.sh ]; then
38
exit $?
39
fi
40
41
+git clean -dxf
42
+
43
cat >&2 << EOF
44
This program will create a self-extracting shell package containing
45
a statically linked netdata, able to run on any 64bit Linux system,
@@ -49,6 +51,8 @@ EOF
51
52
if [ ! -d tmp ]; then
53
mkdir tmp || exit 1
54
+else
55
+ rm -rf tmp/*
56
fi
57
58
if ! ./run-all-jobs.sh "$@"; then
packaging/makeself/install-alpine-packages.sh
+19
-17
@@ -9,35 +9,37 @@
9
10
# Add required APK packages
11
apk add --no-cache -U \
12
- bash \
13
- wget \
14
- curl \
15
- ncurses \
16
- git \
17
- netcat-openbsd \
12
alpine-sdk \
13
autoconf \
14
automake \
21
- gcc \
22
- make \
15
+ bash \
16
+ binutils \
17
cmake \
24
- libtool \
25
- pkgconfig \
26
- util-linux-dev \
18
+ curl \
19
+ gcc \
20
+ git \
21
gnutls-dev \
28
- zlib-dev \
29
- zlib-static \
22
+ gzip \
23
libmnl-dev \
24
libnetfilter_acct-dev \
25
+ libtool \
26
libuv-dev \
27
libuv-static \
28
lz4-dev \
29
lz4-static \
36
- snappy-dev \
30
+ make \
31
+ ncurses \
32
+ netcat-openbsd \
33
+ openssh \
34
+ pkgconfig \
35
protobuf-dev \
38
- binutils \
39
- gzip \
40
- xz || exit 1
36
+ snappy-dev \
37
+ util-linux-dev \
38
+ wget \
39
+ xz \
40
+ zlib-dev \
41
+ zlib-static ||
42
+ exit 1
43
44
# snappy doesn't have static version in alpine, let's compile it
45
export SNAPPY_VER="1.1.7"
packaging/makeself/jobs/20-openssl.install.sh
+3
-2
@@ -6,15 +6,16 @@
6
7
version="$(cat "$(dirname "${0}")/../openssl.version")"
8
9
+export CFLAGS='-fno-lto'
10
export LDFLAGS='-static'
11
export PKG_CONFIG="pkg-config --static"
12
13
# Might be bind-mounted
14
if [ ! -d "${NETDATA_MAKESELF_PATH}/tmp/openssl" ]; then
14
- run git clone --branch "${version}" --single-branch git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl"
15
+ run git clone --branch "${version}" --single-branch --depth 1 git://git.openssl.org/openssl.git "${NETDATA_MAKESELF_PATH}/tmp/openssl"
16
fi
17
cd "${NETDATA_MAKESELF_PATH}/tmp/openssl" || exit 1
18
18
-run ./config no-shared no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
19
+run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
20
run make -j "$(nproc)"
21
run make -j "$(nproc)" install_sw
packaging/makeself/jobs/50-bash-5.0.install.sh
+1
@@ -14,6 +14,7 @@ run ./configure \
14
--enable-static-link \
15
--enable-net-redirections \
16
--enable-array-variables \
17
+ --disable-progcomp \
18
--disable-profiling \
19
--disable-nls
20
packaging/makeself/jobs/50-curl-7.78.0.install.sh
renamed
+13
-2
@@ -4,7 +4,7 @@
4
# shellcheck source=packaging/makeself/functions.sh
5
. "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
6
7
-fetch "curl-7.73.0" "https://curl.haxx.se/download/curl-7.73.0.tar.gz"
7
+fetch "curl-7.78.0" "https://curl.haxx.se/download/curl-7.78.0.tar.gz"
8
9
export CFLAGS="-I/openssl-static/include"
10
export LDFLAGS="-static -L/openssl-static/lib"
@@ -19,10 +19,21 @@ run ./configure \
19
--disable-shared \
20
--enable-static \
21
--enable-http \
22
+ --disable-ldap \
23
+ --disable-ldaps \
24
--enable-proxy \
25
+ --disable-dict \
26
+ --disable-telnet \
27
+ --disable-tftp \
28
+ --disable-pop3 \
29
+ --disable-imap \
30
+ --disable-smb \
31
+ --disable-smtp \
32
+ --disable-gopher \
33
--enable-ipv6 \
34
--enable-cookies \
25
- --with-ca-fallback
35
+ --with-ca-fallback \
36
+ --with-openssl
37
38
# Curl autoconf does not honour the curl_LDFLAGS environment variable
39
run sed -i -e "s/curl_LDFLAGS =/curl_LDFLAGS = -all-static/" src/Makefile
packaging/makeself/jobs/70-netdata-git.install.sh
+1
-1
@@ -37,7 +37,7 @@ run ./netdata-installer.sh \
37
# Properly mark the install type
38
cat > "${NETDATA_INSTALL_PATH}/etc/netdata/.install-type" <<-EOF
39
INSTALL_TYPE='manual-static'
40
- PREBUILT_ARCH='$(uname -m)'
40
+ PREBUILT_ARCH='${BUILDARCH}'
41
EOF
42
43
# Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin.
packaging/makeself/openssl.version
+1
-1
@@ -1 +1 @@
1
-OpenSSL_1_1_1k
1
+OpenSSL_1_1_1l