Skip to content

Commit 38f9c13

Browse files
committed
Add toolchain fix patch
1 parent e3d74d7 commit 38f9c13

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

.github/scripts/fix-toolchain.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Find the path to swift binary
5+
SWIFT_PATH=$(which swift)
6+
echo "Swift binary found at: $SWIFT_PATH"
7+
8+
# Extract the toolchain path from swift binary path
9+
# Remove /usr/bin/swift from the path to get the toolchain root
10+
TOOLCHAIN_ROOT=$(dirname $(dirname "$SWIFT_PATH"))
11+
echo "Toolchain root: $TOOLCHAIN_ROOT"
12+
13+
# Construct the path to CFBase.h
14+
CFBASE_PATH="$TOOLCHAIN_ROOT/lib/swift/CoreFoundation/CFBase.h"
15+
echo "Looking for CFBase.h at: $CFBASE_PATH"
16+
17+
# Check if the file exists
18+
if [ -f "$CFBASE_PATH" ]; then
19+
echo "Found CFBase.h, applying patch..."
20+
21+
# Create a backup of the original file
22+
cp "$CFBASE_PATH" "$CFBASE_PATH.bak"
23+
24+
# Replace the include line
25+
sed -i 's/#include <ptrauth.h>/\/\/ #include <ptrauth.h>/g' "$CFBASE_PATH"
26+
27+
echo "Patch applied successfully."
28+
echo "Original file backed up at $CFBASE_PATH.bak"
29+
else
30+
echo "ERROR: Could not find CFBase.h in expected location."
31+
echo "Toolchain structure may be different than expected."
32+
exit 1
33+
fi

.github/workflows/ubuntu.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ jobs:
2424
- name: Swift version
2525
run: |
2626
which swift && swift --version
27+
- name: Toolchain fix patch
28+
run: |
29+
# Fix swift-corelibs-foundation#5211
30+
.github/scripts/fix-toolchain.sh
2731
- name: Building and running tests in debug mode with coverage
2832
run: |
2933
swift test \

0 commit comments

Comments
 (0)