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.

189 lines
6.8KB

  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/-fdata-sections -ffunction-sections//')"
  34. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-Wl,-dead_strip -Wl,-dead_strip_dylibs//')"
  35. export LDFLAGS="$(echo ${LDFLAGS} | sed -e 's/-fdata-sections -ffunction-sections//')"
  36. if [ ! -f "${pkgdir}/.stamp_configured" ]; then
  37. pushd "${pkgdir}"
  38. ./configure ${extraconfrules}
  39. touch .stamp_configured
  40. popd
  41. fi
  42. if [ ! -f "${pkgdir}/.stamp_built" ]; then
  43. pushd "${pkgdir}"
  44. make ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  45. touch .stamp_built
  46. popd
  47. fi
  48. if [ ! -f "${pkgdir}/.stamp_installed" ]; then
  49. pushd "${pkgdir}"
  50. make ${MAKE_ARGS} -j 1 install
  51. touch .stamp_installed
  52. popd
  53. fi
  54. _postbuild
  55. }
  56. function build_pyqt() {
  57. local name="${1}"
  58. local version="${2}"
  59. local extraconfrules="${3}"
  60. local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"
  61. local python=python3
  62. if ! which python3 > /dev/null; then
  63. python=python
  64. fi
  65. local EXTRA_CFLAGS2="${EXTRA_CFLAGS}"
  66. local EXTRA_CXXFLAGS2="${EXTRA_CXXFLAGS}"
  67. local EXTRA_LDFLAGS2="${EXTRA_LDFLAGS}"
  68. local EXTRA_MAKE_ARGS2="${EXTRA_MAKE_ARGS}"
  69. _prebuild "${name}" "${pkgdir}"
  70. if [ ! -f "${pkgdir}/.stamp_preconfigured" ]; then
  71. pushd "${pkgdir}"
  72. ${python} configure.py ${extraconfrules}
  73. sed -i -e 's/CFLAGS =/CFLAGS +=/' */Makefile
  74. sed -i -e 's/CXXFLAGS =/CXXFLAGS +=/' */Makefile
  75. sed -i -e 's/LIBS =/LIBS += $(LDFLAGS)/' */Makefile
  76. touch .stamp_preconfigured
  77. popd
  78. fi
  79. _postbuild
  80. export EXTRA_CFLAGS="${EXTRA_CFLAGS2}"
  81. export EXTRA_CXXFLAGS="${EXTRA_CXXFLAGS2}"
  82. export EXTRA_LDFLAGS="${EXTRA_LDFLAGS2}"
  83. export EXTRA_MAKE_ARGS="${EXTRA_MAKE_ARGS2}"
  84. build_make "${name}" "${version}"
  85. }
  86. # ---------------------------------------------------------------------------------------------------------------------
  87. # file/magic (posix only)
  88. if [ "${WIN32}" -eq 0 ]; then
  89. download file "${FILE_VERSION}" "ftp://ftp.astron.com/pub/file"
  90. build_autoconf file "${FILE_VERSION}"
  91. fi
  92. # ---------------------------------------------------------------------------------------------------------------------
  93. # python
  94. if [ "${MACOS_UNIVERSAL}" -eq 1 ]; then
  95. PYTHON_EXTRAFLAGS = "--enable-optimizations"
  96. fi
  97. download Python "${PYTHON_VERSION}" "https://www.python.org/ftp/python/${PYTHON_VERSION}" "tgz"
  98. patch_file Python "${PYTHON_VERSION}" "Modules/Setup.dist" 's/#zlib zlibmodule.c/zlib zlibmodule.c/'
  99. build_conf_python Python "${PYTHON_VERSION}" "--prefix=${PAWPAW_PREFIX} --enable-shared ${PYTHON_EXTRAFLAGS}"
  100. # ---------------------------------------------------------------------------------------------------------------------
  101. # sip
  102. if [ "${SIP_VERSION}" = "4.19.19" ]; then
  103. SIP_EXTRAFLAGS = "--sip-module PyQt5.sip"
  104. fi
  105. download sip "${SIP_VERSION}" "https://files.kde.org/krita/build/dependencies"
  106. build_pyqt sip "${SIP_VERSION}" "${SIP_EXTRAFLAGS}"
  107. # ---------------------------------------------------------------------------------------------------------------------
  108. # pyqt5
  109. download PyQt5_gpl "${PYQT5_VERSION}" "https://files.kde.org/krita/build/dependencies"
  110. build_pyqt PyQt5_gpl "${PYQT5_VERSION}" "--concatenate --confirm-license -c"
  111. # ---------------------------------------------------------------------------------------------------------------------
  112. # pyliblo
  113. download pyliblo "${PYLIBLO_VERSION}" "http://das.nasophon.de/download"
  114. build_python pyliblo "${PYLIBLO_VERSION}"
  115. # ---------------------------------------------------------------------------------------------------------------------
  116. # setuptools_scm
  117. download setuptools_scm "${SETUPTOOLS_SCM_VERSION}" "https://files.pythonhosted.org/packages/ed/b6/979bfa7b81878b2b4475dde092aac517e7f25dd33661796ec35664907b31"
  118. build_python setuptools_scm "${SETUPTOOLS_SCM_VERSION}"
  119. # ---------------------------------------------------------------------------------------------------------------------
  120. # toml
  121. download toml "${TOML_VERSION}" "https://files.pythonhosted.org/packages/be/ba/1f744cdc819428fc6b5084ec34d9b30660f6f9daaf70eead706e3203ec3c"
  122. build_python toml "${TOML_VERSION}"
  123. # ---------------------------------------------------------------------------------------------------------------------
  124. # zipp
  125. download zipp "${ZIPP_VERSION}" "https://files.pythonhosted.org/packages/ce/b0/757db659e8b91cb3ea47d90350d7735817fe1df36086afc77c1c4610d559"
  126. build_python zipp "${ZIPP_VERSION}"
  127. # ---------------------------------------------------------------------------------------------------------------------
  128. # importlib_metadata
  129. download importlib_metadata "${IMPORTLIB_METADATA_VERSION}" "https://files.pythonhosted.org/packages/3f/a8/16dc098b0addd1c20719c18a86e985be851b3ec1e103e703297169bb22cc"
  130. build_python importlib_metadata "${IMPORTLIB_METADATA_VERSION}"
  131. # ---------------------------------------------------------------------------------------------------------------------
  132. # cxfreeze
  133. download cx_Freeze "${CXFREEZE_VERSION}" "https://github.com/anthony-tuininga/cx_Freeze/archive" "" "nv"
  134. patch_file cx_Freeze "${CXFREEZE_VERSION}" "setup.py" 's/"python%s.%s"/"python%s.%sm"/'
  135. patch_file cx_Freeze "${CXFREEZE_VERSION}" "setup.py" 's/extra_postargs=extraArgs,/extra_postargs=extraArgs+os.getenv("LDFLAGS").split(),/'
  136. patch_file cx_Freeze "${CXFREEZE_VERSION}" "cx_Freeze/macdist.py" 's/, use_builtin_types=False//'
  137. build_python cx_Freeze "${CXFREEZE_VERSION}"
  138. # ---------------------------------------------------------------------------------------------------------------------