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.

229 lines
9.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 ?= 0
  12. LUAJIT ?= 1
  13. PYTHON ?= 0
  14. SUPERCOLLIDER ?= 0
  15. LIBPD ?= 1
  16. # Entropia File System Watcher
  17. efsw := dep/lib/libefsw-static-release.a
  18. DEPS += $(efsw)
  19. OBJECTS += $(efsw)
  20. $(efsw):
  21. cd efsw && premake4 gmake
  22. cd efsw && $(MAKE) -C make/* config=release efsw-static-lib
  23. mkdir -p dep/lib dep/include
  24. cd efsw && cp lib/libefsw-static-release.a $(DEP_PATH)/lib/
  25. cd efsw && cp -R include/efsw $(DEP_PATH)/include/
  26. # LibPD
  27. ifeq ($(LIBPD), 1)
  28. libpd := dep/lib/libpd.a
  29. SOURCES += src/LibPDEngine.cpp
  30. OBJECTS += $(libpd)
  31. DEPS += $(libpd)
  32. FLAGS += -Idep/include/libpd
  33. ifdef ARCH_WIN
  34. FLAGS += -DPD_INTERNAL -D_WIN32
  35. LDFLAGS += -shared -Wl,--export-all-symbols -lws2_32 -lkernel32 -static-libgcc
  36. endif
  37. $(libpd):
  38. $(WGET) "https://github.com/chairaudio/libpd/archive/master.tar.gz"
  39. $(SHA256) master.tar.gz 9edfd4a7423009a61069fb4b2fa027a62705ffa0dcf23bbb6c220f1c6e709d3d
  40. cd dep && $(UNTAR) ../master.tar.gz
  41. $(WGET) "https://github.com/pure-data/pure-data/archive/0.50-2.tar.gz"
  42. $(SHA256) 0.50-2.tar.gz 0bdc9503d25f71e05ce6d321dd853f4e8082fdea211a59439eddd8105cc8761e
  43. cd dep/libpd-master/pure-data && $(UNTAR) ../../../0.50-2.tar.gz --strip-components=1
  44. cd dep/libpd-master && make MULTI=true BUILD_LIBPD_STATIC=true ADDITIONAL_CFLAGS='-DPD_LONGINTTYPE="long long"'
  45. cd dep/libpd-master && $(MAKE) install prefix="$(DEP_PATH)"
  46. endif
  47. # Duktape
  48. ifeq ($(DUKTAPE), 1)
  49. SOURCES += src/DuktapeEngine.cpp
  50. duktape := dep/duktape-2.4.0/src/duktape.c
  51. DEPS += $(duktape)
  52. SOURCES += $(duktape)
  53. FLAGS += -Idep/duktape-2.4.0/src
  54. $(duktape):
  55. $(WGET) "https://duktape.org/duktape-2.4.0.tar.xz"
  56. $(SHA256) duktape-2.4.0.tar.xz 86a89307d1633b5cedb2c6e56dc86e92679fc34b05be551722d8cc69ab0771fc
  57. cd dep && $(UNTAR) ../duktape-2.4.0.tar.xz
  58. endif
  59. # QuickJS
  60. ifeq ($(QUICKJS), 1)
  61. SOURCES += src/QuickJSEngine.cpp
  62. quickjs := dep/lib/quickjs/libquickjs.a
  63. DEPS += $(quickjs)
  64. OBJECTS += $(quickjs)
  65. QUICKJS_MAKE_FLAGS += prefix="$(DEP_PATH)"
  66. ifdef ARCH_WIN
  67. QUICKJS_MAKE_FLAGS += CONFIG_WIN32=y
  68. endif
  69. $(quickjs):
  70. cd dep && git clone "https://github.com/JerrySievert/QuickJS.git"
  71. cd dep/QuickJS && git checkout 807adc8ca9010502853d471bd8331cdc1d376b94
  72. cd dep/QuickJS && $(MAKE) $(QUICKJS_MAKE_FLAGS)
  73. cd dep/QuickJS && $(MAKE) $(QUICKJS_MAKE_FLAGS) install
  74. endif
  75. # LuaJIT
  76. ifeq ($(LUAJIT), 1)
  77. SOURCES += src/LuaJITEngine.cpp
  78. luajit := dep/lib/libluajit-5.1.a
  79. OBJECTS += $(luajit)
  80. DEPS += $(luajit)
  81. $(luajit):
  82. $(WGET) "http://luajit.org/download/LuaJIT-2.0.5.tar.gz"
  83. $(SHA256) LuaJIT-2.0.5.tar.gz 874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979
  84. cd dep && $(UNTAR) ../LuaJIT-2.0.5.tar.gz
  85. cd dep/LuaJIT-2.0.5 && $(MAKE) BUILDMODE=static PREFIX="$(DEP_PATH)" install
  86. endif
  87. # SuperCollider
  88. ifeq ($(SUPERCOLLIDER), 1)
  89. SOURCES += src/SuperColliderEngine.cpp
  90. FLAGS += -Idep/supercollider/include -Idep/supercollider/include/common -Idep/supercollider/lang -Idep/supercollider/common -Idep/supercollider/include/plugin_interface
  91. # FLAGS += -DNDEBUG # TODO is this OK? Andrew: No, unless you can tell me a good reason.
  92. # FLAGS += -DSC_VCV_ENGINE_TIMING # uncomment to turn on timing printing while running
  93. supercollider := dep/supercollider/build/lang/libsclang.a
  94. OBJECTS += $(supercollider)
  95. DEPS += $(supercollider)
  96. DISTRIBUTABLES += dep/supercollider/SCClassLibrary
  97. DISTRIBUTABLES += support/supercollider_extensions
  98. 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
  99. SUPERCOLLIDER_SUBMODULES += external_libraries/hidapi external_libraries/nova-simd external_libraries/nova-tt external_libraries/portaudio_sc_org external_libraries/yaml-cpp
  100. SUPERCOLLIDER_BRANCH := topic/vcv-prototype-support
  101. # FIXME should be able to find some better way of getting link library names!
  102. # 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.
  103. # LDFLAGS += $$(cat dep/supercollider/build/lang/vcv_libsclang_link_line.txt)
  104. OBJECTS += dep/supercollider/build/external_libraries/libtlsf.a
  105. OBJECTS += dep/supercollider/build/external_libraries/hidapi/linux/libhidapi.a
  106. OBJECTS += dep/supercollider/build/external_libraries/hidapi/hidapi_parser/libhidapi_parser.a
  107. OBJECTS += dep/supercollider/build/external_libraries/libboost_thread_lib.a
  108. OBJECTS += dep/supercollider/build/external_libraries/libboost_system_lib.a
  109. OBJECTS += dep/supercollider/build/external_libraries/libboost_regex_lib.a
  110. OBJECTS += dep/supercollider/build/external_libraries/libboost_filesystem_lib.a
  111. OBJECTS += dep/supercollider/build/external_libraries/libyaml.a
  112. # TODO
  113. # 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.
  114. LDFLAGS += -lsndfile
  115. # However, these can be assumed because I've never seen a system without them that can run Rack.
  116. LDFLAGS += -lpthread -lasound -ludev
  117. $(supercollider):
  118. cd dep && git clone "https://github.com/supercollider/supercollider" --branch $(SUPERCOLLIDER_BRANCH) --depth 5
  119. cd dep/supercollider && git checkout 84b14d10d49edce6dd8303045a884fb7f2bc92e8
  120. cd dep/supercollider && git submodule update --init -- $(SUPERCOLLIDER_SUBMODULES)
  121. cd dep/supercollider && git apply ../../support/supercollider_get_libsclang_link_line.patch
  122. cd dep/supercollider && mkdir build
  123. cd dep/supercollider/build && $(CMAKE) .. $(SUPERCOLLIDER_CMAKE_FLAGS)
  124. cd dep/supercollider/build && $(MAKE) libsclang
  125. cd dep/supercollider/build && $(MAKE) generate_libsclang_link_line
  126. # cd dep/supercollider/build && $(MAKE) install
  127. endif
  128. # Python
  129. ifeq ($(PYTHON), 1)
  130. SOURCES += src/PythonEngine.cpp
  131. # Note this is a dynamic library, not static.
  132. python := dep/lib/libpython3.8.so.1.0
  133. DEPS += $(python) $(numpy)
  134. FLAGS += -Idep/include/python3.8
  135. # TODO Test these flags on all platforms
  136. # Make dynamic linker look in the plugin folder for libpython.
  137. LDFLAGS += -Wl,-rpath,'$$ORIGIN'/dep/lib
  138. LDFLAGS += -Ldep/lib -lpython3.8
  139. LDFLAGS += -lcrypt -lpthread -ldl -lutil -lm
  140. DISTRIBUTABLES += $(python)
  141. DISTRIBUTABLES += dep/lib/python3.8
  142. $(python):
  143. $(WGET) "https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz"
  144. $(SHA256) Python-3.8.0.tar.xz b356244e13fb5491da890b35b13b2118c3122977c2cd825e3eb6e7d462030d84
  145. cd dep && $(UNTAR) ../Python-3.8.0.tar.xz
  146. cd dep/Python-3.8.0 && $(CONFIGURE) --build=$(MACHINE) --enable-shared --enable-optimizations
  147. cd dep/Python-3.8.0 && $(MAKE) build_all
  148. cd dep/Python-3.8.0 && $(MAKE) install
  149. numpy := dep/lib/python3.8/site-packages/numpy
  150. FLAGS += -Idep/lib/python3.8/site-packages/numpy/core/include
  151. $(numpy): $(python)
  152. $(WGET) "https://github.com/numpy/numpy/releases/download/v1.17.3/numpy-1.17.3.tar.gz"
  153. $(SHA256) numpy-1.17.3.tar.gz c93733dbebc2599d2747ceac4b18825a73767d289176ed8e02090325656d69aa
  154. cd dep && $(UNTAR) ../numpy-1.17.3.tar.gz
  155. # Don't try to find an external BLAS and LAPACK library.
  156. # Don't install to an egg folder.
  157. # Make sure to use our built Python.
  158. 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=/
  159. # scipy: $(numpy)
  160. # $(WGET) "https://github.com/scipy/scipy/releases/download/v1.3.1/scipy-1.3.1.tar.xz"
  161. # $(SHA256) scipy-1.3.1.tar.xz 326ffdad79f113659ed0bca80f5d0ed5e28b2e967b438bb1f647d0738073a92e
  162. # cd dep && $(UNTAR) ../scipy-1.3.1.tar.xz
  163. # cd dep/scipy-1.3.1 && "$(DEP_PATH)"/bin/python3.7 setup.py build -j4 install
  164. endif
  165. # # Julia
  166. # julia := dep/lib/libjulia.a
  167. # DEPS += $(julia)
  168. # $(julia):
  169. # $(WGET) "https://github.com/JuliaLang/julia/releases/download/v1.2.0/julia-1.2.0-full.tar.gz"
  170. # $(SHA256) julia-1.2.0-full.tar.gz 2419b268fc5c3666dd9aeb554815fe7cf9e0e7265bc9b94a43957c31a68d9184
  171. # cd dep && $(UNTAR) ../julia-1.2.0-full.tar.gz
  172. # # Csound
  173. # csound := dep/lib/libcsound.a
  174. # DEPS += $(csound)
  175. # $(csound):
  176. # $(WGET) "https://github.com/csound/csound/archive/6.13.0.tar.gz"
  177. # $(SHA256) 6.13.0.tar.gz 183beeb3b720bfeab6cc8af12fbec0bf9fef2727684ac79289fd12d0dfee728b
  178. # cd dep && $(UNTAR) ../6.13.0.tar.gz
  179. # # LLVM
  180. # llvm := dep/lib/libllvm.a
  181. # DEPS += $(llvm)
  182. # $(llvm):
  183. # $(WGET) "https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz"
  184. # $(SHA256) llvm-8.0.1.src.tar.xz 44787a6d02f7140f145e2250d56c9f849334e11f9ae379827510ed72f12b75e7
  185. # cd dep && $(UNTAR) ../llvm-8.0.1.src.tar.xz
  186. # cd dep/llvm-8.0.1.src && mkdir -p build
  187. # cd dep/llvm-8.0.1.src/build && $(CMAKE) ..
  188. # cd dep/llvm-8.0.1.src/build && $(MAKE)
  189. # cd dep/llvm-8.0.1.src/build && $(MAKE) install
  190. # Vult
  191. ifeq ($(VULT), 1)
  192. SOURCES += src/VultEngine.cpp
  193. vult := dep/vult/vultc.h
  194. $(vult):
  195. cd dep && mkdir -p vult
  196. cd dep/vult && $(WGET) "https://github.com/modlfo/vult/releases/download/v0.4.9/vultc.h"
  197. $(SHA256) $(vult) 91f575afd2913d0879df90ee666021065ad726372f0bd306198024dc771cce55
  198. FLAGS += -Idep/vult
  199. DEPS += $(vult)
  200. endif
  201. include $(RACK_DIR)/plugin.mk