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
4.8KB

  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-linux := $(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu
  20. toolchain-linux: $(toolchain-linux)
  21. $(toolchain-linux): $(crosstool-ng)
  22. ct-ng x86_64-ubuntu16.04-linux-gnu
  23. CT_PREFIX="$(LOCAL_DIR)" ct-ng build
  24. rm -rf .build .config
  25. # HACK Copy GL include dir to toolchain sysroot
  26. chmod +w $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  27. cp -r /usr/include/GL $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/
  28. chmod -w $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include
  29. toolchain-windows := $(LOCAL_DIR)/x86_64-w64-mingw32
  30. toolchain-windows: $(toolchain-windows)
  31. $(toolchain-windows): $(crosstool-ng)
  32. ct-ng x86_64-w64-mingw32
  33. CT_PREFIX="$(LOCAL_DIR)" ct-ng build
  34. rm -rf .build .config
  35. toolchain-mac := 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-linux toolchain-windows 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-windows: export PATH := $(LOCAL_DIR)/x86_64-w64-mingw32/bin:$(PATH)
  64. plugin-build-windows: export CC := x86_64-w64-mingw32-gcc
  65. plugin-build-windows: export CXX := x86_64-w64-mingw32-g++
  66. plugin-build-windows: 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-windows 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-windows plugin-build-linux: export LDFLAGS := -static-libstdc++
  75. plugin-build-mac plugin-build-windows 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-windows
  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. rm -rf /var/lib/apt/lists/*
  124. dep-arch-linux:
  125. # TODO Complete this list
  126. sudo pacman -S --needed \
  127. wget \
  128. help2man
  129. docker-build:
  130. docker build -t rack-plugin-toolchain:1 .
  131. docker-run:
  132. mkdir -p $(PLUGIN_BUILD_DIR)
  133. docker run --rm -it \
  134. -v $(PLUGIN_DIR):/home/build/plugin-src \
  135. -v $(PWD)/$(PLUGIN_BUILD_DIR):/home/build/$(PLUGIN_BUILD_DIR) \
  136. -e PLUGIN_DIR=plugin-src \
  137. rack-plugin-toolchain:1 \
  138. /bin/bash \
  139. -c "$(MAKE) plugin-build $(MFLAGS)"