Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.sh 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/env bash
  2. set -o pipefail
  3. if [[ -n "$V" ]]; then
  4. set -o xtrace
  5. fi
  6. fail() {
  7. if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then
  8. echo "-----------------------------------------------------------------"
  9. echo "Building dtrace-provider failed with exit code $1, falling back"
  10. echo "on stub implementation."
  11. echo ""
  12. echo "Re-run install with V set in your environment to see the build"
  13. echo "output, or NODE_DTRACE_PROVIDER_REQUIRE=hard to force an"
  14. echo "installation failure."
  15. echo "-----------------------------------------------------------------"
  16. fi
  17. if [[ "$NODE_DTRACE_PROVIDER_REQUIRE" == "hard" ]]; then
  18. exit 1
  19. else
  20. exit 0
  21. fi
  22. }
  23. buildUSDT() {
  24. if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then
  25. exec 1> /dev/null
  26. exec 2> /dev/null
  27. fi
  28. # GYP's MAKEFLAGS confuses libusdt's Makefile
  29. unset MAKEFLAGS
  30. # Ask node what architecture it's been built for ("target_arch" in
  31. # config.gypi), and build libusdt to match.
  32. #
  33. # We use node from the path; npm will have adjusted PATH for us if
  34. # necessary, otherwise we assume the user did so when building by
  35. # hand.
  36. #
  37. # (This will need to change at the point that GYP is able to build
  38. # node extensions universal on the Mac - for now we'll go with x86_64
  39. # on a 64 bit Mac, because that's the default architecture in that
  40. # situation.)
  41. export ARCH=`node -e "console.log(process.arch === 'x64' ? 'x86_64' : 'i386')"`
  42. echo "Building libusdt for ${ARCH}"
  43. # Respect a MAKE variable if set
  44. if [[ -z $MAKE ]]; then
  45. # Default to `gmake` first if available, because we require GNU make
  46. # and `make` isn't GNU make on some plats.
  47. MAKE=`which gmake`
  48. if [[ -z $MAKE ]]; then
  49. MAKE=make
  50. fi
  51. fi
  52. # Build libusdt.
  53. $MAKE -C libusdt clean all
  54. }
  55. buildNDTP() {
  56. if [[ -z "$NODE_DTRACE_PROVIDER_REQUIRE" && -z "$V" ]]; then
  57. exec 1> /dev/null
  58. exec 2> /dev/null
  59. fi
  60. node-gyp rebuild -C src
  61. }
  62. (buildUSDT)
  63. LIBUSDT_STATUS=$?
  64. if [[ "$LIBUSDT_STATUS" -ne 0 ]]; then
  65. fail $LIBUSDT_STATUS
  66. fi
  67. (buildNDTP)
  68. NODE_GYP_STATUS=$?
  69. if [[ "$NODE_GYP_STATUS" -ne 0 ]]; then
  70. fail $NODE_GYP_STATUS
  71. fi
  72. exit 0