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.

205 lines
5.1KB

  1. .NOTPARALLEL:
  2. .PHONY: all plugin-build
  3. # Installation path for executables
  4. LOCAL_DIR := $(PWD)/local
  5. # Local programs should have higher path priority than system-installed programs
  6. export PATH := $(LOCAL_DIR)/bin:$(PATH)
  7. all: toolchain-all
  8. # Toolchain build
  9. crosstool-ng := $(LOCAL_DIR)/bin/ct-ng
  10. $(crosstool-ng):
  11. wget -c "http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.24.0.tar.xz"
  12. tar -xf crosstool-ng-1.24.0.tar.xz
  13. rm crosstool-ng-1.24.0.tar.xz
  14. cd crosstool-ng-1.24.0 && ./bootstrap
  15. cd crosstool-ng-1.24.0 && ./configure --prefix="$(LOCAL_DIR)"
  16. cd crosstool-ng-1.24.0 && make
  17. cd crosstool-ng-1.24.0 && make install
  18. rm -rf crosstool-ng-1.24.0
  19. toolchain-lin := $(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu
  20. toolchain-lin: $(toolchain-lin)
  21. $(toolchain-lin): $(crosstool-ng)
  22. ct-ng x86_64-ubuntu16.04-linux-gnu
  23. CT_PREFIX="$(LOCAL_DIR)" ct-ng build
  24. rm -rf .build .config build.log
  25. # HACK Copy GL include dir to toolchain sysroot
  26. chmod +w $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  27. cp -r /usr/include/GL $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/
  28. chmod -w $(toolchain-lin)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  29. toolchain-win := $(LOCAL_DIR)/x86_64-w64-mingw32
  30. toolchain-win: $(toolchain-win)
  31. $(toolchain-win): $(crosstool-ng)
  32. ct-ng x86_64-w64-mingw32
  33. CT_PREFIX="$(LOCAL_DIR)" ct-ng build
  34. rm -rf .build .config build.log
  35. toolchain-mac := $(LOCAL_DIR)/osxcross
  36. toolchain-mac: $(toolchain-mac)
  37. $(toolchain-mac):
  38. git clone "https://github.com/tpoechtrager/osxcross.git" $@
  39. cd $@ && git checkout a791ad4fca685ea9fceb520b77db586881cd3f3d
  40. # Build clang
  41. #cd $@ && UNATTENDED=1 DISABLE_BOOTSTRAP=1 INSTALLPREFIX="$(LOCAL_DIR)" OCDEBUG=1 ./build_clang.sh
  42. #cd $@/build/llvm-10.0.1.src/build && make install
  43. # Build osxcross
  44. cp MacOSX10.13.sdk.tar.* $@/tarballs/
  45. cd $@ && UNATTENDED=1 TARGET_DIR="$(LOCAL_DIR)/osxcross" ./build.sh
  46. rm -rf osxcross
  47. rack-sdk := Rack-SDK
  48. rack-sdk: $(rack-sdk)
  49. $(rack-sdk):
  50. wget -c "https://vcvrack.com/downloads/Rack-SDK-1.1.6.zip"
  51. unzip Rack-SDK-1.1.6.zip
  52. rm Rack-SDK-1.1.6.zip
  53. RACK_DIR := $(PWD)/$(rack-sdk)
  54. toolchain-all: toolchain-lin toolchain-win toolchain-mac rack-sdk
  55. toolchain-clean:
  56. rm -rf local osxcross $(rack-sdk)
  57. # Plugin build
  58. PLUGIN_BUILD_DIR := plugin-build
  59. plugin-build-mac: export PATH := $(LOCAL_DIR)/osxcross/bin:$(PATH)
  60. plugin-build-mac: export CC := x86_64-apple-darwin17-clang
  61. plugin-build-mac: export CXX := x86_64-apple-darwin17-clang++-libc++
  62. plugin-build-mac: export STRIP := x86_64-apple-darwin17-strip
  63. plugin-build-win: export PATH := $(LOCAL_DIR)/x86_64-w64-mingw32/bin:$(PATH)
  64. plugin-build-win: export CC := x86_64-w64-mingw32-gcc
  65. plugin-build-win: export CXX := x86_64-w64-mingw32-g++
  66. plugin-build-win: export STRIP := x86_64-w64-mingw32-strip
  67. plugin-build-linux: export PATH:=$(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu/bin:$(PATH)
  68. plugin-build-linux: export CC := x86_64-ubuntu16.04-linux-gnu-gcc
  69. plugin-build-linux: export CXX := x86_64-ubuntu16.04-linux-gnu-g++
  70. plugin-build-linux: export STRIP := x86_64-ubuntu16.04-linux-gnu-strip
  71. plugin-build-mac plugin-build-win plugin-build-linux: export RACK_DIR := $(RACK_DIR)
  72. # Since the compiler we're using could have a newer version than the minimum supported libstdc++ version, link it statically.
  73. # Rack v2 includes this flag in plugin.mk, so remove it after it releases.
  74. plugin-build-mac plugin-build-win plugin-build-linux: export LDFLAGS := -static-libstdc++
  75. plugin-build-mac plugin-build-win plugin-build-linux:
  76. cd $(PLUGIN_DIR) && $(MAKE) clean
  77. cd $(PLUGIN_DIR) && $(MAKE) cleandep
  78. cd $(PLUGIN_DIR) && $(MAKE) dep
  79. cd $(PLUGIN_DIR) && $(MAKE) dist
  80. mkdir -p $(PLUGIN_BUILD_DIR)
  81. cp $(PLUGIN_DIR)/dist/*.zip $(PLUGIN_BUILD_DIR)/
  82. cd $(PLUGIN_DIR) && $(MAKE) clean
  83. plugin-build:
  84. $(MAKE) plugin-build-mac
  85. $(MAKE) plugin-build-win
  86. $(MAKE) plugin-build-linux
  87. plugin-build-clean:
  88. rm -rf $(PLUGIN_BUILD_DIR)
  89. # Docker helpers
  90. dep-ubuntu:
  91. apt-get update
  92. apt-get install -y --no-install-recommends \
  93. ca-certificates \
  94. git \
  95. build-essential \
  96. autoconf \
  97. automake \
  98. bison \
  99. flex \
  100. gawk \
  101. libtool-bin \
  102. libncurses5-dev \
  103. unzip \
  104. zip \
  105. jq \
  106. libgl-dev \
  107. libglu-dev \
  108. git \
  109. wget \
  110. curl \
  111. cmake \
  112. nasm \
  113. xz-utils \
  114. file \
  115. python3 \
  116. libxml2-dev \
  117. libssl-dev \
  118. texinfo \
  119. help2man \
  120. clang \
  121. libz-dev \
  122. rsync
  123. dep-arch-linux:
  124. # TODO Complete this list
  125. sudo pacman -S --needed \
  126. wget \
  127. help2man
  128. docker-build:
  129. docker build --tag rack-plugin-toolchain:1 docker
  130. DOCKER_RUN := docker run --rm --interactive --tty \
  131. --volume=$(PLUGIN_DIR):/home/build/plugin-src \
  132. --volume=$(PWD)/$(PLUGIN_BUILD_DIR):/home/build/$(PLUGIN_BUILD_DIR) \
  133. --env PLUGIN_DIR=/home/build/plugin-src \
  134. rack-plugin-toolchain:1 \
  135. /bin/bash
  136. docker-run:
  137. $(DOCKER_RUN)
  138. docker-plugin-build-mac:
  139. mkdir -p $(PLUGIN_BUILD_DIR)
  140. $(DOCKER_RUN) -c "$(MAKE) plugin-build-mac"
  141. docker-plugin-build-win:
  142. mkdir -p $(PLUGIN_BUILD_DIR)
  143. $(DOCKER_RUN) -c "$(MAKE) plugin-build-win"
  144. docker-plugin-build-lin:
  145. mkdir -p $(PLUGIN_BUILD_DIR)
  146. $(DOCKER_RUN) -c "$(MAKE) plugin-build-lin"
  147. docker-plugin-build:
  148. mkdir -p $(PLUGIN_BUILD_DIR)
  149. $(DOCKER_RUN) -c "$(MAKE) plugin-build"