Cross-Platform build scripts for audio plugins
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.

467 lines
18KB

  1. #!/bin/bash
  2. set -e
  3. cd $(dirname ${0})
  4. PAWPAW_ROOT="${PWD}"
  5. # ---------------------------------------------------------------------------------------------------------------------
  6. # check target
  7. target="${1}"
  8. if [ -z "${target}" ]; then
  9. echo "usage: ${0} <target>"
  10. exit 1
  11. fi
  12. # ---------------------------------------------------------------------------------------------------------------------
  13. # source setup code
  14. source setup/check_target.sh
  15. source setup/env.sh
  16. source setup/functions.sh
  17. source setup/versions.sh
  18. # ---------------------------------------------------------------------------------------------------------------------
  19. # check for depedencies
  20. if ! command -v curl >/dev/null; then
  21. echo "missing 'curl' program, cannot continue!"
  22. exit 2
  23. fi
  24. if ! command -v make >/dev/null; then
  25. echo "missing 'make' program, cannot continue!"
  26. exit 2
  27. fi
  28. if ! command -v patch >/dev/null; then
  29. echo "missing 'patch' program, cannot continue!"
  30. exit 2
  31. fi
  32. if ! command -v python3 >/dev/null; then
  33. echo "missing 'python3' program, cannot continue!"
  34. exit 2
  35. fi
  36. if ! command -v sed >/dev/null; then
  37. echo "missing 'sed' program, cannot continue!"
  38. exit 2
  39. fi
  40. if ! command -v tar >/dev/null; then
  41. echo "missing 'tar' program, cannot continue!"
  42. exit 2
  43. fi
  44. if [ "${LINUX}" -eq 1 ] && ! command -v pkg-config >/dev/null; then
  45. echo "missing 'pkg-config' program, cannot continue!"
  46. exit 2
  47. fi
  48. if [ -z "${cmake}" ]; then
  49. echo "missing 'cmake' program, cannot continue!"
  50. exit 2
  51. fi
  52. # ---------------------------------------------------------------------------------------------------------------------
  53. # create common directories
  54. mkdir -p "${PAWPAW_BUILDDIR}"
  55. mkdir -p "${PAWPAW_DOWNLOADDIR}"
  56. mkdir -p "${PAWPAW_PREFIX}"
  57. mkdir -p "${PAWPAW_TMPDIR}"
  58. # ---------------------------------------------------------------------------------------------------------------------
  59. # merged usr mode
  60. mkdir -p "${PAWPAW_PREFIX}/bin"
  61. mkdir -p "${PAWPAW_PREFIX}/docs"
  62. mkdir -p "${PAWPAW_PREFIX}/etc"
  63. mkdir -p "${PAWPAW_PREFIX}/include"
  64. mkdir -p "${PAWPAW_PREFIX}/lib"
  65. mkdir -p "${PAWPAW_PREFIX}/share"
  66. mkdir -p "${PAWPAW_PREFIX}/usr"
  67. if [ ! -e "${PAWPAW_PREFIX}/usr/bin" ]; then
  68. ln -s ../bin "${PAWPAW_PREFIX}/usr/bin"
  69. fi
  70. if [ ! -e "${PAWPAW_PREFIX}/usr/docs" ]; then
  71. ln -s ../docs "${PAWPAW_PREFIX}/usr/docs"
  72. fi
  73. if [ ! -e "${PAWPAW_PREFIX}/usr/etc" ]; then
  74. ln -s ../etc "${PAWPAW_PREFIX}/usr/etc"
  75. fi
  76. if [ ! -e "${PAWPAW_PREFIX}/usr/include" ]; then
  77. ln -s ../include "${PAWPAW_PREFIX}/usr/include"
  78. fi
  79. if [ ! -e "${PAWPAW_PREFIX}/usr/lib" ]; then
  80. ln -s ../lib "${PAWPAW_PREFIX}/usr/lib"
  81. fi
  82. if [ ! -e "${PAWPAW_PREFIX}/usr/share" ]; then
  83. ln -s ../share "${PAWPAW_PREFIX}/usr/share"
  84. fi
  85. # ---------------------------------------------------------------------------------------------------------------------
  86. # merged usr mode (host)
  87. mkdir -p "${PAWPAW_PREFIX}-host/bin"
  88. mkdir -p "${PAWPAW_PREFIX}-host/usr"
  89. if [ ! -e "${PAWPAW_PREFIX}-host/usr/bin" ]; then
  90. ln -s ../bin "${PAWPAW_PREFIX}-host/usr/bin"
  91. fi
  92. # ---------------------------------------------------------------------------------------------------------------------
  93. # GNU tools by default on macOS
  94. if [ "${MACOS}" -eq 1 ]; then
  95. if ! command -v gawk >/dev/null; then
  96. echo "missing 'gawk' program, cannot continue!"
  97. exit 2
  98. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/awk" ]; then
  99. ln -s $(command -v gawk) "${PAWPAW_PREFIX}-host/bin/awk"
  100. fi
  101. if ! command -v gcp >/dev/null; then
  102. echo "missing 'gcp' program, cannot continue!"
  103. exit 2
  104. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/cp" ]; then
  105. ln -s $(command -v gcp) "${PAWPAW_PREFIX}-host/bin/cp"
  106. fi
  107. if ! command -v ginstall >/dev/null; then
  108. echo "missing 'ginstall' program, cannot continue!"
  109. exit 2
  110. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/install" ]; then
  111. ln -s $(command -v ginstall) "${PAWPAW_PREFIX}-host/bin/install"
  112. fi
  113. if ! command -v glibtool >/dev/null; then
  114. echo "missing 'glibtool' program, cannot continue!"
  115. exit 2
  116. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/libtool" ]; then
  117. ln -s $(command -v glibtool) "${PAWPAW_PREFIX}-host/bin/libtool"
  118. fi
  119. if ! command -v glibtoolize >/dev/null; then
  120. echo "missing 'glibtoolize' program, cannot continue!"
  121. exit 2
  122. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/libtoolize" ]; then
  123. ln -s $(command -v glibtoolize) "${PAWPAW_PREFIX}-host/bin/libtoolize"
  124. fi
  125. if ! command -v gm4 >/dev/null; then
  126. echo "missing 'curl' gm4, cannot continue!"
  127. exit 2
  128. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/m4" ]; then
  129. ln -s $(command -v gm4) "${PAWPAW_PREFIX}-host/bin/m4"
  130. fi
  131. if ! command -v gmake >/dev/null; then
  132. echo "missing 'curl' gmake, cannot continue!"
  133. exit 2
  134. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/make" ]; then
  135. ln -s $(command -v gmake) "${PAWPAW_PREFIX}-host/bin/make"
  136. fi
  137. if ! command -v greadlink >/dev/null; then
  138. echo "missing 'curl' greadlink, cannot continue!"
  139. exit 2
  140. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/readlink" ]; then
  141. ln -s $(command -v greadlink) "${PAWPAW_PREFIX}-host/bin/readlink"
  142. fi
  143. if ! command -v grealpath >/dev/null; then
  144. echo "missing 'curl' grealpath, cannot continue!"
  145. exit 2
  146. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/realpath" ]; then
  147. ln -s $(command -v grealpath) "${PAWPAW_PREFIX}-host/bin/realpath"
  148. fi
  149. if ! command -v gsed >/dev/null; then
  150. echo "missing 'curl' gsed, cannot continue!"
  151. exit 2
  152. elif [ ! -e "${PAWPAW_PREFIX}-host/bin/sed" ]; then
  153. ln -s $(command -v gsed) "${PAWPAW_PREFIX}-host/bin/sed"
  154. fi
  155. fi
  156. # ---------------------------------------------------------------------------------------------------------------------
  157. # use some native libs for linux builds
  158. if [ "${LINUX}" -eq 1 ]; then
  159. mkdir -p ${TARGET_PKG_CONFIG_PATH}
  160. if [ "${LINUX_TARGET}" = "linux-aarch64" ]; then
  161. export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig
  162. elif [ "${LINUX_TARGET}" = "linux-armhf" ]; then
  163. export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig
  164. elif [ "${LINUX_TARGET}" = "linux-i686" ]; then
  165. export PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig
  166. elif [ "${LINUX_TARGET}" = "linux-riscv64" ]; then
  167. export PKG_CONFIG_PATH=/usr/lib/riscv64-linux-gnu/pkgconfig
  168. elif [ "${LINUX_TARGET}" = "linux-x86_64" ]; then
  169. export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
  170. fi
  171. if ! pkg-config --print-errors --exists alsa dbus-1 gl glib-2.0 libpcre libpcre2-8 pthread-stubs uuid x11 xcb xcb-dri2 xcursor xdamage xext xfixes xproto xrandr xrender xxf86vm; then
  172. echo "some system libs are not available, cannot continue"
  173. exit 2
  174. fi
  175. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/alsa.pc" ]; then
  176. cp $(pkg-config --variable=pcfiledir alsa)/alsa.pc ${TARGET_PKG_CONFIG_PATH}/
  177. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/alsa.pc
  178. fi
  179. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/dbus-1.pc" ]; then
  180. cp $(pkg-config --variable=pcfiledir dbus-1)/dbus-1.pc ${TARGET_PKG_CONFIG_PATH}/
  181. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/dbus-1.pc
  182. fi
  183. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/gl.pc" ]; then
  184. cp $(pkg-config --variable=pcfiledir gl)/gl.pc ${TARGET_PKG_CONFIG_PATH}/
  185. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/gl.pc
  186. fi
  187. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/glib-2.0.pc" ]; then
  188. cp $(pkg-config --variable=pcfiledir glib-2.0)/g{io,lib,module,object,thread}-2.0.pc ${TARGET_PKG_CONFIG_PATH}/
  189. sed -i '/Libs.private/d;/Requires.private/d' ${TARGET_PKG_CONFIG_PATH}/g{io,lib,module,object,thread}-2.0.pc
  190. fi
  191. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/libpcre.pc" ]; then
  192. cp $(pkg-config --variable=pcfiledir libpcre)/libpcre.pc ${TARGET_PKG_CONFIG_PATH}/
  193. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/libpcre.pc
  194. fi
  195. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/libpcre2-8.pc" ]; then
  196. cp $(pkg-config --variable=pcfiledir libpcre2-8)/libpcre2-8.pc ${TARGET_PKG_CONFIG_PATH}/
  197. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/libpcre2-8.pc
  198. fi
  199. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/pthread-stubs.pc" ]; then
  200. cp $(pkg-config --variable=pcfiledir pthread-stubs)/pthread-stubs.pc ${TARGET_PKG_CONFIG_PATH}/
  201. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/pthread-stubs.pc
  202. fi
  203. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/uuid.pc" ]; then
  204. cp $(pkg-config --variable=pcfiledir uuid)/uuid.pc ${TARGET_PKG_CONFIG_PATH}/
  205. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/uuid.pc
  206. fi
  207. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/x11.pc" ]; then
  208. cp $(pkg-config --variable=pcfiledir x11)/x11.pc ${TARGET_PKG_CONFIG_PATH}/
  209. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/x11.pc
  210. fi
  211. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xcb.pc" ]; then
  212. cp $(pkg-config --variable=pcfiledir xcb)/{xau,xcb,xdmcp}.pc ${TARGET_PKG_CONFIG_PATH}/
  213. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/{xau,xcb,xdmcp}.pc
  214. fi
  215. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xcb-dri2.pc" ]; then
  216. cp $(pkg-config --variable=pcfiledir xcb-dri2)/xcb-dri2.pc ${TARGET_PKG_CONFIG_PATH}/
  217. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xcb-dri2.pc
  218. fi
  219. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xcursor.pc" ]; then
  220. cp $(pkg-config --variable=pcfiledir xcursor)/xcursor.pc ${TARGET_PKG_CONFIG_PATH}/
  221. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xcursor.pc
  222. fi
  223. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xdamage.pc" ]; then
  224. cp $(pkg-config --variable=pcfiledir xdamage)/xdamage.pc ${TARGET_PKG_CONFIG_PATH}/
  225. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xdamage.pc
  226. fi
  227. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xext.pc" ]; then
  228. cp $(pkg-config --variable=pcfiledir xext)/xext.pc ${TARGET_PKG_CONFIG_PATH}/
  229. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xext.pc
  230. fi
  231. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xf86vidmodeproto.pc" ]; then
  232. cp $(pkg-config --variable=pcfiledir xf86vidmodeproto)/xf86vidmodeproto.pc ${TARGET_PKG_CONFIG_PATH}/
  233. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xf86vidmodeproto.pc
  234. fi
  235. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xfixes.pc" ]; then
  236. cp $(pkg-config --variable=pcfiledir xfixes)/xfixes.pc ${TARGET_PKG_CONFIG_PATH}/
  237. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xfixes.pc
  238. fi
  239. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xproto.pc" ]; then
  240. cp $(pkg-config --variable=pcfiledir xproto)/{damageproto,fixesproto,kbproto,randrproto,renderproto,xextproto,xproto}.pc ${TARGET_PKG_CONFIG_PATH}/
  241. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/{fixesproto,kbproto,randrproto,renderproto,xextproto,xproto}.pc
  242. fi
  243. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xrandr.pc" ]; then
  244. cp $(pkg-config --variable=pcfiledir xrandr)/xrandr.pc ${TARGET_PKG_CONFIG_PATH}/
  245. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xrandr.pc
  246. fi
  247. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xrender.pc" ]; then
  248. cp $(pkg-config --variable=pcfiledir xrender)/xrender.pc ${TARGET_PKG_CONFIG_PATH}/
  249. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xrender.pc
  250. fi
  251. if [ ! -e "${TARGET_PKG_CONFIG_PATH}/xxf86vm.pc" ]; then
  252. cp $(pkg-config --variable=pcfiledir xxf86vm)/xxf86vm.pc ${TARGET_PKG_CONFIG_PATH}/
  253. sed -i '/Libs.private/d' ${TARGET_PKG_CONFIG_PATH}/xxf86vm.pc
  254. fi
  255. fi
  256. # ---------------------------------------------------------------------------------------------------------------------
  257. # pkgconfig
  258. export EXTRA_CFLAGS="-Wno-int-conversion"
  259. download pkg-config "${PKG_CONFIG_VERSION}" "${PKG_CONFIG_URL}"
  260. build_host_autoconf pkg-config "${PKG_CONFIG_VERSION}" "--enable-indirect-deps --with-internal-glib --with-pc-path=${TARGET_PKG_CONFIG_PATH}"
  261. if [ -n "${TOOLCHAIN_PREFIX_}" ] && [ ! -e "${PAWPAW_PREFIX}/bin/${TOOLCHAIN_PREFIX_}pkg-config" ]; then
  262. ln -s pkg-config "${PAWPAW_PREFIX}/bin/${TOOLCHAIN_PREFIX_}pkg-config"
  263. fi
  264. # ---------------------------------------------------------------------------------------------------------------------
  265. # libogg
  266. download libogg "${LIBOGG_VERSION}" "${LIBOGG_URL}"
  267. build_autoconf libogg "${LIBOGG_VERSION}"
  268. if [ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]; then
  269. run_make libogg "${LIBOGG_VERSION}" "check -j 1"
  270. fi
  271. # ---------------------------------------------------------------------------------------------------------------------
  272. # libvorbis
  273. LIBVORBIS_EXTRAFLAGS="--disable-examples"
  274. download libvorbis "${LIBVORBIS_VERSION}" "${LIBVORBIS_URL}"
  275. build_autoconf libvorbis "${LIBVORBIS_VERSION}" "${LIBVORBIS_EXTRAFLAGS}"
  276. if [ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]; then
  277. run_make libvorbis "${LIBVORBIS_VERSION}" "check -j 1"
  278. fi
  279. # ---------------------------------------------------------------------------------------------------------------------
  280. # flac
  281. FLAC_EXTRAFLAGS=""
  282. FLAC_EXTRAFLAGS+=" --disable-doxygen-docs"
  283. FLAC_EXTRAFLAGS+=" --disable-examples"
  284. FLAC_EXTRAFLAGS+=" --disable-stack-smash-protection"
  285. FLAC_EXTRAFLAGS+=" --disable-thorough-tests"
  286. FLAC_EXTRAFLAGS+=" --disable-xmms-plugin"
  287. if [ -n "${PAWPAW_NOSIMD}" ] && [ "${PAWPAW_NOSIMD}" -eq 1 ]; then
  288. FLAC_EXTRAFLAGS+=" ac_cv_header_x86intrin_h=no ac_cv_header_arm_neon_h=no asm_opt=no"
  289. elif [ "${MACOS_UNIVERSAL}" -eq 1 ] || [ "${WASM}" -eq 1 ]; then
  290. # FIXME
  291. FLAC_EXTRAFLAGS+=" ac_cv_header_x86intrin_h=no ac_cv_header_arm_neon_h=no asm_opt=no"
  292. else
  293. # force intrinsic optimizations on targets where auto-detection fails
  294. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  295. FLAC_EXTRAFLAGS+=" ac_cv_header_x86intrin_h=yes ac_cv_header_arm_neon_h=yes asm_opt=yes"
  296. elif [ "${WASM}" -eq 1 ]; then
  297. FLAC_EXTRAFLAGS+=" ac_cv_header_x86intrin_h=yes asm_opt=yes"
  298. fi
  299. fi
  300. download flac "${FLAC_VERSION}" "${FLAC_URL}" "tar.xz"
  301. build_autoconf flac "${FLAC_VERSION}" "${FLAC_EXTRAFLAGS}"
  302. if [ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]; then
  303. run_make flac "${FLAC_VERSION}" "check -j 1"
  304. fi
  305. # ---------------------------------------------------------------------------------------------------------------------
  306. # opus
  307. OPUS_EXTRAFLAGS="--enable-custom-modes --enable-float-approx"
  308. OPUS_EXTRAFLAGS+=" --disable-stack-protector"
  309. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  310. OPUS_EXTRAFLAGS+=" --disable-extra-programs"
  311. fi
  312. if [ -n "${PAWPAW_NOSIMD}" ] && [ "${PAWPAW_NOSIMD}" -eq 1 ]; then
  313. OPUS_EXTRAFLAGS+=" --disable-intrinsics"
  314. # FIXME macos-universal proper optimizations https://github.com/DISTRHO/PawPaw/issues/4
  315. elif [ "${MACOS_UNIVERSAL}" -eq 1 ] || [ "${WASM}" -eq 1 ]; then
  316. OPUS_EXTRAFLAGS+=" --disable-intrinsics"
  317. fi
  318. download opus "${OPUS_VERSION}" "${OPUS_URL}"
  319. build_autoconf opus "${OPUS_VERSION}" "${OPUS_EXTRAFLAGS}"
  320. if [ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]; then
  321. run_make opus "${OPUS_VERSION}" check
  322. fi
  323. # ---------------------------------------------------------------------------------------------------------------------
  324. # libsndfile
  325. LIBSNDFILE_EXTRAFLAGS="--disable-alsa --disable-full-suite --disable-sqlite"
  326. # force disable mp3 support for now, until we handle those libs
  327. LIBSNDFILE_EXTRAFLAGS+=" --disable-mpeg"
  328. # force intrinsic optimizations on some targets
  329. if [ -z "${PAWPAW_NOSIMD}" ] || [ "${PAWPAW_NOSIMD}" -eq 0 ]; then
  330. if [ "${MACOS_UNIVERSAL}" -eq 1 ] || [ "${WASM}" -eq 1 ]; then
  331. LIBSNDFILE_EXTRAFLAGS+=" ac_cv_header_immintrin_h=yes"
  332. fi
  333. fi
  334. # fix build, regex matching fails
  335. if [ "${WASM}" -eq 1 ]; then
  336. LIBSNDFILE_EXTRAFLAGS+=" ax_cv_c_compiler_version=15.0.0"
  337. LIBSNDFILE_EXTRAFLAGS+=" ax_cv_cxx_compiler_version=15.0.0"
  338. fi
  339. # otherwise tests fail
  340. export EXTRA_CFLAGS="-fno-associative-math -frounding-math"
  341. if [ "${CLANG}" -eq 1 ]; then
  342. export EXTRA_CFLAGS+=" -fno-reciprocal-math"
  343. else
  344. export EXTRA_CFLAGS+=" -fsignaling-nans"
  345. fi
  346. download libsndfile "${LIBSNDFILE_VERSION}" "${LIBSNDFILE_URL}" "tar.xz"
  347. build_autoconf libsndfile "${LIBSNDFILE_VERSION}" "${LIBSNDFILE_EXTRAFLAGS}"
  348. if [ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]; then
  349. run_make libsndfile "${LIBSNDFILE_VERSION}" check
  350. fi
  351. # ---------------------------------------------------------------------------------------------------------------------
  352. # libsamplerate
  353. if [ -z "${PAWPAW_SKIP_SAMPLERATE}" ] || [ "${PAWPAW_SKIP_SAMPLERATE}" -eq 0 ]; then
  354. LIBSAMPLERATE_EXTRAFLAGS="--disable-fftw"
  355. # NOTE: sndfile tests use Carbon, which is not always available on macOS
  356. if [ "${CROSS_COMPILING}" -eq 1 ] || [ "${MACOS}" -eq 1 ]; then
  357. LIBSAMPLERATE_EXTRAFLAGS+=" --disable-sndfile"
  358. fi
  359. download libsamplerate "${LIBSAMPLERATE_VERSION}" "${LIBSAMPLERATE_URL}"
  360. build_autoconf libsamplerate "${LIBSAMPLERATE_VERSION}" "${LIBSAMPLERATE_EXTRAFLAGS}"
  361. if ([ -z "${PAWPAW_SKIP_TESTS}" ] || [ "${PAWPAW_SKIP_TESTS}" -eq 0 ]) && [ "${MACOS}" -eq 0 ]; then
  362. run_make libsamplerate "${LIBSAMPLERATE_VERSION}" check
  363. fi
  364. fi # PAWPAW_SKIP_SAMPLERATE
  365. # ---------------------------------------------------------------------------------------------------------------------
  366. # zlib (skipped on macOS)
  367. if [ "${MACOS}" -eq 0 ]; then
  368. download zlib "${ZLIB_VERSION}" "${ZLIB_URL}"
  369. build_conf zlib "${ZLIB_VERSION}" "--static --prefix=${PAWPAW_PREFIX} --zprefix"
  370. if [ "${CROSS_COMPILING}" -eq 0 ]; then
  371. run_make zlib "${ZLIB_VERSION}" check
  372. fi
  373. fi
  374. # ---------------------------------------------------------------------------------------------------------------------
  375. # mingw-std-threads (download, win32 only)
  376. if [ "${WIN32}" -eq 1 ]; then
  377. git_clone mingw-std-threads "${MINGW_STD_THREADS_VERSION}" "${MINGW_STD_THREADS_URL}"
  378. if [ ! -e "${PAWPAW_BUILDDIR}/mingw-std-threads-${MINGW_STD_THREADS_VERSION}/.stamp-installed" ]; then
  379. install -m 644 "${PAWPAW_BUILDDIR}/mingw-std-threads-${MINGW_STD_THREADS_VERSION}"/mingw.*.h "${PAWPAW_PREFIX}/include/"
  380. install -m 644 "${PAWPAW_ROOT}/mingw-compat"/* "${PAWPAW_PREFIX}/include/"
  381. touch "${PAWPAW_BUILDDIR}/mingw-std-threads-${MINGW_STD_THREADS_VERSION}/.stamp-installed"
  382. fi
  383. fi
  384. # ---------------------------------------------------------------------------------------------------------------------