build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/env sh
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. # -----------------------------------------------------------------------------
  4. # parse command line arguments
  5. set -e
  6. export NETDATA_BUILD_WITH_DEBUG=0
  7. while [ -n "${1}" ]; do
  8. case "${1}" in
  9. debug)
  10. export NETDATA_BUILD_WITH_DEBUG=1
  11. ;;
  12. *) ;;
  13. esac
  14. shift
  15. done
  16. # -----------------------------------------------------------------------------
  17. # First run install-alpine-packages.sh under alpine linux to install
  18. # the required packages. build-x86_64-static.sh will do this for you
  19. # using docker.
  20. mkdir -p /usr/src
  21. cp -va /netdata /usr/src/netdata
  22. chown -R root:root /usr/src/netdata
  23. cd /usr/src/netdata/packaging/makeself || exit 1
  24. git clean -dxf
  25. git submodule foreach --recursive git clean -dxf
  26. cat >&2 << EOF
  27. This program will create a self-extracting shell package containing
  28. a statically linked netdata, able to run on any 64bit Linux system,
  29. without any dependencies from the target system.
  30. It can be used to have netdata running in no-time, or in cases the
  31. target Linux system cannot compile netdata.
  32. EOF
  33. if [ ! -d tmp ]; then
  34. mkdir tmp || exit 1
  35. else
  36. rm -rf tmp/*
  37. fi
  38. if [ -z "${GITHUB_ACTIONS}" ]; then
  39. export GITHUB_ACTIONS=false
  40. fi
  41. if ! ./run-all-jobs.sh "$@"; then
  42. printf >&2 "Build failed."
  43. exit 1
  44. fi
  45. mkdir -p /netdata/artifacts
  46. cp -va /usr/src/netdata/artifacts/* /netdata/artifacts/
  47. chown -R "$(stat -c '%u:%g' /netdata)" /netdata/artifacts/