portability.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. # sourced to find alternate names for things
  2. source ./configure
  3. if [ -z "$(command -v "${CROSS_COMPILE}${CC}")" ]
  4. then
  5. echo "No ${CROSS_COMPILE}${CC} found" >&2
  6. exit 1
  7. fi
  8. if [ -z "$SED" ]
  9. then
  10. [ ! -z "$(command -v gsed 2>/dev/null)" ] && SED=gsed || SED=sed
  11. fi
  12. # Extra debug plumbing the Android guys want
  13. if [ ! -z "$ASAN" ]; then
  14. echo "Enabling ASan..."
  15. # Turn ASan on and disable most optimization to get more readable backtraces.
  16. # (Technically ASAN is just "-fsanitize=address" and the rest is optional.)
  17. ASAN_FLAGS="-fsanitize=address -O1 -g -fno-omit-frame-pointer -fno-optimize-sibling-calls"
  18. CFLAGS="$ASAN_FLAGS $CFLAGS"
  19. # Run this nonsense against temporary build tools that don't ship too
  20. HOSTCC="$HOSTCC $ASAN_FLAGS"
  21. # Ignore leaks on exit. TODO
  22. export ASAN_OPTIONS="detect_leaks=0"
  23. fi
  24. # Centos 7 bug workaround, EOL June 30 2024.
  25. DASHN=-n; wait -n 2>/dev/null; [ $? -eq 2 ] && unset DASHN
  26. # If the build is using gnu tools, make them behave less randomly.
  27. export LANG=c
  28. export LC_ALL=C