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.

281 lines
9.8KB

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