Skip to content

Commit 582fdf3

Browse files
authored
Patch Clang for Switch (#40)
* Patch clang for Switch * No need to delete tmp/patches * Download the patches repo instead of cloning it * Update templates, oops * Fix include directory for the patch
1 parent 4b4da54 commit 582fdf3

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

platforms/switch/clang-3.9.1/linux/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2525
RUN unzip musl.zip
2626
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-3.9.1/
2727

28+
RUN apk add patch
29+
30+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
31+
ARG PATCH_BRANCH=main
32+
33+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
34+
RUN unzip patches.zip -d /tmp
35+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
36+
37+
# apply patches to clang
38+
RUN patch_dir="/tmp/patches/clang-3.9.1" && \
39+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
40+
echo "Applying patch: $patch"; \
41+
patch -d "/compilers/switch/clang-3.9.1" -p0 < "$patch"; \
42+
done;
43+
2844
RUN chown -R root:root /compilers/switch/clang-3.9.1/
2945

3046

platforms/switch/clang-4.0.1/darwin/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2525
RUN unzip musl.zip
2626
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-4.0.1/
2727

28+
RUN apk add patch
29+
30+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
31+
ARG PATCH_BRANCH=main
32+
33+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
34+
RUN unzip patches.zip -d /tmp
35+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
36+
37+
# apply patches to clang
38+
RUN patch_dir="/tmp/patches/clang-4.0.1" && \
39+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
40+
echo "Applying patch: $patch"; \
41+
patch -d "/compilers/switch/clang-4.0.1" -p0 < "$patch"; \
42+
done;
43+
2844
RUN chown -R root:root /compilers/switch/clang-4.0.1/
2945

3046

platforms/switch/clang-4.0.1/linux/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2525
RUN unzip musl.zip
2626
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-4.0.1/
2727

28+
RUN apk add patch
29+
30+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
31+
ARG PATCH_BRANCH=main
32+
33+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
34+
RUN unzip patches.zip -d /tmp
35+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
36+
37+
# apply patches to clang
38+
RUN patch_dir="/tmp/patches/clang-4.0.1" && \
39+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
40+
echo "Applying patch: $patch"; \
41+
patch -d "/compilers/switch/clang-4.0.1" -p0 < "$patch"; \
42+
done;
43+
2844
RUN chown -R root:root /compilers/switch/clang-4.0.1/
2945

3046

platforms/switch/clang-8.0.0/darwin/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2525
RUN unzip musl.zip
2626
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-8.0.0/
2727

28+
RUN apk add patch
29+
30+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
31+
ARG PATCH_BRANCH=main
32+
33+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
34+
RUN unzip patches.zip -d /tmp
35+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
36+
37+
# apply patches to clang
38+
RUN patch_dir="/tmp/patches/clang-8.0.0" && \
39+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
40+
echo "Applying patch: $patch"; \
41+
patch -d "/compilers/switch/clang-8.0.0" -p0 < "$patch"; \
42+
done;
43+
2844
RUN chown -R root:root /compilers/switch/clang-8.0.0/
2945

3046

platforms/switch/clang-8.0.0/linux/Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2525
RUN unzip musl.zip
2626
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/switch/clang-8.0.0/
2727

28+
RUN apk add patch
29+
30+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
31+
ARG PATCH_BRANCH=main
32+
33+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
34+
RUN unzip patches.zip -d /tmp
35+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
36+
37+
# apply patches to clang
38+
RUN patch_dir="/tmp/patches/clang-8.0.0" && \
39+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
40+
echo "Applying patch: $patch"; \
41+
patch -d "/compilers/switch/clang-8.0.0" -p0 < "$patch"; \
42+
done;
43+
2844
RUN chown -R root:root /compilers/switch/clang-8.0.0/
2945

3046

templates/switch/clang.j2

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@ RUN wget -O musl.zip https://github.com/open-ead/botw-lib-musl/archive/${MUSL_HA
2424
RUN unzip musl.zip
2525
RUN cp -r botw-lib-musl-${MUSL_HASH} /compilers/{{ platform }}/{{ id }}/
2626

27+
RUN apk add patch
28+
29+
ARG PATCH_REPO=https://github.com/GRAnimated/switch-clang-patches
30+
ARG PATCH_BRANCH=main
31+
32+
RUN wget -O patches.zip "${PATCH_REPO}/archive/refs/heads/${PATCH_BRANCH}.zip"
33+
RUN unzip patches.zip -d /tmp
34+
RUN mv /tmp/switch-clang-patches-${PATCH_BRANCH} /tmp/patches
35+
36+
# apply patches to clang
37+
RUN patch_dir="/tmp/patches/{{ id }}" && \
38+
find "$patch_dir" -type f -name '*.diff' -print0 | while IFS= read -r -d '' patch; do \
39+
echo "Applying patch: $patch"; \
40+
patch -d "/compilers/{{ platform }}/{{ id }}" -p0 < "$patch"; \
41+
done;
42+
2743
RUN chown -R root:root /compilers/{{ platform }}/{{ id }}/
2844

2945

0 commit comments

Comments
 (0)