Audio plugin host https://kx.studio/carla
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.

216 lines
5.9KB

  1. #!/bin/bash
  2. # ---------------------------------------------------------------------------------------------------------------------
  3. # stop on error
  4. set -e
  5. # ---------------------------------------------------------------------------------------------------------------------
  6. # cd to correct path
  7. cd $(dirname $0)
  8. # ---------------------------------------------------------------------------------------------------------------------
  9. # set variables
  10. source common.env
  11. # ---------------------------------------------------------------------------------------------------------------------
  12. # function to download python stuff from msys2
  13. download_python()
  14. {
  15. # ---------------------------------------------------------------------------------------------------------------------
  16. # setup
  17. if [ x"${ARCH}" != x"32" ]; then
  18. CPUARCH="x86_64"
  19. else
  20. CPUARCH="i686"
  21. fi
  22. # ---------------------------------------------------------------------------------------------------------------------
  23. # list packages
  24. PACKAGES=(
  25. "binutils-2.32-3"
  26. "bzip2-1.0.8-1"
  27. "crt-git-7.0.0.5524.2346384e-1"
  28. "dbus-1.12.8-1"
  29. "double-conversion-3.1.5-1"
  30. "expat-2.2.8-1"
  31. "freetype-2.10.1-1"
  32. "gcc-9.2.0-2"
  33. "gcc-libs-9.2.0-2"
  34. "gettext-0.19.8.1-8"
  35. "glib2-2.62.1-1"
  36. "gmp-6.1.2-1"
  37. "graphite2-1.3.13-1"
  38. "harfbuzz-2.6.2-1"
  39. "icu-64.2-1"
  40. "jasper-2.0.16-1"
  41. "libffi-3.2.1-4"
  42. "libiconv-1.16-1"
  43. "libjpeg-turbo-2.0.3-1"
  44. "libpng-1.6.37-3"
  45. "libtiff-4.0.9-2"
  46. "libwebp-1.0.3-1"
  47. "libxml2-2.9.9-2"
  48. "libxslt-1.1.33-1"
  49. "libwinpthread-git-7.0.0.5522.977a9720-1"
  50. "headers-git-7.0.0.5524.2346384e-1"
  51. "openssl-1.1.1.d-1"
  52. "pcre-8.43-1"
  53. "pcre2-10.33-1"
  54. "pyqt5-common-5.13.1-1"
  55. "python3-3.7.4-7"
  56. "python3-cx_Freeze-5.1.1-3"
  57. "python3-nuitka-0.6.4-1"
  58. "python3-sip-4.19.19-1"
  59. "python3-pyqt5-5.13.1-1"
  60. "qt5-5.13.1-1"
  61. "qtwebkit-5.212.0alpha2-6"
  62. "sqlite3-3.30.0-1"
  63. "windows-default-manifest-6.4-3"
  64. "winpthreads-git-7.0.0.5522.977a9720-1"
  65. "xz-5.2.4-1"
  66. "zlib-1.2.11-7"
  67. "zstd-1.4.3-1"
  68. )
  69. # qt5-static-5.12.4-1
  70. PKG_DIR="$(pwd)/python-pkgs-${CPUARCH}"
  71. PKG_PREFIX="mingw-w64-${CPUARCH}-"
  72. PKG_SUFFIX="-any.pkg.tar.xz"
  73. REPO_URL="http://repo.msys2.org/mingw/${CPUARCH}"
  74. # ---------------------------------------------------------------------------------------------------------------------
  75. # download stuff
  76. mkdir -p "${PKG_DIR}"
  77. pushd "${PKG_DIR}"
  78. for PKG in ${PACKAGES[@]}; do
  79. wget -c "${REPO_URL}/${PKG_PREFIX}${PKG}${PKG_SUFFIX}"
  80. done
  81. popd
  82. # ---------------------------------------------------------------------------------------------------------------------
  83. # extract into target dir
  84. rm -rf "${TARGETDIR}/msys2-${CPUARCH}"
  85. mkdir "${TARGETDIR}/msys2-${CPUARCH}"
  86. pushd "${TARGETDIR}/msys2-${CPUARCH}"
  87. for PKG in ${PACKAGES[@]}; do
  88. tar xf "${PKG_DIR}/${PKG_PREFIX}${PKG}${PKG_SUFFIX}"
  89. done
  90. sed -i "s|E:/mingwbuild/mingw-w64-qt5/pkg/mingw-w64-${CPUARCH}-qt5|${TARGETDIR}/msys2-${CPUARCH}|" ./mingw${ARCH}/lib/pkgconfig/Qt5*.pc
  91. popd
  92. }
  93. # ---------------------------------------------------------------------------------------------------------------------
  94. # function to build python modules
  95. build_python()
  96. {
  97. # ---------------------------------------------------------------------------------------------------------------------
  98. # setup
  99. if [ x"${ARCH}" != x"32" ]; then
  100. CPUARCH="x86_64"
  101. else
  102. CPUARCH="i686"
  103. fi
  104. # ---------------------------------------------------------------------------------------------------------------------
  105. # clean env
  106. unset AR
  107. unset CC
  108. unset CXX
  109. unset STRIP
  110. unset WINDRES
  111. unset CFLAGS
  112. unset CPPFLAGS
  113. unset CXXFLAGS
  114. unset LDFLAGS
  115. export DEPS_PREFIX=${TARGETDIR}/carla-w${ARCH_PREFIX}
  116. export MSYS2_PREFIX=${TARGETDIR}/msys2-${CPUARCH}/mingw${ARCH}
  117. export PATH=${DEPS_PREFIX}/bin:${MSYS2_PREFIX}/bin:/usr/sbin:/usr/bin:/sbin:/bin
  118. export PKG_CONFIG_PATH=${DEPS_PREFIX}/lib/pkgconfig:${MSYS2_PREFIX}/lib/pkgconfig
  119. HOST_ARCH=$(dpkg-architecture -qDEB_BUILD_GNU_TYPE)
  120. MINGW_PREFIX="${CPUARCH}-w64-mingw32"
  121. export AR=${MINGW_PREFIX}-ar
  122. export CC=${MINGW_PREFIX}-gcc
  123. export CXX=${MINGW_PREFIX}-g++
  124. export STRIP=${MINGW_PREFIX}-strip
  125. export WINDRES=${MINGW_PREFIX}-windres
  126. export CFLAGS="-O2 -DNDEBUG -mstackrealign -fvisibility=hidden -fdata-sections -ffunction-sections"
  127. export CFLAGS="${CFLAGS} -I${DEPS_PREFIX}/include -I${MSYS2_PREFIX}/include"
  128. export CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
  129. export LDFLAGS="-Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
  130. export LDFLAGS="${LDFLAGS} -L${DEPS_PREFIX}/lib -L${MSYS2_PREFIX}/lib"
  131. # ---------------------------------------------------------------------------------------------------------------------
  132. # pyliblo
  133. if [ ! -d pyliblo-${PYLIBLO_VERSION} ]; then
  134. wget -c http://das.nasophon.de/download/pyliblo-${PYLIBLO_VERSION}.tar.gz
  135. tar -xf pyliblo-${PYLIBLO_VERSION}.tar.gz
  136. fi
  137. if [ ! -f pyliblo-${PYLIBLO_VERSION}/build-done ]; then
  138. cd pyliblo-${PYLIBLO_VERSION}
  139. if [ ! -f patched ]; then
  140. patch -p1 -i ../patches/pyliblo-python3.7.patch
  141. touch patched
  142. fi
  143. mkdir -p build
  144. # build
  145. ${CC} -pthread -Wall ${CFLAGS} \
  146. src/liblo.c -c -o build/liblo.o \
  147. $(python3-config --cflags | awk 'sub("-ne ","")') \
  148. -D_FORTIFY_SOURCE=2 -fPIC -fno-strict-aliasing \
  149. -Wdate-time -Werror-implicit-function-declaration -Wfatal-errors
  150. # link
  151. ${CC} -pthread -shared ${LDFLAGS} \
  152. build/liblo.o -o build/liblo-cpython-37m.dll \
  153. -llo $(python3-config --ldflags | awk 'sub("-ne ","")') -lws2_32 -liphlpapi
  154. # install
  155. install -m 644 build/liblo-cpython-37m.dll ${MSYS2_PREFIX}/lib/python3.7/site-packages/
  156. touch build-done
  157. cd ..
  158. fi
  159. }
  160. # ---------------------------------------------------------------------------------------------------------------------
  161. # build base libs
  162. export ARCH=32
  163. export ARCH_PREFIX=32nosse
  164. download_python
  165. build_python
  166. export ARCH=64
  167. export ARCH_PREFIX=64
  168. download_python
  169. build_python
  170. # ---------------------------------------------------------------------------------------------------------------------