Browse Source

Add emscripten stuff to base build image.

master
Ray Burgemeestre 3 years ago
parent
commit
4638db0c43
2 changed files with 28 additions and 1 deletions
  1. +17
    -1
      Dockerfile-ubuntu2004
  2. +11
    -0
      fmt/Makefile

+ 17
- 1
Dockerfile-ubuntu2004 View File

FROM ubuntu:20.04
FROM ubuntu:20.04 AS build1


MAINTAINER Ray Burgemeestre MAINTAINER Ray Burgemeestre


rm -rf cmake-3.21.3 && \ rm -rf cmake-3.21.3 && \
rm -rf cmake-3.21.3.tar.gz 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) # 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 RUN cp -prv /usr/lib/llvm-12/lib/libc++abi.so.1.0 /usr/lib/llvm-12/lib/libc++abi.so




RUN chmod +x /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" CMD "/bin/bash"

+ 11
- 0
fmt/Makefile View File

ubuntu2004: ubuntu2004:
git clone https://github.com/rayburgemeestre/fmt --branch 7.1.3 git clone https://github.com/rayburgemeestre/fmt --branch 7.1.3
bash ../ubuntu2004.sh make impl bash ../ubuntu2004.sh make impl
bash ../ubuntu2004.sh make impl-emscripten
make package-ubuntu2004 make package-ubuntu2004
bash ../ubuntu2004.sh chown $$(id -u):$$(id -g) . -R # fix permissions bash ../ubuntu2004.sh chown $$(id -u):$$(id -g) . -R # fix permissions


make -j $$(nproc) && \ make -j $$(nproc) && \
make install 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: package-ubuntu2004:
rm -rf out rm -rf out
mkdir -p out/opt/cppse/build/fmt mkdir -p out/opt/cppse/build/fmt
cp -prv fmt/build/fmt_out/* 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 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 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



Loading…
Cancel
Save