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.

276 lines
9.7KB

  1. RACK_DIR ?= ../..
  2. FLAGS += -Idep/include
  3. CFLAGS +=
  4. CXXFLAGS +=
  5. LDFLAGS +=
  6. SOURCES += src/Prototype.cpp
  7. DISTRIBUTABLES += res examples
  8. DISTRIBUTABLES += $(wildcard LICENSE*)
  9. include $(RACK_DIR)/arch.mk
  10. DUKTAPE ?= 0
  11. QUICKJS ?= 1
  12. LUAJIT ?= 1
  13. PYTHON ?= 0
  14. SUPERCOLLIDER ?= 1
  15. VULT ?= 1
  16. LIBPD ?= 1
  17. FAUST ?= 1
  18. # Vult depends on both LuaJIT and QuickJS
  19. ifeq ($(VULT), 1)
  20. QUICKJS := 1
  21. LUAJIT := 1
  22. endif
  23. # Entropia File System Watcher
  24. ifeq (, $(shell which premake4))
  25. ifeq (, $(shell which premake5))
  26. $(error premake is not installed. Please install either premake4 or premake5)
  27. else
  28. PREMAKE = premake5
  29. endif
  30. else
  31. PREMAKE = premake4
  32. endif
  33. efsw := dep/lib/libefsw-static-release.a
  34. DEPS += $(efsw)
  35. OBJECTS += $(efsw)
  36. $(efsw):
  37. cd efsw && $(PREMAKE) gmake
  38. cd efsw && $(MAKE) -C make/* config=release efsw-static-lib
  39. mkdir -p dep/lib dep/include
  40. cd efsw && cp lib/libefsw-static-release.a $(DEP_PATH)/lib/
  41. cd efsw && cp -R include/efsw $(DEP_PATH)/include/
  42. # Duktape
  43. ifeq ($(DUKTAPE), 1)
  44. SOURCES += src/DuktapeEngine.cpp
  45. duktape := dep/duktape-2.4.0/src/duktape.c
  46. DEPS += $(duktape)
  47. SOURCES += $(duktape)
  48. FLAGS += -Idep/duktape-2.4.0/src
  49. $(duktape):
  50. $(WGET) "https://duktape.org/duktape-2.4.0.tar.xz"
  51. $(SHA256) duktape-2.4.0.tar.xz 86a89307d1633b5cedb2c6e56dc86e92679fc34b05be551722d8cc69ab0771fc
  52. cd dep && $(UNTAR) ../duktape-2.4.0.tar.xz
  53. endif
  54. # QuickJS
  55. ifeq ($(QUICKJS), 1)
  56. SOURCES += src/QuickJSEngine.cpp
  57. quickjs := dep/lib/quickjs/libquickjs.a
  58. DEPS += $(quickjs)
  59. OBJECTS += $(quickjs)
  60. QUICKJS_MAKE_FLAGS += prefix="$(DEP_PATH)"
  61. ifdef ARCH_WIN
  62. QUICKJS_MAKE_FLAGS += CONFIG_WIN32=y
  63. endif
  64. $(quickjs):
  65. cd dep && git clone "https://github.com/JerrySievert/QuickJS.git"
  66. cd dep/QuickJS && git checkout 807adc8ca9010502853d471bd8331cdc1d376b94
  67. cd dep/QuickJS && $(MAKE) $(QUICKJS_MAKE_FLAGS) install
  68. endif
  69. # LuaJIT
  70. ifeq ($(LUAJIT), 1)
  71. SOURCES += src/LuaJITEngine.cpp
  72. luajit := dep/LuaJIT/src/libluajit.a
  73. OBJECTS += $(luajit)
  74. DEPS += $(luajit)
  75. $(luajit):
  76. cd dep && git clone "https://github.com/LuaJIT/LuaJIT.git"
  77. cd dep/LuaJIT && git checkout v2.1
  78. cd dep/LuaJIT && MACOSX_DEPLOYMENT_TARGET=10.9 $(MAKE) BUILDMODE=static PREFIX="$(DEP_PATH)" install
  79. endif
  80. # SuperCollider
  81. ifeq ($(SUPERCOLLIDER), 1)
  82. SOURCES += src/SuperColliderEngine.cpp
  83. FLAGS += -Idep/supercollider/include -Idep/supercollider/include/common -Idep/supercollider/lang -Idep/supercollider/common -Idep/supercollider/include/plugin_interface
  84. # FLAGS += -DSC_VCV_ENGINE_TIMING # uncomment to turn on timing printing while running
  85. supercollider := dep/supercollider/build/lang/libsclang.a
  86. OBJECTS += $(supercollider)
  87. DEPS += $(supercollider)
  88. DISTRIBUTABLES += dep/supercollider/SCClassLibrary
  89. DISTRIBUTABLES += support/supercollider_extensions
  90. SUPERCOLLIDER_CMAKE_FLAGS += -DSUPERNOVA=0 -DSC_EL=0 -DSC_VIM=0 -DSC_ED=0 -DSC_IDE=0 -DSC_ABLETON_LINK=0 -DSC_QT=0 -DCMAKE_BUILD_TYPE=Release -DSCLANG_SERVER=0 -DBUILD_TESTING=0 -DNO_LIBSNDFILE=1
  91. SUPERCOLLIDER_SUBMODULES += external_libraries/hidapi external_libraries/nova-simd external_libraries/nova-tt external_libraries/portaudio_sc_org external_libraries/yaml-cpp
  92. SUPERCOLLIDER_BRANCH := topic/vcv-prototype-support
  93. OBJECTS += dep/supercollider/build/external_libraries/libtlsf.a
  94. OBJECTS += dep/supercollider/build/external_libraries/hidapi/linux/libhidapi.a
  95. OBJECTS += dep/supercollider/build/external_libraries/hidapi/hidapi_parser/libhidapi_parser.a
  96. OBJECTS += dep/supercollider/build/external_libraries/libboost_thread_lib.a
  97. OBJECTS += dep/supercollider/build/external_libraries/libboost_system_lib.a
  98. OBJECTS += dep/supercollider/build/external_libraries/libboost_regex_lib.a
  99. OBJECTS += dep/supercollider/build/external_libraries/libboost_filesystem_lib.a
  100. OBJECTS += dep/supercollider/build/external_libraries/libyaml.a
  101. LDFLAGS += -lpthread -lasound -ludev
  102. $(supercollider):
  103. cd dep && git clone "https://github.com/supercollider/supercollider" --branch $(SUPERCOLLIDER_BRANCH) --depth 1
  104. cd dep/supercollider && git checkout 84b14d10d49edce6dd8303045a884fb7f2bc92e8
  105. cd dep/supercollider && git submodule update --depth 1 --init -- $(SUPERCOLLIDER_SUBMODULES)
  106. cd dep/supercollider && mkdir build
  107. cd dep/supercollider/build && $(CMAKE) .. $(SUPERCOLLIDER_CMAKE_FLAGS)
  108. cd dep/supercollider/build && $(MAKE) libsclang
  109. endif
  110. # Python
  111. ifeq ($(PYTHON), 1)
  112. SOURCES += src/PythonEngine.cpp
  113. # Note this is a dynamic library, not static.
  114. python := dep/lib/libpython3.8.so.1.0
  115. DEPS += $(python) $(numpy)
  116. FLAGS += -Idep/include/python3.8
  117. # TODO Test these flags on all platforms
  118. # Make dynamic linker look in the plugin folder for libpython.
  119. LDFLAGS += -Wl,-rpath,'$$ORIGIN'/dep/lib
  120. LDFLAGS += -Ldep/lib -lpython3.8
  121. LDFLAGS += -lcrypt -lpthread -ldl -lutil -lm
  122. DISTRIBUTABLES += $(python)
  123. DISTRIBUTABLES += dep/lib/python3.8
  124. $(python):
  125. $(WGET) "https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz"
  126. $(SHA256) Python-3.8.0.tar.xz b356244e13fb5491da890b35b13b2118c3122977c2cd825e3eb6e7d462030d84
  127. cd dep && $(UNTAR) ../Python-3.8.0.tar.xz
  128. cd dep/Python-3.8.0 && $(CONFIGURE) --build=$(MACHINE) --enable-shared --enable-optimizations
  129. cd dep/Python-3.8.0 && $(MAKE) build_all
  130. cd dep/Python-3.8.0 && $(MAKE) install
  131. numpy := dep/lib/python3.8/site-packages/numpy
  132. FLAGS += -Idep/lib/python3.8/site-packages/numpy/core/include
  133. $(numpy): $(python)
  134. $(WGET) "https://github.com/numpy/numpy/releases/download/v1.17.3/numpy-1.17.3.tar.gz"
  135. $(SHA256) numpy-1.17.3.tar.gz c93733dbebc2599d2747ceac4b18825a73767d289176ed8e02090325656d69aa
  136. cd dep && $(UNTAR) ../numpy-1.17.3.tar.gz
  137. # Don't try to find an external BLAS and LAPACK library.
  138. # Don't install to an egg folder.
  139. # Make sure to use our built Python.
  140. cd dep/numpy-1.17.3 && LD_LIBRARY_PATH=../lib NPY_BLAS_ORDER= NPY_LAPACK_ORDER= "$(DEP_PATH)"/bin/python3.8 setup.py build -j4 install --single-version-externally-managed --root=/
  141. # scipy: $(numpy)
  142. # $(WGET) "https://github.com/scipy/scipy/releases/download/v1.3.1/scipy-1.3.1.tar.xz"
  143. # $(SHA256) scipy-1.3.1.tar.xz 326ffdad79f113659ed0bca80f5d0ed5e28b2e967b438bb1f647d0738073a92e
  144. # cd dep && $(UNTAR) ../scipy-1.3.1.tar.xz
  145. # cd dep/scipy-1.3.1 && "$(DEP_PATH)"/bin/python3.7 setup.py build -j4 install
  146. endif
  147. # # Julia
  148. # julia := dep/lib/libjulia.a
  149. # DEPS += $(julia)
  150. # $(julia):
  151. # $(WGET) "https://github.com/JuliaLang/julia/releases/download/v1.2.0/julia-1.2.0-full.tar.gz"
  152. # $(SHA256) julia-1.2.0-full.tar.gz 2419b268fc5c3666dd9aeb554815fe7cf9e0e7265bc9b94a43957c31a68d9184
  153. # cd dep && $(UNTAR) ../julia-1.2.0-full.tar.gz
  154. # # Csound
  155. # csound := dep/lib/libcsound.a
  156. # DEPS += $(csound)
  157. # $(csound):
  158. # $(WGET) "https://github.com/csound/csound/archive/6.13.0.tar.gz"
  159. # $(SHA256) 6.13.0.tar.gz 183beeb3b720bfeab6cc8af12fbec0bf9fef2727684ac79289fd12d0dfee728b
  160. # cd dep && $(UNTAR) ../6.13.0.tar.gz
  161. # # LLVM
  162. # llvm := dep/lib/libllvm.a
  163. # DEPS += $(llvm)
  164. # $(llvm):
  165. # $(WGET) "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz"
  166. # $(SHA256) llvm-8.0.1.src.tar.xz 44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7
  167. # cd dep && $(UNTAR) ../llvm-8.0.1.src.tar.xz
  168. # cd dep/llvm-8.0.1.src && mkdir -p build
  169. # cd dep/llvm-8.0.1.src/build && $(CMAKE) ..
  170. # cd dep/llvm-8.0.1.src/build && $(MAKE)
  171. # cd dep/llvm-8.0.1.src/build && $(MAKE) install
  172. # Vult
  173. ifeq ($(VULT), 1)
  174. SOURCES += src/VultEngine.cpp
  175. vult := dep/vult/vultc.h
  176. $(vult):
  177. cd dep && mkdir -p vult
  178. cd dep/vult && $(WGET) "https://github.com/vult-dsp/vult/releases/download/v0.4.15/vultc.h"
  179. $(SHA256) $(vult) 5c5e6c7c92caacc10dacd8e4dd5e8134b520e630562e1f928ab1332218266638
  180. FLAGS += -Idep/vult
  181. DEPS += $(vult)
  182. endif
  183. # LibPD
  184. ifeq ($(LIBPD), 1)
  185. libpd := dep/lib/libpd.a
  186. SOURCES += src/LibPDEngine.cpp
  187. OBJECTS += $(libpd)
  188. DEPS += $(libpd)
  189. FLAGS += -Idep/include/libpd -DHAVE_LIBDL
  190. ifdef ARCH_WIN
  191. # PD_INTERNAL leaves the function declarations for libpd unchanged
  192. # not specifying that flag would enable the "EXTERN __declspec(dllexport) extern" macro
  193. # which throws a linker error. I guess this macro should only be used for the windows
  194. # specific .dll dynamic linking format.
  195. # The corresponding #define resides in "m_pd.h" inside th Pure Data sources
  196. FLAGS += -DPD_INTERNAL -Ofast
  197. LDFLAGS += -Wl,--export-all-symbols
  198. LDFLAGS += -lws2_32
  199. endif
  200. $(libpd):
  201. cd dep && git clone "https://github.com/libpd/libpd.git" --recursive
  202. cd dep/libpd && git checkout 5772a612527f06597d44d195843307ad0e3578fe
  203. ifdef ARCH_MAC
  204. # libpd's Makefile is handmade, and it doesn't honor CFLAGS and LDFLAGS environments.
  205. # So in order for Mac 10.15 (for example) to make a build that works on Mac 10.7+, we have to manually add DEP_MAC_SDK_FLAGS to CFLAGS and LDFLAGS.
  206. # We can't just add the environment's CFLAGS/LDFLAGS because `-march=nocona` makes libpd segfault when initialized.
  207. # Perhaps inline assembly is used in libpd? Who knows.
  208. cd dep/libpd && $(MAKE) MULTI=true STATIC=true ADDITIONAL_CFLAGS='-DPD_LONGINTTYPE="long long" $(DEP_MAC_SDK_FLAGS) -stdlib=libc++' ADDITIONAL_LDFLAGS='$(DEP_MAC_SDK_FLAGS) -stdlib=libc++'
  209. else
  210. cd dep/libpd && $(MAKE) MULTI=true STATIC=true ADDITIONAL_CFLAGS='-DPD_LONGINTTYPE="long long"'
  211. endif
  212. cd dep/libpd && $(MAKE) install prefix="$(DEP_PATH)"
  213. endif
  214. # Faust
  215. ifeq ($(FAUST), 1)
  216. libfaust := dep/lib/libfaust.a
  217. SOURCES += src/FaustEngine.cpp
  218. OBJECTS += $(libfaust)
  219. DEPS += $(libfaust)
  220. FLAGS += -DINTERP
  221. DISTRIBUTABLES += faust_libraries
  222. # Test using LLVM
  223. #LDFLAGS += -L/usr/local/lib -lfaust
  224. # Test using MIR
  225. #LDFLAGS += -L/usr/local/lib -lfaust dep/lib/mir-gen.o dep/lib/mir.o
  226. $(libfaust):
  227. cd dep && git clone "https://github.com/grame-cncm/faust.git" --recursive
  228. cd dep/faust && git checkout 1dfc452a8250f3123b5100edf8c882e1cea407a1
  229. cd dep/faust/build && make cmake BACKENDS=interp.cmake TARGETS=interp.cmake
  230. cd dep/faust/build && make install PREFIX="$(DEP_PATH)"
  231. cp -r dep/faust/libraries/* faust_libraries/
  232. rm -rf faust_libraries/doc
  233. rm -rf faust_libraries/docs
  234. endif
  235. include $(RACK_DIR)/plugin.mk