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.

220 lines
8.2KB

  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. # run bootstrap dependencies
  14. ./bootstrap-common.sh "${target}"
  15. ./bootstrap-plugins.sh "${target}"
  16. ./bootstrap-qt.sh "${target}"
  17. # ---------------------------------------------------------------------------------------------------------------------
  18. # source setup code
  19. source setup/check_target.sh
  20. source setup/env.sh
  21. source setup/functions.sh
  22. source setup/versions.sh
  23. # ---------------------------------------------------------------------------------------------------------------------
  24. # custom function as needed for pyqt packages
  25. function build_conf_python() {
  26. local name="${1}"
  27. local version="${2}"
  28. local extraconfrules="${3}"
  29. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  30. _prebuild "${name}" "${pkgdir}"
  31. # remove flags not compatible with python
  32. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fvisibility=hidden//')"
  33. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-ffast-math//')"
  34. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  35. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip -Wl,-dead_strip_dylibs//')"
  36. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  37. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  38. pushd "${pkgdir}"
  39. ./configure ${extraconfrules}
  40. touch .stamp_configured
  41. popd
  42. fi
  43. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  44. pushd "${pkgdir}"
  45. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  46. touch .stamp_built
  47. popd
  48. fi
  49. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  50. pushd "${pkgdir}"
  51. make ${MAKE_ARGS} -j 1 install
  52. touch .stamp_installed
  53. popd
  54. fi
  55. _postbuild
  56. }
  57. function build_pyqt() {
  58. local name="${1}"
  59. local version="${2}"
  60. local extraconfrules="${3}"
  61. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  62. _prebuild "${name}" "${pkgdir}"
  63. # remove flags not compatible with python
  64. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fvisibility=hidden//')"
  65. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-ffast-math//')"
  66. export CFLAGS="$(echo ${CFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  67. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility=hidden//')"
  68. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-ffast-math//')"
  69. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fvisibility-inlines-hidden//')"
  70. export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  71. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip -Wl,-dead_strip_dylibs//')"
  72. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  73. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  74. pushd "${pkgdir}"
  75. python3 configure.py ${extraconfrules}
  76. # used in sip
  77. sed -i -e 's/CFLAGS *=/CFLAGS +=/' */Makefile
  78. sed -i -e 's/CXXFLAGS *=/CXXFLAGS +=/' */Makefile
  79. sed -i -e 's/LIBS *=/LIBS += $(LDFLAGS)/' */Makefile
  80. sed -i -e 's|$(DESTDIR)/usr|$(DESTDIR)$(PREFIX)|g' */Makefile
  81. touch .stamp_configured
  82. popd
  83. fi
  84. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  85. pushd "${pkgdir}"
  86. make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS}
  87. touch .stamp_built
  88. popd
  89. fi
  90. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  91. pushd "${pkgdir}"
  92. make PREFIX="${PAWPAW_PREFIX}" PKG_CONFIG="${TARGET_PKG_CONFIG}" ${MAKE_ARGS} -j 1 install
  93. touch .stamp_installed
  94. popd
  95. fi
  96. }
  97. # ---------------------------------------------------------------------------------------------------------------------
  98. # file/magic (posix only)
  99. if [ "${WIN32}" -eq 0 ]; then
  100. download file "${FILE_VERSION}" "ftp://ftp.astron.com/pub/file"
  101. build_autoconf file "${FILE_VERSION}"
  102. fi
  103. # ---------------------------------------------------------------------------------------------------------------------
  104. # python
  105. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  106. PYTHON_EXTRAFLAGS="--enable-optimizations"
  107. fi
  108. download Python "${PYTHON_VERSION}" "https://www.python.org/ftp/python/${PYTHON_VERSION}" "tgz"
  109. if [ "${PYTHON_VERSION}" = "3.7.4" ]; then
  110. patch_file Python "${PYTHON_VERSION}" "Modules/Setup.dist" 's/#zlib zlibmodule.c/zlib zlibmodule.c/'
  111. fi
  112. build_conf_python Python "${PYTHON_VERSION}" "--prefix=${PAWPAW_PREFIX} --enable-shared ${PYTHON_EXTRAFLAGS}"
  113. # ---------------------------------------------------------------------------------------------------------------------
  114. # sip
  115. if [ "${SIP_VERSION}" = "4.19.19" ]; then
  116. SIP_DOWNLOAD_URL="https://files.kde.org/krita/build/dependencies"
  117. SIP_EXTRAFLAGS="--sip-module PyQt5.sip"
  118. else
  119. SIP_DOWNLOAD_URL="http://sourceforge.net/projects/pyqt/files/sip/sip-${SIP_VERSION}"
  120. fi
  121. download sip "${SIP_VERSION}" "${SIP_DOWNLOAD_URL}"
  122. build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}"
  123. # ---------------------------------------------------------------------------------------------------------------------
  124. # pyqt5
  125. if [ "${PYQT5_VERSION}" = "5.13.1" ]; then
  126. PYQT5_DOWNLOAD_URL="https://files.kde.org/krita/build/dependencies"
  127. PYQT5_SUFFIX="_gpl"
  128. else
  129. PYQT5_DOWNLOAD_URL="http://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-${PYQT5_VERSION}"
  130. PYQT5_SUFFIX="_gpl"
  131. fi
  132. download PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "${PYQT5_DOWNLOAD_URL}"
  133. build_pyqt PyQt5${PYQT5_SUFFIX} "${PYQT5_VERSION}" "--concatenate --confirm-license -c"
  134. # ---------------------------------------------------------------------------------------------------------------------
  135. # pyliblo
  136. download pyliblo "${PYLIBLO_VERSION}" "http://das.nasophon.de/download"
  137. build_python pyliblo "${PYLIBLO_VERSION}"
  138. # ---------------------------------------------------------------------------------------------------------------------
  139. # setuptools_scm (optional)
  140. if [ -n "${SETUPTOOLS_SCM_VERSION}" ]; then
  141. download setuptools_scm "${SETUPTOOLS_SCM_VERSION}" "https://files.pythonhosted.org/packages/ed/b6/979bfa7b81878b2b4475dde092aac517e7f25dd33661796ec35664907b31"
  142. build_python setuptools_scm "${SETUPTOOLS_SCM_VERSION}"
  143. fi
  144. # ---------------------------------------------------------------------------------------------------------------------
  145. # toml (optional)
  146. if [ -n "${TOML_VERSION}" ]; then
  147. download toml "${TOML_VERSION}" "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c"
  148. build_python toml "${TOML_VERSION}"
  149. fi
  150. # ---------------------------------------------------------------------------------------------------------------------
  151. # zipp (optional)
  152. if [ -n "${ZIPP_VERSION}" ]; then
  153. download zipp "${ZIPP_VERSION}" "https://files.pythonhosted.org/packages/ce/b0/757db659e8b91cb3ea47d90350d7735817fe1df36086afc77c1c4610d559"
  154. build_python zipp "${ZIPP_VERSION}"
  155. fi
  156. # ---------------------------------------------------------------------------------------------------------------------
  157. # importlib_metadata (optional)
  158. if [ -n "${IMPORTLIB_METADATA_VERSION}" ]; then
  159. download importlib_metadata "${IMPORTLIB_METADATA_VERSION}" "https://files.pythonhosted.org/packages/3f/a8/16dc098b0addd1c20719c18a86e985be851b3ec1e103e703297169bb22cc"
  160. build_python importlib_metadata "${IMPORTLIB_METADATA_VERSION}"
  161. fi
  162. # ---------------------------------------------------------------------------------------------------------------------
  163. # cxfreeze
  164. download cx_Freeze "${CXFREEZE_VERSION}" "https://github.com/anthony-tuininga/cx_Freeze/archive" "" "nv"
  165. if [ "${CXFREEZE_VERSION}" = "6.4.2" ]; then
  166. patch_file cx_Freeze "${CXFREEZE_VERSION}" "setup.py" 's/extra_postargs=extraArgs,/extra_postargs=extraArgs+os.getenv("LDFLAGS").split(),/'
  167. patch_file cx_Freeze "${CXFREEZE_VERSION}" "cx_Freeze/macdist.py" 's/, use_builtin_types=False//'
  168. fi
  169. build_python cx_Freeze "${CXFREEZE_VERSION}"
  170. # ---------------------------------------------------------------------------------------------------------------------