diff --git a/platforms/switch/clang-3.9.1/linux/Dockerfile b/platforms/switch/clang-3.9.1/linux/Dockerfile index 0f55e57..f6ea3bc 100644 --- a/platforms/switch/clang-3.9.1/linux/Dockerfile +++ b/platforms/switch/clang-3.9.1/linux/Dockerfile @@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-3.9.1/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/clang-3.9.1" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/switch/clang-3.9.1" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/switch/clang-3.9.1/ diff --git a/platforms/switch/clang-4.0.1/darwin/Dockerfile b/platforms/switch/clang-4.0.1/darwin/Dockerfile index f04c5fe..6e07db1 100644 --- a/platforms/switch/clang-4.0.1/darwin/Dockerfile +++ b/platforms/switch/clang-4.0.1/darwin/Dockerfile @@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-4.0.1/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/clang-4.0.1" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/switch/clang-4.0.1" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/switch/clang-4.0.1/ diff --git a/platforms/switch/clang-4.0.1/linux/Dockerfile b/platforms/switch/clang-4.0.1/linux/Dockerfile index c1786be..b6893b5 100644 --- a/platforms/switch/clang-4.0.1/linux/Dockerfile +++ b/platforms/switch/clang-4.0.1/linux/Dockerfile @@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-4.0.1/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/clang-4.0.1" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/switch/clang-4.0.1" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/switch/clang-4.0.1/ diff --git a/platforms/switch/clang-8.0.0/darwin/Dockerfile b/platforms/switch/clang-8.0.0/darwin/Dockerfile index e2b9d90..810abe1 100644 --- a/platforms/switch/clang-8.0.0/darwin/Dockerfile +++ b/platforms/switch/clang-8.0.0/darwin/Dockerfile @@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-8.0.0/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/clang-8.0.0" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/switch/clang-8.0.0" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/switch/clang-8.0.0/ diff --git a/platforms/switch/clang-8.0.0/linux/Dockerfile b/platforms/switch/clang-8.0.0/linux/Dockerfile index 2f083a2..ac6ab22 100644 --- a/platforms/switch/clang-8.0.0/linux/Dockerfile +++ b/platforms/switch/clang-8.0.0/linux/Dockerfile @@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-8.0.0/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/clang-8.0.0" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/switch/clang-8.0.0" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/switch/clang-8.0.0/ diff --git a/templates/switch/clang.j2 b/templates/switch/clang.j2 index f48b045..1d309e3 100644 --- a/templates/switch/clang.j2 +++ b/templates/switch/clang.j2 @@ -24,6 +24,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA RUN unzip musl.zip RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/{{ platform }}/{{ id }}/ +RUN apk add patch + +ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches +ARG PATCH_BRANCH=main + +RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip" +RUN unzip patches.zip -d /tmp +RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches + +# apply patches to clang +RUN patch_dir="/tmp/patches/{{ id }}" && \ + find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \ + echo "Applying patch: $patch"; \ + patch -d "/compilers/{{ platform }}/{{ id }}" -p0 < "$patch"; \ + done; + RUN chown -R root:root /compilers/{{ platform }}/{{ id }}/