Просмотр исходного кода

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 3 лет назад
Родитель
Сommit
f49103aa8a

+ 1 - 1
.github/scripts/build-static.sh

@@ -10,7 +10,7 @@ set -e
 BUILDARCH="${1}"
 NAME="${NAME:-netdata}"
 VERSION="${VERSION:-"$(git describe)"}"
-BASENAME="$NAME-$VERSION"
+BASENAME="$NAME-$BUILDARCH-$VERSION"
 
 prepare_build() {
   progress "Preparing build"

+ 3 - 1
.github/workflows/build-and-install.yml

@@ -14,7 +14,9 @@ jobs:
     strategy:
       matrix:
         arch:
-          - 'x86_64'
+          - x86_64
+          - armv7l
+          - aarch64
     steps:
       - name: Git clone repository
         uses: actions/checkout@v2

+ 1 - 1
.travis/create_artifacts.sh

@@ -52,7 +52,7 @@ make dist
 mv "${BASENAME}.tar.gz" artifacts/
 
 echo "--- Create self-extractor ---"
-sxarches="x86_64"
+sxarches="x86_64 armv7l aarch64"
 for arch in ${sxarches}; do
   git clean -d -f
   rm -rf packating/makeself/tmp

+ 1 - 1
netdata-installer.sh

@@ -1048,7 +1048,7 @@ fi
 if [ -d ./.git ] ; then
   echo >&2
   progress "Updating tags in git to ensure a consistent version number"
-  run git fetch <remote> 'refs/tags/*:refs/tags/*' || true
+  run git fetch -t || true
 fi
 
 # -----------------------------------------------------------------------------

+ 6 - 3
packaging/makeself/build-static.sh

@@ -11,7 +11,7 @@ set -e
 
 case ${BUILDARCH} in
   x86_64) platform=linux/amd64 ;;
-  arm7) platform=linux/arm/v7 ;;
+  armv7l) platform=linux/arm/v7 ;;
   aarch64) platform=linux/arm64/v8 ;;
   *)
     echo "Unknown target architecture '${BUILDARCH}'."
@@ -21,7 +21,7 @@ esac
 
 DOCKER_CONTAINER_NAME="netdata-package-${BUILDARCH}-static-alpine312"
 
-if [ "${BUILDARCH}" != "x86_64" ]; then
+if [ "${BUILDARCH}" != "$(uname -m)" ]; then
     docker run --rm --privileged multiarch/qemu-user-static --reset -p yes || exit 1
 fi
 
@@ -39,7 +39,10 @@ if ! docker inspect "${DOCKER_CONTAINER_NAME}" > /dev/null 2>&1; then
   # inside the container and runs the script install-alpine-packages.sh
   # (also inside the container)
   #
-  run docker pull alpine:3.12
+  if docker inspect alpine:3.12 > dev/null 2>&1; then
+    run docker image remove alpine:3.12
+    run docker pull --platform=${platform}  alpine:3.12
+  fi
 
   run docker run --platform=${platform} -v "$(pwd)":/usr/src/netdata.git:rw alpine:3.12 \
     /bin/sh /usr/src/netdata.git/packaging/makeself/install-alpine-packages.sh

+ 4 - 0
packaging/makeself/build.sh

@@ -38,6 +38,8 @@ if [ ! -f ../../netdata-installer.sh ]; then
   exit $?
 fi
 
+git clean -dxf
+
 cat >&2 << EOF
 This program will create a self-extracting shell package containing
 a statically linked netdata, able to run on any 64bit Linux system,
@@ -49,6 +51,8 @@ EOF
 
 if [ ! -d tmp ]; then
   mkdir tmp || exit 1
+else
+  rm -rf tmp/*
 fi
 
 if ! ./run-all-jobs.sh "$@"; then

+ 19 - 17
packaging/makeself/install-alpine-packages.sh

@@ -9,35 +9,37 @@
 
 # Add required APK packages
 apk add --no-cache -U \
-  bash \
-  wget \
-  curl \
-  ncurses \
-  git \
-  netcat-openbsd \
   alpine-sdk \
   autoconf \
   automake \
-  gcc \
-  make \
+  bash \
+  binutils \
   cmake \
-  libtool \
-  pkgconfig \
-  util-linux-dev \
+  curl \
+  gcc \
+  git \
   gnutls-dev \
-  zlib-dev \
-  zlib-static \
+  gzip \
   libmnl-dev \
   libnetfilter_acct-dev \
+  libtool \
   libuv-dev \
   libuv-static \
   lz4-dev \
   lz4-static \
-  snappy-dev \
+  make \
+  ncurses \
+  netcat-openbsd \
+  openssh \
+  pkgconfig \
   protobuf-dev \
-  binutils \
-  gzip \
-  xz || exit 1
+  snappy-dev \
+  util-linux-dev \
+  wget \
+  xz \
+  zlib-dev \
+  zlib-static ||
+  exit 1
 
 # snappy doesn't have static version in alpine, let's compile it
 export SNAPPY_VER="1.1.7"

+ 3 - 2
packaging/makeself/jobs/20-openssl.install.sh

@@ -6,15 +6,16 @@
 
 version="$(cat "$(dirname "${0}")/../openssl.version")"
 
+export CFLAGS='-fno-lto'
 export LDFLAGS='-static'
 export PKG_CONFIG="pkg-config --static"
 
 # 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"
+  run git clone --branch "${version}" --single-branch --depth 1 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
+run ./config -static no-tests --prefix=/openssl-static --openssldir=/opt/netdata/etc/ssl
 run make -j "$(nproc)"
 run make -j "$(nproc)" install_sw

+ 1 - 0
packaging/makeself/jobs/50-bash-5.0.install.sh

@@ -14,6 +14,7 @@ run ./configure \
   --enable-static-link \
   --enable-net-redirections \
   --enable-array-variables \
+  --disable-progcomp \
   --disable-profiling \
   --disable-nls
 

+ 13 - 2
packaging/makeself/jobs/50-curl-7.73.0.install.sh → packaging/makeself/jobs/50-curl-7.78.0.install.sh

@@ -4,7 +4,7 @@
 # shellcheck source=packaging/makeself/functions.sh
 . "$(dirname "${0}")/../functions.sh" "${@}" || exit 1
 
-fetch "curl-7.73.0" "https://curl.haxx.se/download/curl-7.73.0.tar.gz"
+fetch "curl-7.78.0" "https://curl.haxx.se/download/curl-7.78.0.tar.gz"
 
 export CFLAGS="-I/openssl-static/include"
 export LDFLAGS="-static -L/openssl-static/lib"
@@ -19,10 +19,21 @@ run ./configure \
   --disable-shared \
   --enable-static \
   --enable-http \
+  --disable-ldap \
+  --disable-ldaps \
   --enable-proxy \
+  --disable-dict \
+  --disable-telnet \
+  --disable-tftp \
+  --disable-pop3 \
+  --disable-imap \
+  --disable-smb \
+  --disable-smtp \
+  --disable-gopher \
   --enable-ipv6 \
   --enable-cookies \
-  --with-ca-fallback
+  --with-ca-fallback \
+  --with-openssl
 
 # Curl autoconf does not honour the curl_LDFLAGS environment variable
 run sed -i -e "s/curl_LDFLAGS =/curl_LDFLAGS = -all-static/" src/Makefile

Некоторые файлы не были показаны из-за большого количества измененных файлов