Devuan fork of gpsd
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.
 
 
 
 
 
 

90 lines
2.2 KiB

  1. #!/usr/bin/env bash
  2. set -e
  3. set -x
  4. export PATH=/usr/sbin:/usr/bin:/sbin:/bin
  5. if uname -a | grep -qi freebsd; then
  6. export PATH="${PATH}:/usr/local/bin:/usr/local/sbin"
  7. fi
  8. if [ "${USE_CCACHE}" = "true" ] && [ -n "${CCACHE_DIR}" ] && command -v ccache >/dev/null; then
  9. if [ -d "/usr/lib64/ccache" ]; then
  10. # fedora
  11. export PATH="/usr/lib64/ccache:${PATH}"
  12. elif [ -d "/usr/local/libexec/ccache/" ]; then
  13. # freebsd
  14. export PATH="/usr/local/libexec/ccache:${PATH}"
  15. else
  16. # debian, .....
  17. export PATH="/usr/lib/ccache:${PATH}"
  18. fi
  19. mkdir -p "${CCACHE_DIR}"
  20. echo 'max_size = 100M' > "${CCACHE_DIR}/ccache.conf"
  21. else
  22. export USE_CCACHE="false"
  23. fi
  24. if command -v lsb_release >/dev/null && lsb_release -d | grep -qi -e debian -e ubuntu; then
  25. eval "$(dpkg-buildflags --export=sh)"
  26. export DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
  27. export PYTHONS="$(pyversions -v -r '>= 2.3'; py3versions -v -r '>= 3.4')"
  28. SCONSOPTS="${SCONSOPTS} libdir=/usr/lib/${DEB_HOST_MULTIARCH}"
  29. else
  30. SCONSOPTS="${SCONSOPTS} libdir=/usr/lib"
  31. fi
  32. SCONSOPTS="${SCONSOPTS} $@ prefix=/usr"
  33. SCONSOPTS="${SCONSOPTS} systemd=yes"
  34. SCONSOPTS="${SCONSOPTS} nostrip=yes"
  35. SCONSOPTS="${SCONSOPTS} dbus_export=yes"
  36. SCONSOPTS="${SCONSOPTS} docdir=/usr/share/doc/gpsd"
  37. SCONSOPTS="${SCONSOPTS} gpsd_user=gpsd"
  38. SCONSOPTS="${SCONSOPTS} gpsd_group=dialout"
  39. SCONSOPTS="${SCONSOPTS} debug=yes"
  40. SCONSOPTS="${SCONSOPTS} qt_versioned=5"
  41. export SCONS=$(command -v scons)
  42. if command -v nproc >/dev/null; then
  43. NPROC=$(nproc)
  44. SCONS_PARALLEL="-j ${NPROC} "
  45. if [ "${SLOW_CHECK}" != "yes" ]; then
  46. CHECK_NPROC=$(( 4 * ${NPROC} ))
  47. SCONS_CHECK_PARALLEL="-j ${CHECK_NPROC} "
  48. else
  49. SCONS_CHECK_PARALLEL="${SCONS_PARALLEL}"
  50. fi
  51. else
  52. SCONS_PARALLEL=""
  53. SCONS_CHECK_PARALLEL=""
  54. fi
  55. export SCONSOPTS
  56. if [ -z "$PYTHONS" ]; then
  57. export PYTHONS="3"
  58. fi
  59. if [ -n "${SCAN_BUILD}" ]; then
  60. export PYTHONS="3"
  61. fi
  62. for py in $PYTHONS; do
  63. _SCONS="${SCONS} target_python=python${py}"
  64. python${py} ${_SCONS} ${SCONSOPTS} --clean
  65. rm -f .sconsign.*.dblite
  66. ${SCAN_BUILD} python${py} ${_SCONS} ${SCONS_PARALLEL}${SCONSOPTS} build-all
  67. if [ -z "${NOCHECK}" ]; then
  68. python${py} ${_SCONS} ${SCONS_CHECK_PARALLEL}${SCONSOPTS} check
  69. fi
  70. done
  71. if [ "${USE_CCACHE}" = "true" ]; then
  72. ccache -s
  73. fi