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.

194 lines
8.1KB

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