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.

279 lines
10KB

  1. RACK_DIR ?= ..
  2. .NOTPARALLEL:
  3. # Target paths
  4. include $(RACK_DIR)/arch.mk
  5. ifdef ARCH_LIN
  6. glew = lib/libGLEW.a
  7. glfw = lib/libglfw3.a
  8. jansson = lib/libjansson.a
  9. openssl = lib/libcrypto.a
  10. libcurl = lib/libcurl.a
  11. zstd = lib/libzstd.a
  12. libarchive = lib/libarchive.a
  13. libspeexdsp = lib/libspeexdsp.a
  14. libsamplerate = lib/libsamplerate.a
  15. rtmidi = lib/librtmidi.a
  16. rtaudio = lib/librtaudio.a
  17. endif
  18. ifdef ARCH_MAC
  19. glew = lib/libGLEW.a
  20. glfw = lib/libglfw3.a
  21. jansson = lib/libjansson.a
  22. openssl = lib/libcrypto.a
  23. libcurl = lib/libcurl.a
  24. zstd = lib/libzstd.a
  25. libarchive = lib/libarchive.a
  26. libspeexdsp = lib/libspeexdsp.a
  27. libsamplerate = lib/libsamplerate.a
  28. rtmidi = lib/librtmidi.a
  29. rtaudio = lib/librtaudio.a
  30. endif
  31. ifdef ARCH_WIN
  32. glew = lib/libglew32.a
  33. glfw = lib/libglfw3.a
  34. jansson = lib/libjansson.a
  35. openssl = lib/libcrypto.a
  36. libcurl = lib/libcurl.a
  37. zstd = lib/libzstd.a
  38. libarchive = lib/libarchive.a
  39. libspeexdsp = lib/libspeexdsp.a
  40. libsamplerate = lib/libsamplerate.a
  41. rtmidi = lib/librtmidi.a
  42. rtaudio = lib/librtaudio.a
  43. endif
  44. nanovg = include/nanovg.h
  45. nanosvg = include/nanosvg.h
  46. oui-blendish = include/blendish.h
  47. osdialog = include/osdialog.h
  48. pffft = include/pffft.h
  49. fuzzysearchdatabase = include/FuzzySearchDatabase.hpp
  50. ghcfilesystem = include/ghc/filesystem.hpp
  51. tinyexpr = include/tinyexpr.h
  52. simde = include/simde
  53. DEPS += $(glew)
  54. DEPS += $(glfw)
  55. DEPS += $(jansson)
  56. DEPS += $(libcurl)
  57. DEPS += $(libarchive)
  58. DEPS += $(libspeexdsp)
  59. DEPS += $(libsamplerate)
  60. DEPS += $(rtmidi)
  61. DEPS += $(rtaudio)
  62. DEPS += $(nanovg)
  63. DEPS += $(nanosvg)
  64. DEPS += $(oui-blendish)
  65. DEPS += $(osdialog)
  66. DEPS += $(pffft)
  67. DEPS += $(fuzzysearchdatabase)
  68. DEPS += $(ghcfilesystem)
  69. DEPS += $(tinyexpr)
  70. DEPS += $(simde)
  71. DEP_LOCAL := .
  72. include $(RACK_DIR)/dep.mk
  73. # Targets
  74. # These targets are all order-only "|" because we usually don't care if a library was built before or after other libraries.
  75. glew-2.2.0:
  76. $(WGET) "https://github.com/nigels-com/glew/releases/download/glew-2.2.0/glew-2.2.0.tgz"
  77. $(SHA256) glew-2.2.0.tgz d4fc82893cfb00109578d0a1a2337fb8ca335b3ceccf97b97e5cc7f08e4353e1
  78. $(UNTAR) glew-2.2.0.tgz
  79. rm glew-2.2.0.tgz
  80. $(glew): | glew-2.2.0
  81. cd glew-2.2.0 && mkdir -p build
  82. # Increase policy version to support building with Cmake 4
  83. cd glew-2.2.0/build && $(CMAKE) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 cmake
  84. $(MAKE) -C glew-2.2.0/build
  85. $(MAKE) -C glew-2.2.0/build install
  86. $(glfw): | glfw
  87. cd glfw && mkdir -p build
  88. cd glfw/build && $(CMAKE) .. \
  89. -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_DOCS=OFF
  90. $(MAKE) -C glfw/build
  91. $(MAKE) -C glfw/build install
  92. jansson-2.12:
  93. $(WGET) "https://github.com/akheron/jansson/releases/download/v2.12/jansson-2.12.tar.gz" || $(WGET) "http://www.digip.org/jansson/releases/jansson-2.12.tar.gz"
  94. $(SHA256) jansson-2.12.tar.gz 5f8dec765048efac5d919aded51b26a32a05397ea207aa769ff6b53c7027d2c9
  95. $(UNTAR) jansson-2.12.tar.gz
  96. rm jansson-2.12.tar.gz
  97. $(jansson): | jansson-2.12
  98. cd jansson-2.12 && $(CONFIGURE)
  99. $(MAKE) -C jansson-2.12
  100. $(MAKE) -C jansson-2.12 install
  101. openssl-3.3.2:
  102. $(WGET) "https://github.com/openssl/openssl/releases/download/openssl-3.3.2/openssl-3.3.2.tar.gz"
  103. $(SHA256) openssl-3.3.2.tar.gz 2e8a40b01979afe8be0bbfb3de5dc1c6709fedb46d6c89c10da114ab5fc3d281
  104. $(UNTAR) openssl-3.3.2.tar.gz
  105. rm openssl-3.3.2.tar.gz
  106. $(openssl): | openssl-3.3.2
  107. # Set no-pinshared so OpenSSL doesn't call GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_PIN, ...) on initialization on Windows. This prevents libRack from being unloaded on Windows with FreeLibrary().
  108. # Don't use no-shared because libcurl's configure uses the shared library to find OpenSSL.
  109. cd openssl-3.3.2 && ./Configure --prefix="$(DEP_PATH)" --libdir=lib no-zlib no-capieng no-pinshared no-apps no-tests no-docs no-ui-console
  110. $(MAKE) -C openssl-3.3.2
  111. $(MAKE) -C openssl-3.3.2 install_sw
  112. curl-8.10.0:
  113. $(WGET) "https://github.com/curl/curl/releases/download/curl-8_10_0/curl-8.10.0.tar.gz" || $(WGET) "https://curl.se/download/curl-8.10.0.tar.gz"
  114. $(SHA256) curl-8.10.0.tar.gz 58c9dcf73493ae9d181fd334b3b3987ff73124621565187ade237bff1064a716
  115. $(UNTAR) curl-8.10.0.tar.gz
  116. rm curl-8.10.0.tar.gz
  117. CURL_FLAGS += --disable-symbol-hiding --enable-shared=no
  118. CURL_FLAGS += --enable-http --disable-ftp --disable-file --disable-ldap --disable-ldaps --disable-rtsp --enable-proxy --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-mqtt --disable-manual --disable-docs --disable-libcurl-option --enable-threaded-resolver --enable-pthreads --enable-verbose --disable-sspi --disable-aws --disable-ntlm --disable-tls-srp --disable-unix-sockets --disable-mime --disable-bindlocal --disable-netrc --disable-progress-meter --disable-alt-svc --disable-hsts
  119. CURL_FLAGS += --with-openssl="$(DEP_PATH)"
  120. CURL_FLAGS += --without-hyper --without-zlib --without-brotli --without-zstd --without-ca-fallback --without-ca-embed --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-apple-idn --without-libidn2 --without-nghttp2 --without-ngtcp2 --without-openssl-quic --without-nghttp3 --without-quiche --without-msh3 --without-libuv
  121. $(libcurl): | $(openssl) curl-8.10.0
  122. cd curl-8.10.0 && PKG_CONFIG_PATH= $(CONFIGURE) $(CURL_FLAGS)
  123. $(MAKE) -C curl-8.10.0
  124. $(MAKE) -C curl-8.10.0 install
  125. zstd-1.5.6:
  126. $(WGET) "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz"
  127. $(SHA256) zstd-1.5.6.tar.gz 8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1
  128. # HACK This tar archive creates a symlink "untar" to "tar" before tar exists. This is okay on UNIX but not on Windows where symlinks are copies of files. So create a fake "tar" so the unarchiving works.
  129. mkdir -p zstd-1.5.6/tests/cli-tests/bin
  130. touch zstd-1.5.6/tests/cli-tests/bin/zstd
  131. $(UNTAR) zstd-1.5.6.tar.gz
  132. rm zstd-1.5.6.tar.gz
  133. $(zstd): | zstd-1.5.6
  134. cd zstd-1.5.6/build/cmake && $(CMAKE) -DZSTD_BUILD_PROGRAMS=OFF -DZSTD_BUILD_SHARED=OFF -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_TESTS=OFF -DZSTD_MULTITHREAD_SUPPORT=OFF .
  135. $(MAKE) -C zstd-1.5.6/build/cmake
  136. $(MAKE) -C zstd-1.5.6/build/cmake install
  137. libarchive-3.7.7:
  138. $(WGET) "https://github.com/libarchive/libarchive/releases/download/v3.7.7/libarchive-3.7.7.tar.gz" || $(WGET) "https://libarchive.org/downloads/libarchive-3.7.7.tar.gz"
  139. $(SHA256) libarchive-3.7.7.tar.gz 4cc540a3e9a1eebdefa1045d2e4184831100667e6d7d5b315bb1cbc951f8ddff
  140. $(UNTAR) libarchive-3.7.7.tar.gz
  141. rm libarchive-3.7.7.tar.gz
  142. $(libarchive): | $(zstd) libarchive-3.7.7
  143. #cd libarchive-3.7.7 && $(CONFIGURE) --enable-shared=no --enable-static=yes --disable-bsdtar --disable-bsdcat --disable-bsdcpio --disable-posix-regex-lib --disable-xattr --disable-acl --without-zlib --without-bz2lib --without-libb2 --without-iconv --without-lz4 --without-lzma --without-cng --without-openssl --without-xml2 --without-expat
  144. cd libarchive-3.7.7 && mkdir -p build
  145. # Increase policy version to support building with Cmake 4
  146. cd libarchive-3.7.7/build && $(CMAKE) -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_ACL=OFF -DENABLE_BZip2=OFF -DENABLE_CAT=OFF -DENABLE_CNG=OFF -DENABLE_COVERAGE=OFF -DENABLE_CPIO=OFF -DENABLE_EXPAT=OFF -DENABLE_ICONV=OFF -DENABLE_LIBB2=OFF -DENABLE_LIBXML2=OFF -DENABLE_LZ4=OFF -DENABLE_LZMA=OFF -DENABLE_LZO=OFF -DENABLE_MBEDTLS=OFF -DENABLE_NETTLE=OFF -DENABLE_OPENSSL=OFF -DENABLE_TAR=OFF -DENABLE_TEST=OFF -DENABLE_UNZIP=OFF -DENABLE_WERROR=OFF -DENABLE_XATTR=OFF -DENABLE_ZLIB=OFF -DENABLE_ZSTD=ON -DWINDOWS_VERSION="WIN7" -DZSTD_INCLUDE_DIR:PATH=$(DEP_PATH)/include -DZSTD_LIBRARY=$(DEP_PATH)/lib/libzstd.a ..
  147. $(MAKE) -C libarchive-3.7.7/build
  148. $(MAKE) -C libarchive-3.7.7/build install
  149. $(libspeexdsp): | speexdsp
  150. cd speexdsp && ./autogen.sh
  151. cd speexdsp && $(CONFIGURE)
  152. $(MAKE) -C speexdsp
  153. $(MAKE) -C speexdsp install
  154. libsamplerate-0.1.9:
  155. $(WGET) "https://github.com/libsndfile/libsamplerate/releases/download/0.1.9/libsamplerate-0.1.9.tar.gz" || $(WGET) "http://www.mega-nerd.com/SRC/libsamplerate-0.1.9.tar.gz"
  156. $(SHA256) libsamplerate-0.1.9.tar.gz 0a7eb168e2f21353fb6d84da152e4512126f7dc48ccb0be80578c565413444c1
  157. $(UNTAR) libsamplerate-0.1.9.tar.gz
  158. rm libsamplerate-0.1.9.tar.gz
  159. $(libsamplerate): | libsamplerate-0.1.9
  160. cd libsamplerate-0.1.9 && $(CONFIGURE) --disable-fftw --disable-sndfile
  161. $(MAKE) -C libsamplerate-0.1.9
  162. $(MAKE) -C libsamplerate-0.1.9 install
  163. RTMIDI_FLAGS += --enable-shared=no
  164. ifdef ARCH_LIN
  165. RTMIDI_FLAGS += --with-alsa --with-jack
  166. endif
  167. ifdef ARCH_MAC
  168. RTMIDI_FLAGS += --with-core --without-jack
  169. endif
  170. ifdef ARCH_WIN
  171. RTMIDI_FLAGS += --with-winmm
  172. endif
  173. $(rtmidi): | rtmidi
  174. cd rtmidi && ./autogen.sh --no-configure
  175. cd rtmidi && $(CONFIGURE) $(RTMIDI_FLAGS)
  176. $(MAKE) -C rtmidi
  177. $(MAKE) -C rtmidi install
  178. RTAUDIO_FLAGS += -DBUILD_SHARED_LIBS=OFF
  179. ifdef ARCH_LIN
  180. RTAUDIO_FLAGS += -DRTAUDIO_API_ALSA=ON -DRTAUDIO_API_JACK=ON -DRTAUDIO_API_PULSE=ON -DRTAUDIO_API_OSS=OFF
  181. endif
  182. ifdef ARCH_MAC
  183. RTAUDIO_FLAGS += -DRTAUDIO_API_CORE=ON -DRTAUDIO_API_PULSE=OFF -DRTAUDIO_API_JACK=OFF
  184. endif
  185. ifdef ARCH_WIN
  186. RTAUDIO_FLAGS += -DRTAUDIO_API_DS=ON -DRTAUDIO_API_WASAPI=ON
  187. # ASIO is proprietary software owned by Steinberg, so distributing it with your own VCV Rack build would violate Rack's GPLv3 license.
  188. # However, since VCV owns the copyright of all GPL'd code in the Rack package, we include ASIO in the Windows build for convenience to our users.
  189. ifdef RTAUDIO_ASIO
  190. RTAUDIO_FLAGS += -DRTAUDIO_API_ASIO=ON
  191. else
  192. RTAUDIO_FLAGS += -DRTAUDIO_API_ASIO=OFF
  193. endif
  194. endif
  195. # RtAudio on Windows and Mac uses these macros to enable UTF-8 device names
  196. $(rtaudio): export CXXFLAGS += -DUNICODE -D_UNICODE
  197. $(rtaudio): | rtaudio
  198. cd rtaudio && mkdir -p build
  199. cd rtaudio/build && $(CMAKE) $(RTAUDIO_FLAGS) ..
  200. $(MAKE) -C rtaudio/build
  201. $(MAKE) -C rtaudio/build install
  202. $(nanovg): $(wildcard nanovg/src/*.h) nanovg/example/stb_image_write.h
  203. mkdir -p include
  204. cp $^ include/
  205. $(nanosvg): $(wildcard nanosvg/src/*.h)
  206. mkdir -p include
  207. cp $^ include/
  208. $(oui-blendish): $(wildcard oui-blendish/*.h)
  209. mkdir -p include
  210. cp $^ include/
  211. $(osdialog): $(wildcard osdialog/*.h)
  212. mkdir -p include
  213. cp $^ include/
  214. $(pffft): | pffft
  215. mkdir -p include
  216. cp pffft/*.h include/
  217. $(fuzzysearchdatabase): fuzzysearchdatabase/src/FuzzySearchDatabase.hpp
  218. mkdir -p include
  219. cp $^ include/
  220. $(ghcfilesystem): filesystem/include/ghc
  221. mkdir -p include
  222. cp -r $^ include/
  223. $(tinyexpr): tinyexpr/tinyexpr.h
  224. mkdir -p include
  225. cp $^ include/
  226. $(simde): simde/simde
  227. mkdir -p include
  228. cp -R $^ include/
  229. # Helpers
  230. src: glew-2.2.0 glfw jansson-2.12 libsamplerate-0.1.9 openssl-3.3.2 curl-8.10.0 zstd-1.5.6 libarchive-3.7.7 rtaudio nanovg nanosvg oui-blendish osdialog
  231. clean:
  232. git clean -fdx
  233. git submodule foreach git clean -fdx