diff options
author | Tasos Katsoulas <12612986+tkatsoulas@users.noreply.github.com> | 2023-07-18 15:05:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-18 15:05:49 +0300 |
commit | 2d4e91ab505dadf08ed2e31cbf9fa9398f1c3fb8 (patch) | |
tree | 064bd25928c7ec48c04a37d2891fa35273dece8f /packaging | |
parent | 90a4976bac7d7729648a02b425fa9f659f9ba623 (diff) |
Build optimizations (#15381)
Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud>
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/docker/Dockerfile | 4 | ||||
-rwxr-xr-x | packaging/docker/gen-cflags.sh | 4 | ||||
-rwxr-xr-x | packaging/makeself/jobs/70-netdata-git.install.sh | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index 2066e3dc2e..4cbba913ee 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -28,8 +28,8 @@ WORKDIR /opt/netdata.git RUN chmod +x netdata-installer.sh && \ cp -rp /deps/* /usr/local/ && \ /bin/echo -e "INSTALL_TYPE='oci'\nPREBUILT_ARCH='$(uname -m)'" > ./system/.install-type && \ - CFLAGS="$(packaging/docker/gen-cflags.sh)" ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \ - ${EXTRA_INSTALL_OPTS} --one-time-build "$([ "$RELEASE_CHANNEL" = stable ] && echo --stable-channel)" + CFLAGS="$(packaging/docker/gen-cflags.sh)" LDFLAGS="-Wl,--gc-sections" ./netdata-installer.sh --dont-wait --dont-start-it --use-system-protobuf \ + ${EXTRA_INSTALL_OPTS} --one-time-build --enable-lto "$([ "$RELEASE_CHANNEL" = stable ] && echo --stable-channel)" # files to one directory RUN mkdir -p /app/usr/sbin/ \ diff --git a/packaging/docker/gen-cflags.sh b/packaging/docker/gen-cflags.sh index 3a80b73582..f5ccab8a4a 100755 --- a/packaging/docker/gen-cflags.sh +++ b/packaging/docker/gen-cflags.sh @@ -3,7 +3,7 @@ if [ -n "${CFLAGS}" ]; then echo "${CFLAGS}" elif [ -n "${DEBUG_BUILD}" ]; then - echo "-Og -ggdb -pipe" + echo "-ffunction-sections -fdata-sections -Og -ggdb -pipe" else - echo "-O2 -pipe" + echo "-ffunction-sections -fdata-sections -O2 -funroll-loops -pipe" fi diff --git a/packaging/makeself/jobs/70-netdata-git.install.sh b/packaging/makeself/jobs/70-netdata-git.install.sh index 3c3d44515f..c7dd98df26 100755 --- a/packaging/makeself/jobs/70-netdata-git.install.sh +++ b/packaging/makeself/jobs/70-netdata-git.install.sh @@ -7,12 +7,12 @@ cd "${NETDATA_SOURCE_PATH}" || exit 1 if [ "${NETDATA_BUILD_WITH_DEBUG}" -eq 0 ]; then - export CFLAGS="-static -O2 -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/usr/include/libmnl -pipe" + export CFLAGS="-ffunction-sections -fdata-sections -static -O2 -funroll-loops -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/usr/include/libmnl -pipe" else export CFLAGS="-static -O1 -pipe -ggdb -Wall -Wextra -Wformat-signedness -DNETDATA_INTERNAL_CHECKS=1 -I/openssl-static/include -I/libnetfilter-acct-static/include/libnetfilter_acct -I/usr/include/libmnl" fi -export LDFLAGS="-static -L/openssl-static/lib -L/libnetfilter-acct-static/lib -lnetfilter_acct -L/usr/lib -lmnl" +export LDFLAGS="-Wl,--gc-sections -static -L/openssl-static/lib -L/libnetfilter-acct-static/lib -lnetfilter_acct -L/usr/lib -lmnl" # 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 @@ -34,7 +34,8 @@ run ./netdata-installer.sh \ --require-cloud \ --use-system-protobuf \ --dont-scrub-cflags-even-though-it-may-break-things \ - --one-time-build + --one-time-build \ + --enable-lto # shellcheck disable=SC2015 [ "${GITHUB_ACTIONS}" = "true" ] && echo "::group::Finishing netdata install" || true |