diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e93949 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +MacOSX10.13.sdk.tar.xz +plugin-build/ diff --git a/Dockerfile b/Dockerfile index bcbde9e..c2ac6ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,24 @@ -# TODO upgrade to recent Ubuntu version -FROM ubuntu:16.04 +FROM ubuntu:20.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 +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends make + WORKDIR /home/build -RUN make toolchain-linux -RUN make toolchain-windows -RUN make toolchain-mac +COPY Makefile /home/build/Makefile + +# Install dependencies for building toolchains and plugins +RUN make dep-ubuntu + +USER build +COPY MacOSX10.13.sdk.tar.xz /home/build/MacOSX10.13.sdk.tar.xz + +RUN make toolchain-all -# TODO untested \ No newline at end of file +RUN rm /home/build/MacOSX10.13.sdk.tar.xz +RUN rm /home/build/build.log diff --git a/Makefile b/Makefile index b569f15..19e8274 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,7 @@ $(toolchain-mac): #cd $@/build/llvm-10.0.1.src/build && make install # Build osxcross - cp MacOSX10.13.sdk.tar.bz2 $@/tarballs/ + cp MacOSX10.13.sdk.tar.* $@/tarballs/ cd $@ && UNATTENDED=1 TARGET_DIR="$(LOCAL_DIR)/osxcross" ./build.sh rm -rf osxcross @@ -132,8 +132,8 @@ plugin-build-clean: dep-ubuntu: - sudo apt-get update - sudo apt-get install -y --no-install-recommends \ + apt-get update + apt-get install -y --no-install-recommends \ ca-certificates \ git \ build-essential \ @@ -160,7 +160,11 @@ dep-ubuntu: libxml2-dev \ libssl-dev \ texinfo \ - help2man + help2man \ + clang \ + libz-dev \ + rsync + rm -rf /var/lib/apt/lists/* dep-arch-linux: @@ -175,4 +179,12 @@ docker-build: docker-run: - docker run --rm -it rack-plugin-toolchain:1 + mkdir -p $(PLUGIN_BUILD_DIR) + docker run --rm -it \ + -v $(PLUGIN_DIR):/home/build/plugin-src \ + -v $(PWD)/$(PLUGIN_BUILD_DIR):/home/build/$(PLUGIN_BUILD_DIR) \ + -e PLUGIN_DIR=plugin-src \ + rack-plugin-toolchain:1 \ + /bin/bash \ + -c "$(MAKE) plugin-build $(MFLAGS)" + diff --git a/README.md b/README.md index 5029c02..4ef1f95 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,44 @@ 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. +## General prerequisites -## Building - -Clone this repository in a path without spaces, or the Makefile will break. +**IMPORTANT:** 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. +This must be done on a computer with macOS 10.13. + +Place `MacOSX10.13.sdk.tar.bz2` in root directory of this repository. + +## Local toolchain build Build toolchains for each platform. ``` -make toolchain-linux -make toolchain-windows -make toolchain-mac +make toolchain-all ``` Each toolchain will take around an hour to build, requiring network access and about 15 GB free disk space. The final disk space after building is about 1.6 GB. -Download the latest Rack SDK. +Execute plugin build. ``` -make rack-sdk +make plugin-build -j 8 PLUGIN_DIR=... ``` -## Building plugins +Build artifacts will be located in `plugin-build` directory. -Build plugin package for all platforms. +## Docker-based toolchain build + +Build Docker image with toolchains for each platform. ``` -make plugin-build PLUGIN_DIR=... +make docker-build ``` -This places packages in `plugin-build/`. +Execute plugin build in Docker container. +``` +make docker-run -j 8 PLUGIN_DIR=... +``` +Build artifacts will be located in `plugin-build` directory. ## Acknowledgments