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.

286 lines
10.0KB

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