commit 8f775c5d5e1240a0e6d240987d733afefde55b8e Author: Andrew Belt Date: Thu Oct 8 13:06:36 2020 -0400 Initial commit. diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bcbde9e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# TODO upgrade to recent Ubuntu version +FROM ubuntu:16.04 +ENV LANG C.UTF-8 + +# User to build toolchains and plugins +RUN groupadd -g 1000 build +RUN useradd --create-home --uid 1000 --gid 1000 --shell /bin/bash build + +USER build +WORKDIR /home/build + +RUN make toolchain-linux +RUN make toolchain-windows +RUN make toolchain-mac + +# TODO untested \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c822a05 --- /dev/null +++ b/Makefile @@ -0,0 +1,145 @@ + +# Installation path for executables +LOCAL_DIR := $(PWD)/local +# Local programs should have higher path priority than system-installed programs +export PATH := $(LOCAL_DIR)/bin:$(PATH) + + +all: toolchain-linux toolchain-windows toolchain-mac + + +crosstool-ng := $(LOCAL_DIR)/bin/ct-ng +$(crosstool-ng): + wget -c "http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.24.0.tar.xz" + tar -xf crosstool-ng-1.24.0.tar.xz + rm crosstool-ng-1.24.0.tar.xz + cd crosstool-ng-1.24.0 && ./bootstrap + cd crosstool-ng-1.24.0 && ./configure --prefix="$(LOCAL_DIR)" + cd crosstool-ng-1.24.0 && make + cd crosstool-ng-1.24.0 && make install + rm -rf crosstool-ng-1.24.0 + + +toolchain-linux := $(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu +toolchain-linux: $(toolchain-linux) +$(toolchain-linux): $(crosstool-ng) + ct-ng x86_64-ubuntu16.04-linux-gnu + CT_PREFIX="$(LOCAL_DIR)" ct-ng build + rm -rf .build .config + # HACK Copy GL include dir to toolchain sysroot + chmod +w $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include + cp -r /usr/include/GL $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include/ + chmod -w $(toolchain-linux)/x86_64-ubuntu16.04-linux-gnu/sysroot/usr/include + + +toolchain-windows := $(LOCAL_DIR)/x86_64-w64-mingw32 +toolchain-windows: $(toolchain-windows) +$(toolchain-windows): $(crosstool-ng) + ct-ng x86_64-w64-mingw32 + CT_PREFIX="$(LOCAL_DIR)" ct-ng build + rm -rf .build .config + + +toolchain-mac := osxcross +toolchain-mac: $(toolchain-mac) +$(toolchain-mac): + git clone "https://github.com/tpoechtrager/osxcross.git" $@ + cd $@ && git checkout a791ad4fca685ea9fceb520b77db586881cd3f3d + + # Build clang + #cd $@ && UNATTENDED=1 DISABLE_BOOTSTRAP=1 INSTALLPREFIX="$(LOCAL_DIR)" OCDEBUG=1 ./build_clang.sh + #cd $@/build/llvm-10.0.1.src/build && make install + + # Build osxcross + cp MacOSX10.13.sdk.tar.bz2 $@/tarballs/ + cd $@ && UNATTENDED=1 TARGET_DIR="$(LOCAL_DIR)/osxcross" ./build.sh + + +rack-sdk := Rack-SDK +rack-sdk: $(rack-sdk) +$(rack-sdk): + wget -c "https://vcvrack.com/downloads/Rack-SDK-1.1.6.zip" + unzip Rack-SDK-1.1.6.zip + rm Rack-SDK-1.1.6.zip +RACK_DIR := $(PWD)/$(rack-sdk) + + +plugin-build-mac: export PATH := $(PWD)/osxcross/target/bin:$(PATH) +plugin-build-mac: export CC := x86_64-apple-darwin17-clang +plugin-build-mac: export CXX := x86_64-apple-darwin17-clang++-libc++ +plugin-build-mac: export STRIP := x86_64-apple-darwin17-strip + + +plugin-build-windows: export PATH := $(LOCAL_DIR)/x86_64-w64-mingw32/bin:$(PATH) +plugin-build-windows: export CC := x86_64-w64-mingw32-gcc +plugin-build-windows: export CXX := x86_64-w64-mingw32-g++ +plugin-build-windows: export STRIP := x86_64-w64-mingw32-strip + + +plugin-build-linux: export PATH:=$(LOCAL_DIR)/x86_64-ubuntu16.04-linux-gnu/bin:$(PATH) +plugin-build-linux: export CC := x86_64-ubuntu16.04-linux-gnu-gcc +plugin-build-linux: export CXX := x86_64-ubuntu16.04-linux-gnu-g++ +plugin-build-linux: export STRIP := x86_64-ubuntu16.04-linux-gnu-strip + + +plugin-build-mac plugin-build-windows plugin-build-linux: export RACK_DIR := $(RACK_DIR) +plugin-build-mac plugin-build-windows plugin-build-linux: + cd $(PLUGIN_DIR) && $(MAKE) clean + cd $(PLUGIN_DIR) && $(MAKE) cleandep + cd $(PLUGIN_DIR) && $(MAKE) dep + cd $(PLUGIN_DIR) && $(MAKE) dist + mkdir -p plugin-build + cp $(PLUGIN_DIR)/dist/*.zip plugin-build/ + cd $(PLUGIN_DIR) && $(MAKE) clean + + +plugin-build: plugin-build-mac plugin-build-windows plugin-build-linux + + +dep-ubuntu: + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + ca-certificates \ + git \ + build-essential \ + autoconf \ + automake \ + bison \ + flex \ + gawk \ + libtool-bin \ + libncurses5-dev \ + unzip \ + zip \ + jq \ + libgl-dev \ + libglu-dev \ + git \ + wget \ + curl \ + cmake \ + nasm \ + xz-utils \ + file \ + python3 \ + libxml2-dev \ + libssl-dev \ + texinfo \ + help2man + +dep-arch-linux: + # TODO Complete this list + sudo pacman -S --needed \ + wget \ + help2man + + +docker-build: + docker build -t rack-plugin-toolchain:1 . + +docker-run: + docker run --rm -it rack-plugin-toolchain:1 + + +.NOTPARALLEL: +.PHONY: all plugin-build diff --git a/README.md b/README.md new file mode 100644 index 0000000..8177700 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ + +Build Rack plugins for Mac, Windows, and Linux with a single command on any Linux distro. +Coming soon: Use Docker to build on Mac, Windows, or Linux. + + +## Building + +Clone this repository in a path without spaces, or the Makefile will break. + +Obtain `MacOSX10.13.sdk.tar.bz2` using the method at https://github.com/tpoechtrager/osxcross#packaging-the-sdk, and place it in the root of this repository. +This must be done on a computer with Mac 10.13. + +Build toolchains for each platform. +``` +make toolchain-linux +make toolchain-windows +make toolchain-mac +``` +Each toolchain will take around an hour to build, requiring network access and about 15 GB free disk space total. + +Download the latest Rack SDK. +``` +make rack-sdk +``` + +## Building plugins + +Build plugin package for all platforms. +``` +m plugin-build PLUGIN_DIR=... +``` + +This places packages in `plugin-build/`.