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.

269 lines
9.6KB

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