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.

273 lines
10KB

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