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.

700 lines
20KB

  1. #!/bin/bash
  2. # ---------------------------------------------------------------------------------------------------------------------
  3. function download() {
  4. local name="${1}"
  5. local version="${2}"
  6. local dlbaseurl="${3}"
  7. local dlext="${4}"
  8. local dlmethod="${5}"
  9. local dlname="${6}"
  10. if [ -z "${dlext}" ]; then
  11. dlext="tar.gz"
  12. fi
  13. if [ -z "${dlname}" ]; then
  14. dlname="${name}"
  15. fi
  16. local dlfile="${PAWPAW_DOWNLOADDIR}/${dlname}-${version}.${dlext}"
  17. local dlfolder="${PAWPAW_BUILDDIR}/${name}-${version}"
  18. if [ ! -f "${dlfile}" ]; then
  19. if [ -n "${dlmethod}" ] && [ "${dlmethod}" = "git" ]; then
  20. local tmprepodir="${PAWPAW_TMPDIR}/${dlname}-${version}"
  21. rm -rf "${tmprepodir}"
  22. git clone --recursive "${dlbaseurl}" "${tmprepodir}"
  23. git -C "${tmprepodir}" checkout "${version}"
  24. git -C "${tmprepodir}" submodule update
  25. tar --exclude=".git" -czf "${dlfile}" -C "${PAWPAW_TMPDIR}" "${dlname}-${version}"
  26. rm -rf "${tmprepodir}"
  27. else
  28. local dlurl
  29. if echo ${dlbaseurl} | grep -q github.com | grep -q -v releases; then
  30. if [ x"${dlmethod}" = x"nv" ]; then
  31. dlurl="${dlbaseurl}/${version}.${dlext}"
  32. else
  33. dlurl="${dlbaseurl}/v${version}.${dlext}"
  34. fi
  35. elif [ "${dlext}" = "orig.tar.gz" ]; then
  36. dlurl="${dlbaseurl}/${dlname}_${version}.${dlext}"
  37. else
  38. dlurl="${dlbaseurl}/${dlname}-${version}.${dlext}"
  39. fi
  40. curl -L "${dlurl}" -o "${dlfile}" --fail
  41. fi
  42. fi
  43. if [ ! -d "${dlfolder}" ]; then
  44. mkdir "${dlfolder}"
  45. tar -xf "${dlfile}" -C "${dlfolder}" --strip-components=1
  46. fi
  47. }
  48. function copy_download() {
  49. local name1="${1}"
  50. local name2="${2}"
  51. local version="${3}"
  52. local dlext="${4}"
  53. if [ -z "${dlext}" ]; then
  54. dlext="tar.gz"
  55. fi
  56. local dlfile1="${PAWPAW_DOWNLOADDIR}/${name1}-${version}.${dlext}"
  57. local dlfolder2="${PAWPAW_BUILDDIR}/${name2}-${version}"
  58. if [ ! -d "${dlfolder2}" ]; then
  59. mkdir "${dlfolder2}"
  60. tar -xf "${dlfile1}" -C "${dlfolder2}" --strip-components=1
  61. fi
  62. }
  63. function git_clone() {
  64. local name="${1}"
  65. local hash="${2}"
  66. local repourl="${3}"
  67. local dlname="${4}"
  68. if [ -z "${dlname}" ]; then
  69. dlname="${name}"
  70. fi
  71. local dlfile="${PAWPAW_DOWNLOADDIR}/${dlname}-${hash}.tar.gz"
  72. local dlfolder="${PAWPAW_BUILDDIR}/${name}-${hash}"
  73. if [ ! -f "${dlfile}" ]; then
  74. local tmprepodir="${PAWPAW_TMPDIR}/${dlname}-${hash}"
  75. rm -rf "${tmprepodir}"
  76. git clone --recursive "${repourl}" "${tmprepodir}"
  77. git -C "${tmprepodir}" checkout "${hash}"
  78. git -C "${tmprepodir}" submodule update
  79. tar --exclude=".git" -czf "${dlfile}" -C "${PAWPAW_TMPDIR}" "${dlname}-${hash}"
  80. rm -rf "${tmprepodir}"
  81. fi
  82. if [ ! -d "${dlfolder}" ]; then
  83. mkdir "${dlfolder}"
  84. tar -xf "${dlfile}" -C "${dlfolder}" --strip-components=1
  85. fi
  86. }
  87. # ---------------------------------------------------------------------------------------------------------------------
  88. function _prebuild() {
  89. local name="${1}"
  90. local pkgdir="${2}"
  91. export AR="${TARGET_AR}"
  92. export CC="${TARGET_CC}"
  93. export CXX="${TARGET_CXX}"
  94. export DLLWRAP="${TARGET_DLLWRAP}"
  95. export LD="${TARGET_LD}"
  96. export STRIP="${TARGET_STRIP}"
  97. export WINDRES="${TARGET_WINDRES}"
  98. export CFLAGS="${TARGET_CFLAGS} ${EXTRA_CFLAGS}"
  99. export CXXFLAGS="${TARGET_CXXFLAGS} ${EXTRA_CXXFLAGS}"
  100. export LDFLAGS="${TARGET_LDFLAGS} ${EXTRA_LDFLAGS}"
  101. export PKG_CONFIG_PATH="${TARGET_PKG_CONFIG_PATH}"
  102. unset CPPFLAGS
  103. export OLD_PATH="${PATH}"
  104. export PATH="${TARGET_PATH}"
  105. if [ -d "${PAWPAW_ROOT}/patches/${name}" ] && [ ! -f "${pkgdir}/.stamp_cleanup" ]; then
  106. for p in $(ls "${PAWPAW_ROOT}/patches/${name}/" | grep "\.patch$" | sort); do
  107. if [ ! -f "${pkgdir}/.stamp_applied_${p}" ]; then
  108. patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${name}/${p}"
  109. touch "${pkgdir}/.stamp_applied_${p}"
  110. fi
  111. done
  112. fi
  113. if [ -d "${PAWPAW_ROOT}/patches/${name}/${PAWPAW_TARGET}" ] && [ ! -f "${pkgdir}/.stamp_cleanup" ]; then
  114. for p in $(ls "${PAWPAW_ROOT}/patches/${name}/${PAWPAW_TARGET}/" | grep "\.patch$" | sort); do
  115. if [ ! -f "${pkgdir}/.stamp_applied_${p}" ]; then
  116. patch -p1 -d "${pkgdir}" -i "${PAWPAW_ROOT}/patches/${name}/${PAWPAW_TARGET}/${p}"
  117. touch "${pkgdir}/.stamp_applied_${p}"
  118. fi
  119. done
  120. fi
  121. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  122. rm -f "${pkgdir}/.stamp_built"
  123. rm -f "${pkgdir}/.stamp_installed"
  124. rm -f "${pkgdir}/.stamp_verified"
  125. rm -f "${pkgdir}/CMakeCache.txt"
  126. elif [ ! -f "${pkgdir}/.stamp_built" ]; then
  127. rm -f "${pkgdir}/.stamp_installed"
  128. rm -f "${pkgdir}/.stamp_verified"
  129. elif [ ! -f "${pkgdir}/.stamp_installed" ]; then
  130. rm -f "${pkgdir}/.stamp_verified"
  131. fi
  132. }
  133. function _postbuild() {
  134. unset AR
  135. unset CC
  136. unset CXX
  137. unset DLLWRAP
  138. unset LD
  139. unset STRIP
  140. unset WINDRES
  141. unset CFLAGS
  142. unset CPPFLAGS
  143. unset CXXFLAGS
  144. unset LDFLAGS
  145. unset PKG_CONFIG_PATH
  146. unset EXTRA_CFLAGS
  147. unset EXTRA_CXXFLAGS
  148. unset EXTRA_LDFLAGS
  149. unset EXTRA_MAKE_ARGS
  150. export PATH="${OLD_PATH}"
  151. }
  152. # ---------------------------------------------------------------------------------------------------------------------
  153. function build_autoconf() {
  154. local name="${1}"
  155. local version="${2}"
  156. local extraconfrules="${3}"
  157. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  158. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  159. extraconfrules="--host=${TOOLCHAIN_PREFIX} ${extraconfrules}"
  160. fi
  161. _prebuild "${name}" "${pkgdir}"
  162. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  163. pushd "${pkgdir}"
  164. ./configure --enable-static --disable-shared --disable-debug --disable-doc --disable-docs --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  165. touch .stamp_configured
  166. popd
  167. fi
  168. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  169. pushd "${pkgdir}"
  170. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  171. touch .stamp_built
  172. popd
  173. fi
  174. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  175. pushd "${pkgdir}"
  176. make ${MAKE_ARGS} install -j 1
  177. touch .stamp_installed
  178. popd
  179. fi
  180. _postbuild
  181. }
  182. function build_autoconfgen() {
  183. local name="${1}"
  184. local version="${2}"
  185. local extraconfrules="${3}"
  186. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  187. local EXTRA_CFLAGS2="${EXTRA_CFLAGS}"
  188. local EXTRA_CXXFLAGS2="${EXTRA_CXXFLAGS}"
  189. local EXTRA_LDFLAGS2="${EXTRA_LDFLAGS}"
  190. local EXTRA_MAKE_ARGS2="${EXTRA_MAKE_ARGS}"
  191. _prebuild "${name}" "${pkgdir}"
  192. if [ ! -f "${pkgdir}/.stamp_preconfigured" ]; then
  193. pushd "${pkgdir}"
  194. if [ -f utils/autogen.sh ]; then
  195. ./utils/autogen.sh
  196. else
  197. autoconf
  198. fi
  199. touch .stamp_preconfigured
  200. popd
  201. fi
  202. _postbuild
  203. export EXTRA_CFLAGS="${EXTRA_CFLAGS2}"
  204. export EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS2}"
  205. export EXTRA_LDFLAGS="${EXTRA_LDFLAGS2}"
  206. export EXTRA_MAKE_ARGS="${EXTRA_MAKE_ARGS2}"
  207. build_autoconf "${name}" "${version}" "${extraconfrules}"
  208. }
  209. function build_conf() {
  210. local name="${1}"
  211. local version="${2}"
  212. local extraconfrules="${3}"
  213. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  214. _prebuild "${name}" "${pkgdir}"
  215. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  216. pushd "${pkgdir}"
  217. ./configure ${extraconfrules}
  218. touch .stamp_configured
  219. popd
  220. fi
  221. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  222. pushd "${pkgdir}"
  223. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  224. touch .stamp_built
  225. popd
  226. fi
  227. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  228. pushd "${pkgdir}"
  229. make ${MAKE_ARGS} -j 1 install
  230. touch .stamp_installed
  231. popd
  232. fi
  233. _postbuild
  234. }
  235. function build_cmake() {
  236. local name="${1}"
  237. local version="${2}"
  238. local extraconfrules="${3}"
  239. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  240. _prebuild "${name}" "${pkgdir}"
  241. mkdir -p "${pkgdir}/build"
  242. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  243. extraconfrules+=" -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}"
  244. fi
  245. if [ "${MACOS}" -eq 1 ]; then
  246. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  247. OSX_ARCHS="arm64;x86_64"
  248. OSX_TARGET="10.12"
  249. else
  250. OSX_ARCHS="x86_64"
  251. OSX_TARGET="10.8"
  252. fi
  253. extraconfrules+=" -DCMAKE_OSX_ARCHITECTURES=${OSX_ARCHS}"
  254. extraconfrules+=" -DCMAKE_OSX_DEPLOYMENT_TARGET=${OSX_TARGET}"
  255. fi
  256. if [ "${WIN32}" -eq 1 ]; then
  257. extraconfrules+=" -DCMAKE_RC_COMPILER=${WINDRES}"
  258. fi
  259. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  260. pushd "${pkgdir}/build"
  261. cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX="${PAWPAW_PREFIX}" ${extraconfrules} ..
  262. touch ../.stamp_configured
  263. popd
  264. fi
  265. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  266. pushd "${pkgdir}/build"
  267. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  268. touch ../.stamp_built
  269. popd
  270. fi
  271. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  272. pushd "${pkgdir}/build"
  273. make ${MAKE_ARGS} -j 1 install
  274. touch ../.stamp_installed
  275. popd
  276. fi
  277. _postbuild
  278. }
  279. function build_make() {
  280. local name="${1}"
  281. local version="${2}"
  282. local extraconfrules="${3}"
  283. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  284. _prebuild "${name}" "${pkgdir}"
  285. touch "${pkgdir}/.stamp_configured"
  286. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  287. pushd "${pkgdir}"
  288. make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS} ${extraconfrules}
  289. touch .stamp_built
  290. popd
  291. fi
  292. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  293. pushd "${pkgdir}"
  294. make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS} ${extraconfrules} -j 1 install
  295. touch .stamp_installed
  296. popd
  297. fi
  298. _postbuild
  299. }
  300. function build_meson() {
  301. local name="${1}"
  302. local version="${2}"
  303. local extraconfrules="${3}"
  304. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  305. if [ "${CROSS_COMPILING}" -eq 1 ]; then
  306. extraconfrules="--cross-file "${PAWPAW_ROOT}/setup/meson/${PAWPAW_TARGET}.ini" ${extraconfrules}"
  307. fi
  308. _prebuild "${name}" "${pkgdir}"
  309. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  310. pushd "${pkgdir}"
  311. meson build --buildtype release --prefix "${PAWPAW_PREFIX}" ${extraconfrules}
  312. touch .stamp_configured
  313. popd
  314. fi
  315. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  316. pushd "${pkgdir}"
  317. ninja -v -C build
  318. touch .stamp_built
  319. popd
  320. fi
  321. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  322. pushd "${pkgdir}"
  323. ninja -C build install
  324. touch .stamp_installed
  325. popd
  326. fi
  327. _postbuild
  328. }
  329. function build_python() {
  330. local name="${1}"
  331. local version="${2}"
  332. local extraconfrules="${3}"
  333. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  334. local python="python$(echo ${PYTHON_VERSION} | cut -b 1,2,3)"
  335. _prebuild "${name}" "${pkgdir}"
  336. # fix build of python packages
  337. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fvisibility=hidden//')"
  338. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-ffast-math//')"
  339. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  340. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility=hidden//')"
  341. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-ffast-math//')"
  342. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility-inlines-hidden//')"
  343. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  344. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip -Wl,-dead_strip_dylibs//')"
  345. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--strip-all//')"
  346. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,--gc-sections//')"
  347. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  348. touch "${pkgdir}/.stamp_configured"
  349. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  350. pushd "${pkgdir}"
  351. ${python} setup.py build ${extraconfrules} --verbose
  352. touch .stamp_built
  353. popd
  354. fi
  355. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  356. pushd "${pkgdir}"
  357. ${python} setup.py install --prefix="${PAWPAW_PREFIX}" ${extraconfrules} --verbose
  358. touch .stamp_installed
  359. popd
  360. fi
  361. _postbuild
  362. }
  363. function build_qmake() {
  364. local name="${1}"
  365. local version="${2}"
  366. local extraconfrules="${3}"
  367. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  368. _prebuild "${name}" "${pkgdir}"
  369. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  370. pushd "${pkgdir}"
  371. qmake ${extraconfrules}
  372. touch .stamp_configured
  373. popd
  374. fi
  375. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  376. pushd "${pkgdir}"
  377. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  378. touch .stamp_built
  379. popd
  380. fi
  381. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  382. pushd "${pkgdir}"
  383. make ${MAKE_ARGS} -j 1 install
  384. touch .stamp_installed
  385. popd
  386. fi
  387. _postbuild
  388. }
  389. function build_waf() {
  390. local name="${1}"
  391. local version="${2}"
  392. local extraconfrules="${3}"
  393. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  394. local python=python3
  395. if ! which python3 > /dev/null; then
  396. python=python
  397. fi
  398. _prebuild "${name}" "${pkgdir}"
  399. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  400. pushd "${pkgdir}"
  401. ${python} waf configure --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  402. touch .stamp_configured
  403. popd
  404. fi
  405. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  406. pushd "${pkgdir}"
  407. ${python} waf build ${WAF_ARGS}
  408. touch .stamp_built
  409. popd
  410. fi
  411. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  412. pushd "${pkgdir}"
  413. ${python} waf install ${WAF_ARGS} --prefix="${PAWPAW_PREFIX}" ${extraconfrules} -j 1
  414. rm -f ${PAWPAW_PREFIX}/lib/lv2/*/*.a
  415. touch .stamp_installed
  416. popd
  417. fi
  418. _postbuild
  419. }
  420. # ---------------------------------------------------------------------------------------------------------------------
  421. function run_make() {
  422. local name="${1}"
  423. local version="${2}"
  424. local makerule="${3}"
  425. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  426. _prebuild "${name}" "${pkgdir}"
  427. if [ ! -f "${pkgdir}/.stamp_custom_run" ]; then
  428. pushd "${pkgdir}"
  429. make ${MAKE_ARGS} ${makerule}
  430. touch .stamp_custom_run
  431. popd
  432. fi
  433. _postbuild
  434. }
  435. # ---------------------------------------------------------------------------------------------------------------------
  436. function build_host_autoconf() {
  437. local name="${1}"
  438. local version="${2}"
  439. local extraconfrules="${3}"
  440. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  441. unset AR
  442. unset CC
  443. unset CXX
  444. unset LD
  445. unset STRIP
  446. unset CFLAGS
  447. unset CPPFLAGS
  448. unset CXXFLAGS
  449. unset LDFLAGS
  450. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  451. pushd "${pkgdir}"
  452. ./configure --enable-static --disable-shared --disable-maintainer-mode --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
  453. touch .stamp_configured
  454. popd
  455. fi
  456. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  457. pushd "${pkgdir}"
  458. make ${MAKE_ARGS}
  459. touch .stamp_built
  460. popd
  461. fi
  462. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  463. pushd "${pkgdir}"
  464. make ${MAKE_ARGS} install -j 1
  465. touch .stamp_installed
  466. popd
  467. fi
  468. }
  469. # ---------------------------------------------------------------------------------------------------------------------
  470. function patch_file() {
  471. local name="${1}"
  472. local version="${2}"
  473. local file="${3}"
  474. local rule="${4}"
  475. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  476. if [ -e "${pkgdir}/${file}" ]; then
  477. sed -i -e "${rule}" "${pkgdir}/${file}"
  478. fi
  479. }
  480. function copy_file() {
  481. local name="${1}"
  482. local version="${2}"
  483. local source="${3}"
  484. local target="${4}"
  485. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  486. if [ ! -e "${pkgdir}/${target}" ] || [ "${source}" -nt "${target}" ]; then
  487. pushd "${pkgdir}"
  488. cp -v "${source}" "${target}"
  489. popd
  490. fi
  491. }
  492. function install_file() {
  493. local name="${1}"
  494. local version="${2}"
  495. local source="${3}"
  496. local targetdir="${4}"
  497. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  498. if [ ! -e "${PAWPAW_PREFIX}/${targetdir}/$(basename ${source})" ]; then
  499. pushd "${pkgdir}"
  500. cp -v "${source}" "${PAWPAW_PREFIX}/${targetdir}/"
  501. popd
  502. fi
  503. }
  504. function link_file() {
  505. local name="${1}"
  506. local version="${2}"
  507. local source="${3}"
  508. local target="${4}"
  509. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  510. if [ ! -e "${pkgdir}/${target}" ]; then
  511. pushd "${pkgdir}"
  512. ln -sfv "${source}" "${target}"
  513. popd
  514. fi
  515. }
  516. function remove_file() {
  517. local name="${1}"
  518. local version="${2}"
  519. local file="${3}"
  520. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  521. if [ -e "${pkgdir}/${file}" ]; then
  522. rm -fv "${pkgdir}/${file}"
  523. fi
  524. }
  525. # ---------------------------------------------------------------------------------------------------------------------
  526. function patch_osx_binary_libs() {
  527. local file="${1}"
  528. if [ -L "${file}" ]; then
  529. return 0
  530. fi
  531. idname=$(otool -D "${file}")
  532. if otool -L "${file}" | grep -v ":" | grep -v "${idname}" | grep -q "${PAWPAW_PREFIX}"; then
  533. #install_name_tool -change "@rpath/QtCore.framework/Versions/5/QtCore" "@executable_path/QtCore" "${file}"
  534. #install_name_tool -change "@rpath/QtGui.framework/Versions/5/QtGui" "@executable_path/QtGui" "${file}"
  535. #install_name_tool -change "@rpath/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/QtWidgets" "${file}"
  536. #install_name_tool -change "@rpath/QtXml.framework/Versions/5/QtXml" "@executable_path/QtXml" "${file}"
  537. install_name_tool -change "@executable_path/../Frameworks/libjack.0.dylib" "/usr/local/lib/libjack.0.dylib" "${file}"
  538. install_name_tool -change "${PAWPAW_PREFIX}/jack2/lib/libjack.0.dylib" "/usr/local/lib/libjack.0.dylib" "${file}"
  539. install_name_tool -change "${PAWPAW_PREFIX}/jack2/lib/libjacknet.0.dylib" "/usr/local/lib/libjacknet.0.dylib" "${file}"
  540. install_name_tool -change "${PAWPAW_PREFIX}/jack2/lib/libjackserver.0.dylib" "/usr/local/lib/libjackserver.0.dylib" "${file}"
  541. fi
  542. }
  543. function patch_osx_qtapp() {
  544. local name="${1}"
  545. local version="${2}"
  546. local appfile="${3}"
  547. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  548. _prebuild "${name}" "${pkgdir}"
  549. mkdir -p "${appfile}/Contents/PlugIns/platforms"
  550. mkdir -p "${appfile}/Contents/PlugIns/printsupport"
  551. cp -v "${PAWPAW_PREFIX}/lib/qt5/plugins/platforms/libqcocoa.dylib" "${appfile}/Contents/PlugIns/platforms/"
  552. cp -v "${PAWPAW_PREFIX}/lib/qt5/plugins/printsupport/libcocoaprintersupport.dylib" "${appfile}/Contents/PlugIns/printsupport/"
  553. macdeployqt "${appfile}"
  554. rm -f "${appfile}/Contents/Frameworks/libjack.0.1.0.dylib"
  555. _postbuild
  556. }
  557. # ---------------------------------------------------------------------------------------------------------------------