@@ -1,4 +1,4 @@ | |||
FROM ubuntu:20.04 | |||
FROM ubuntu:20.04 AS build1 | |||
MAINTAINER Ray Burgemeestre | |||
@@ -31,6 +31,18 @@ RUN wget https://github.com/Kitware/CMake/releases/download/v3.21.3/cmake-3.21.3 | |||
rm -rf cmake-3.21.3 && \ | |||
rm -rf cmake-3.21.3.tar.gz | |||
# Install emscripten deps | |||
RUN sudo apt-get update && \ | |||
sudo apt-get install -y libsdl2-dev && \ | |||
(git clone https://github.com/emscripten-core/emsdk.git || true) && \ | |||
pushd emsdk && \ | |||
./emsdk install latest && \ | |||
./emsdk activate latest && \ | |||
sudo cp -prv ./emsdk_env.sh /etc/profile.d/ | |||
# Warmup emscripten (this will pre-fetch SDL2, and cache it) | |||
RUN /emsdk/upstream/emscripten/em++ -s WASM=1 -s USE_SDL=2 -s USE_SDL_TTF=2 -O3 /dev/null || true | |||
# Fix some weird linker issue CAF build runs into. (fails to link -lc++abi) | |||
RUN cp -prv /usr/lib/llvm-12/lib/libc++abi.so.1.0 /usr/lib/llvm-12/lib/libc++abi.so | |||
@@ -40,4 +52,8 @@ COPY switch-to-latest-clang /usr/local/bin/switch-to-latest-clang | |||
RUN chmod +x /usr/local/bin/switch-to-latest-clang | |||
FROM scratch | |||
COPY --from=build1 / / | |||
CMD "/bin/bash" |
@@ -3,6 +3,7 @@ SHELL:=/bin/bash | |||
ubuntu2004: | |||
git clone https://github.com/rayburgemeestre/fmt --branch 7.1.3 | |||
bash ../ubuntu2004.sh make impl | |||
bash ../ubuntu2004.sh make impl-emscripten | |||
make package-ubuntu2004 | |||
bash ../ubuntu2004.sh chown $$(id -u):$$(id -g) . -R # fix permissions | |||
@@ -15,10 +16,20 @@ impl: | |||
make -j $$(nproc) && \ | |||
make install | |||
impl-emscripten: | |||
switch-to-latest-clang | |||
apt-get update && apt-get install libz-dev -y && \ | |||
pushd fmt && \ | |||
mkdir build2 && pushd build2 && \ | |||
CXX=/emsdk/upstream/emscripten/em++ cmake -DCMAKE_C_FLAGS=-fPIC -DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_INSTALL_PREFIX=$$PWD/fmt_out2 .. && \ | |||
make -j $$(nproc) && \ | |||
make install | |||
package-ubuntu2004: | |||
rm -rf out | |||
mkdir -p out/opt/cppse/build/fmt | |||
cp -prv fmt/build/fmt_out/* out/opt/cppse/build/fmt/ | |||
cp -prv fmt/build/fmt_out2/lib/libfmt.a out/opt/cppse/build/fmt/lib/libfmt-em.a | |||
rm -rf fmt_*_amd64.deb | |||
docker run -v "$$(pwd):/src/" rayburgemeestre/fpm-ubuntu:20.04 fpm -v 1.1 -s dir -t deb -n fmt --license MPL2 --maintainer "Ray Burgemeestre <ray@cppse.nl>" --description "fmt - build dependency" --url "https://github.com/mattgodbolt/fmt" --deb-generate-changes -C /src/out | |||