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.

232 lines
8.9KB

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