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.

191 lines
7.8KB

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