Skip to content

Fix one and add another stdlib patch for non-release branches on CI #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
else
sed -i "s%r26%ndk/26%" swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
if [ ${{ matrix.version }} = 'devel' ]; then
git apply -C1 libdispatch-alloc.patch
git apply -C1 libdispatch-alloc.patch readlink-devel.patch
fi
STUPID_FILE_RENAMING=Command
fi
Expand All @@ -132,9 +132,9 @@ jobs:
sed -i "s%#include <time%#include <signal.h>\n#include <time%" swift-tools-support-core/Sources/TSCclibc/include/indexstore_functions.h
sed -i "s%#include <time%#include <signal.h>\n#include <time%" swift-crypto/Sources/CCryptoBoringSSL/include/CCryptoBoringSSL_asn1.h
if [ ${{ matrix.version }} != 'release' ]; then
git apply -R swift-android-stdlib-ndk26.patch
git apply swift-android-stdlib-ndk25-trunk.patch
sed -i "s%#include <time%#include <signal.h>\n#include <time%" indexstore-db/include/indexstore/indexstore_functions.h
sed -i "s%#include <unistd%#include <signal.h>\n#include <unistd%" swift-syntax/Sources/_SwiftSyntaxCShims/include/swiftsyntax/_includes.h
sed -i "s%#include <unistd%#include <signal.h>\n#include <unistd%" swift-syntax/Sources/_SwiftSyntaxCShims/include/_includes.h
fi
fi
sed -i "s%/data/data/com.termux/files%$SDK%" $SDK/usr/lib/pkgconfig/sqlite3.pc
Expand Down
24 changes: 24 additions & 0 deletions readlink-devel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
commit 94b134818381e3fda628e11ae1f4f34287327cec
Author: Alex Lorenz <arphaman@gmail.com>
Date: Wed May 8 20:16:15 2024 -0700

stdlib: fix android build

the readlink addition in f4bf278 was introduced without a corresponding include.

diff --git a/swift/stdlib/public/runtime/Paths.cpp b/swift/stdlib/public/runtime/Paths.cpp
index 131a24ed405..174140238ba 100644
--- a/swift/stdlib/public/runtime/Paths.cpp
+++ b/swift/stdlib/public/runtime/Paths.cpp
@@ -49,6 +49,11 @@
#include <psapi.h>
#endif

+#ifdef __linux__
+// Needed for 'readlink'.
+#include <unistd.h>
+#endif
+
#include <cerrno>
#include <cstdlib>
#include <cstring>
13 changes: 13 additions & 0 deletions swift-android-stdlib-ndk25-trunk.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/swift/stdlib/public/SwiftShims/swift/shims/LibcShims.h b/swift/stdlib/public/SwiftShims/swift/shims/LibcShims.h
index 6a34bc4746a..bc4a02a6eed 100644
--- a/swift/stdlib/public/SwiftShims/swift/shims/LibcShims.h
+++ b/swift/stdlib/public/SwiftShims/swift/shims/LibcShims.h
@@ -61,7 +61,7 @@ SWIFT_READONLY
static inline int _swift_stdlib_memcmp(const void *s1, const void *s2,
__swift_size_t n) {
// FIXME: Is there a way to identify Glibc specifically?
-#if defined(__gnu_linux__) || defined(__ANDROID__) || defined(__musl__)
+#if defined(__gnu_linux__) || defined(__musl__)
extern int memcmp(const void * _Nonnull, const void * _Nonnull, __swift_size_t);
#else
extern int memcmp(const void * _Null_unspecified, const void * _Null_unspecified, __swift_size_t);