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.

171 lines
4.2KB

  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.bz2 $@/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. plugin-build-mac plugin-build-windows plugin-build-linux:
  73. cd $(PLUGIN_DIR) && $(MAKE) clean
  74. cd $(PLUGIN_DIR) && $(MAKE) cleandep
  75. cd $(PLUGIN_DIR) && $(MAKE) dep
  76. cd $(PLUGIN_DIR) && $(MAKE) dist
  77. mkdir -p $(PLUGIN_BUILD_DIR)
  78. cp $(PLUGIN_DIR)/dist/*.zip $(PLUGIN_BUILD_DIR)/
  79. cd $(PLUGIN_DIR) && $(MAKE) clean
  80. plugin-build: plugin-build-mac plugin-build-windows plugin-build-linux
  81. plugin-build-clean:
  82. rm -rf $(PLUGIN_BUILD_DIR)
  83. # Docker helpers
  84. dep-ubuntu:
  85. sudo apt-get update
  86. sudo apt-get install -y --no-install-recommends \
  87. ca-certificates \
  88. git \
  89. build-essential \
  90. autoconf \
  91. automake \
  92. bison \
  93. flex \
  94. gawk \
  95. libtool-bin \
  96. libncurses5-dev \
  97. unzip \
  98. zip \
  99. jq \
  100. libgl-dev \
  101. libglu-dev \
  102. git \
  103. wget \
  104. curl \
  105. cmake \
  106. nasm \
  107. xz-utils \
  108. file \
  109. python3 \
  110. libxml2-dev \
  111. libssl-dev \
  112. texinfo \
  113. help2man
  114. dep-arch-linux:
  115. # TODO Complete this list
  116. sudo pacman -S --needed \
  117. wget \
  118. help2man
  119. docker-build:
  120. docker build -t rack-plugin-toolchain:1 .
  121. docker-run:
  122. docker run --rm -it rack-plugin-toolchain:1