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.

301 lines
9.2KB

  1. # Installation path for executables
  2. LOCAL_DIR := $(PWD)/local
  3. # Local programs should have higher path priority than system-installed programs
  4. export PATH := $(LOCAL_DIR)/bin:$(PATH)
  5. # Allow specifying the number of jobs for toolchain build for systems that need it.
  6. # Due to different build systems used in the toolchain build, just `make -j` won't work here.
  7. # Note: Plugin build uses `$(MAKE)` to inherit `-j` argument from command line.
  8. ifdef JOBS
  9. export JOBS := $(JOBS)
  10. # Define number of jobs for crosstool-ng (uses different argument format)
  11. export JOBS_CT_NG := .$(JOBS)
  12. else
  13. # If `JOBS` is not specified, default to max number of jobs.
  14. export JOBS :=
  15. export JOBS_CT_NG :=
  16. endif
  17. RACK_SDK_VERSION := 2.3.0
  18. DOCKER_IMAGE_VERSION := 10
  19. all: toolchain-all
  20. # Toolchain build
  21. crosstool-ng := $(LOCAL_DIR)/bin/ct-ng
  22. $(crosstool-ng):
  23. git clone https://github.com/crosstool-ng/crosstool-ng.git
  24. cd crosstool-ng && git checkout e63c40854c977f488bee159a8f8ebf5fc06c8666
  25. cd crosstool-ng && ./bootstrap
  26. cd crosstool-ng && ./configure --prefix="$(LOCAL_DIR)"
  27. cd crosstool-ng && make -j $(JOBS)
  28. cd crosstool-ng && make install -j $(JOBS)
  29. rm -rf crosstool-ng
  30. toolchain-lin := $(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu
  31. toolchain-lin: $(toolchain-lin)
  32. $(toolchain-lin): $(crosstool-ng)
  33. ct-ng x86_64-ubuntu16.04-linux-gnu
  34. CT_PREFIX="$(LOCAL_DIR)" ct-ng build$(JOBS_CT_NG)
  35. rm -rf .build .config build.log
  36. # HACK Copy GL and related include dirs to toolchain sysroot
  37. chmod +w $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  38. cp -r /usr/include/GL $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/
  39. cp -r /usr/include/KHR $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/
  40. cp -r /usr/include/X11 $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/
  41. chmod -w $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  42. toolchain-win := $(LOCAL_DIR)/x86_64-w64-mingw32
  43. toolchain-win: $(toolchain-win)
  44. $(toolchain-win): $(crosstool-ng)
  45. ct-ng x86_64-w64-mingw32
  46. CT_PREFIX="$(LOCAL_DIR)" ct-ng build$(JOBS_CT_NG)
  47. rm -rf .build .config build.log /home/build/src
  48. toolchain-mac := $(LOCAL_DIR)/osxcross
  49. toolchain-mac: $(toolchain-mac)
  50. $(toolchain-mac): export PATH := $(LOCAL_DIR)/osxcross/bin:$(PATH)
  51. $(toolchain-mac):
  52. # Download osxcross
  53. git clone "https://github.com/cschol/osxcross.git" osxcross
  54. cd osxcross && git checkout 12f179126df156fb65515cccf140f4b634967baa
  55. # Build osxcross
  56. cp MacOSX11.1.sdk.tar.* osxcross/tarballs/
  57. cd osxcross && PATH="$(LOCAL_DIR)/bin:$(PATH)" UNATTENDED=1 TARGET_DIR="$(LOCAL_DIR)/osxcross" JOBS=$(JOBS) ./build.sh
  58. # Build compiler-rt
  59. #cd osxcross && ENABLE_COMPILER_RT_INSTALL=1 JOBS=$(JOBS) ./build_compiler_rt.sh
  60. # Build Mac version of binutils and build LLVM gold
  61. #cd osxcross && BINUTILS_VERSION=$(MAC_BINUTILS_VERSION) TARGET_DIR="$(LOCAL_DIR)/osxcross" JOBS=$(JOBS) ./build_binutils.sh
  62. #cd osxcross/build/build_stage && cmake . -DLLVM_BINUTILS_INCDIR=$(PWD)/osxcross/build/binutils-$(MAC_BINUTILS_VERSION)/include && make install -j $(JOBS)
  63. rm -rf osxcross
  64. rack-sdk-mac-x64 := Rack-SDK-mac-x64
  65. rack-sdk-mac-x64: $(rack-sdk-mac-x64)
  66. $(rack-sdk-mac-x64):
  67. wget -c "https://vcvrack.com/downloads/Rack-SDK-$(RACK_SDK_VERSION)-mac-x64.zip"
  68. unzip Rack-SDK-$(RACK_SDK_VERSION)-mac-x64.zip
  69. mv Rack-SDK Rack-SDK-mac-x64
  70. rm Rack-SDK-$(RACK_SDK_VERSION)-mac-x64.zip
  71. RACK_DIR_MAC_X64 := $(PWD)/$(rack-sdk-mac-x64)
  72. rack-sdk-mac-arm64 := Rack-SDK-mac-arm64
  73. rack-sdk-mac-arm64: $(rack-sdk-mac-arm64)
  74. $(rack-sdk-mac-arm64):
  75. wget -c "https://vcvrack.com/downloads/Rack-SDK-$(RACK_SDK_VERSION)-mac-arm64.zip"
  76. unzip Rack-SDK-$(RACK_SDK_VERSION)-mac-arm64.zip
  77. mv Rack-SDK Rack-SDK-mac-arm64
  78. rm Rack-SDK-$(RACK_SDK_VERSION)-mac-arm64.zip
  79. RACK_DIR_MAC_ARM64 := $(PWD)/$(rack-sdk-mac-arm64)
  80. rack-sdk-win-x64 := Rack-SDK-win-x64
  81. rack-sdk-win-x64: $(rack-sdk-win-x64)
  82. $(rack-sdk-win-x64):
  83. wget -c "https://vcvrack.com/downloads/Rack-SDK-$(RACK_SDK_VERSION)-win-x64.zip"
  84. unzip Rack-SDK-$(RACK_SDK_VERSION)-win-x64.zip
  85. mv Rack-SDK Rack-SDK-win-x64
  86. rm Rack-SDK-$(RACK_SDK_VERSION)-win-x64.zip
  87. RACK_DIR_WIN_X64 := $(PWD)/$(rack-sdk-win-x64)
  88. rack-sdk-lin-x64 := Rack-SDK-lin-x64
  89. rack-sdk-lin-x64: $(rack-sdk-lin-x64)
  90. $(rack-sdk-lin-x64):
  91. wget -c "https://vcvrack.com/downloads/Rack-SDK-$(RACK_SDK_VERSION)-lin-x64.zip"
  92. unzip Rack-SDK-$(RACK_SDK_VERSION)-lin-x64.zip
  93. mv Rack-SDK Rack-SDK-lin-x64
  94. rm Rack-SDK-$(RACK_SDK_VERSION)-lin-x64.zip
  95. RACK_DIR_LIN_X64 := $(PWD)/$(rack-sdk-lin-x64)
  96. rack-sdk-clean:
  97. rm -rf $(rack-sdk-mac-x64) $(rack-sdk-mac-arm64) $(rack-sdk-win-x64) $(rack-sdk-lin-x64)
  98. rack-sdk-all: rack-sdk-mac-x64 rack-sdk-mac-arm64 rack-sdk-win-x64 rack-sdk-lin-x64
  99. toolchain-all: toolchain-lin toolchain-win toolchain-mac rack-sdk-all
  100. toolchain-clean:
  101. rm -rf .build local osxcross $(rack-sdk-mac-x64) $(rack-sdk-win-x64) $(rack-sdk-lin-x64) $(rack-sdk-mac-arm64)
  102. # Plugin build
  103. PLUGIN_BUILD_DIR := plugin-build
  104. PLUGIN_DIR ?=
  105. plugin-build-mac-x64: export PATH := $(LOCAL_DIR)/osxcross/bin:$(PATH)
  106. plugin-build-mac-x64: export CC := x86_64-apple-darwin20.2-clang
  107. plugin-build-mac-x64: export CXX := x86_64-apple-darwin20.2-clang++-libc++
  108. plugin-build-mac-x64: export STRIP := x86_64-apple-darwin20.2-strip
  109. plugin-build-mac-x64: export INSTALL_NAME_TOOL := x86_64-apple-darwin20.2-install_name_tool
  110. plugin-build-mac-x64: export OTOOL := x86_64-apple-darwin20.2-otool
  111. plugin-build-mac-arm64: export PATH := $(LOCAL_DIR)/osxcross/bin:$(PATH)
  112. plugin-build-mac-arm64: export CC := arm64-apple-darwin20.2-clang
  113. plugin-build-mac-arm64: export CXX := arm64-apple-darwin20.2-clang++-libc++
  114. plugin-build-mac-arm64: export STRIP := arm64-apple-darwin20.2-strip
  115. plugin-build-mac-arm64: export INSTALL_NAME_TOOL := arm64-apple-darwin20.2-install_name_tool
  116. plugin-build-mac-arm64: export OTOOL := arm64-apple-darwin20.2-otool
  117. plugin-build-win-x64: export PATH := $(LOCAL_DIR)/x86_64-w64-mingw32/bin:$(PATH)
  118. plugin-build-win-x64: export CC := x86_64-w64-mingw32-gcc
  119. plugin-build-win-x64: export CXX := x86_64-w64-mingw32-g++
  120. plugin-build-win-x64: export STRIP := x86_64-w64-mingw32-strip
  121. plugin-build-lin-x64: export PATH:=$(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu/bin:$(PATH)
  122. plugin-build-lin-x64: export CC := x86_64-ubuntu16.04-linux-gnu-gcc
  123. plugin-build-lin-x64: export CXX := x86_64-ubuntu16.04-linux-gnu-g++
  124. plugin-build-lin-x64: export STRIP := x86_64-ubuntu16.04-linux-gnu-strip
  125. plugin-build-mac-x64: export RACK_DIR := $(RACK_DIR_MAC_X64)
  126. plugin-build-mac-arm64: export RACK_DIR := $(RACK_DIR_MAC_ARM64)
  127. plugin-build-win-x64: export RACK_DIR := $(RACK_DIR_WIN_X64)
  128. plugin-build-lin-x64: export RACK_DIR := $(RACK_DIR_LIN_X64)
  129. plugin-build-mac-x64 plugin-build-mac-arm64 plugin-build-win-x64 plugin-build-lin-x64:
  130. cd $(PLUGIN_DIR) && $(MAKE) clean
  131. cd $(PLUGIN_DIR) && $(MAKE) cleandep
  132. cd $(PLUGIN_DIR) && $(MAKE) dep
  133. cd $(PLUGIN_DIR) && $(MAKE) dist
  134. mkdir -p $(PLUGIN_BUILD_DIR)
  135. cp $(PLUGIN_DIR)/dist/*.vcvplugin $(PLUGIN_BUILD_DIR)/
  136. cd $(PLUGIN_DIR) && $(MAKE) clean
  137. plugin-build:
  138. $(MAKE) plugin-build-mac-x64
  139. $(MAKE) plugin-build-mac-arm64
  140. $(MAKE) plugin-build-win-x64
  141. $(MAKE) plugin-build-lin-x64
  142. plugin-build-clean:
  143. rm -rf $(PLUGIN_BUILD_DIR)
  144. # Docker helpers
  145. dep-ubuntu:
  146. apt-get update
  147. apt-get install -y --no-install-recommends \
  148. ca-certificates \
  149. git \
  150. build-essential \
  151. autoconf \
  152. automake \
  153. bison \
  154. flex \
  155. gawk \
  156. libtool-bin \
  157. libncurses5-dev \
  158. unzip \
  159. zip \
  160. jq \
  161. libgl-dev \
  162. libglu-dev \
  163. git \
  164. wget \
  165. curl \
  166. cmake \
  167. nasm \
  168. xz-utils \
  169. file \
  170. python3 \
  171. libxml2-dev \
  172. libssl-dev \
  173. texinfo \
  174. help2man \
  175. libz-dev \
  176. rsync \
  177. xxd \
  178. perl \
  179. coreutils \
  180. zstd \
  181. markdown \
  182. libarchive-tools
  183. dep-arch-linux:
  184. pacman -S --noconfirm --needed \
  185. git \
  186. cmake \
  187. patch \
  188. clang \
  189. python3 \
  190. automake \
  191. help2man \
  192. texinfo \
  193. libtool \
  194. jq \
  195. rsync \
  196. autoconf \
  197. flex \
  198. bison \
  199. which \
  200. unzip \
  201. wget \
  202. glu \
  203. libx11 \
  204. mesa
  205. docker-build: rack-sdk-all
  206. docker build --build-arg JOBS=$(JOBS) --tag rack-plugin-toolchain:$(DOCKER_IMAGE_VERSION) .
  207. DOCKER_RUN := docker run --rm --interactive --tty \
  208. --volume=$(PLUGIN_DIR):/home/build/plugin-src \
  209. --volume=$(PWD)/$(PLUGIN_BUILD_DIR):/home/build/rack-plugin-toolchain/$(PLUGIN_BUILD_DIR) \
  210. --volume=$(PWD)/Rack-SDK-mac-x64:/home/build/rack-plugin-toolchain/Rack-SDK-mac-x64 \
  211. --volume=$(PWD)/Rack-SDK-mac-arm64:/home/build/rack-plugin-toolchain/Rack-SDK-mac-arm64 \
  212. --volume=$(PWD)/Rack-SDK-win-x64:/home/build/rack-plugin-toolchain/Rack-SDK-win-x64 \
  213. --volume=$(PWD)/Rack-SDK-lin-x64:/home/build/rack-plugin-toolchain/Rack-SDK-lin-x64 \
  214. --env PLUGIN_DIR=/home/build/plugin-src \
  215. rack-plugin-toolchain:$(DOCKER_IMAGE_VERSION) \
  216. /bin/bash
  217. docker-run:
  218. $(DOCKER_RUN)
  219. docker-plugin-build-mac-x64:
  220. mkdir -p $(PLUGIN_BUILD_DIR)
  221. $(DOCKER_RUN) -c "$(MAKE) plugin-build-mac-x64 $(MFLAGS)"
  222. docker-plugin-build-mac-arm64:
  223. mkdir -p $(PLUGIN_BUILD_DIR)
  224. $(DOCKER_RUN) -c "$(MAKE) plugin-build-mac-arm64 $(MFLAGS)"
  225. docker-plugin-build-win-x64:
  226. mkdir -p $(PLUGIN_BUILD_DIR)
  227. $(DOCKER_RUN) -c "$(MAKE) plugin-build-win-x64 $(MFLAGS)"
  228. docker-plugin-build-lin-x64:
  229. mkdir -p $(PLUGIN_BUILD_DIR)
  230. $(DOCKER_RUN) -c "$(MAKE) plugin-build-lin-x64 $(MFLAGS)"
  231. docker-plugin-build:
  232. mkdir -p $(PLUGIN_BUILD_DIR)
  233. $(DOCKER_RUN) -c "$(MAKE) plugin-build $(MFLAGS)"
  234. .NOTPARALLEL:
  235. .PHONY: all plugin-build