build.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. cd "$(dirname "$0")" || exit 1
  21. # if we don't run inside the netdata repo
  22. # download it and run from it
  23. if [ ! -f ../../netdata-installer.sh ]; then
  24. git clone https://github.com/netdata/netdata.git netdata.git || exit 1
  25. cd netdata.git/makeself || exit 1
  26. ./build.sh "$@"
  27. exit $?
  28. fi
  29. git clean -dxf
  30. cat >&2 << EOF
  31. This program will create a self-extracting shell package containing
  32. a statically linked netdata, able to run on any 64bit Linux system,
  33. without any dependencies from the target system.
  34. It can be used to have netdata running in no-time, or in cases the
  35. target Linux system cannot compile netdata.
  36. EOF
  37. if [ ! -d tmp ]; then
  38. mkdir tmp || exit 1
  39. else
  40. rm -rf tmp/*
  41. fi
  42. if ! ./run-all-jobs.sh "$@"; then
  43. printf >&2 "Build failed."
  44. exit 1
  45. fi