From e5da88135cafac2f4615f146ed05177e686d860d Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 17 Aug 2024 18:22:48 +0800 Subject: [PATCH 01/12] Add iOS build instruction in README --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index 4d84df521c1..afeaeaaa38f 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ Table of Contents * [Advanced Usage](#advanced-usage) * [Compiler and linker options](#compiler-and-linker-options) * [macOS](#macos) + * [iOS](#ios) * [Android](#android) * [MinGW](#mingw) * [Language Bindings](#language-bindings) @@ -329,6 +330,30 @@ If you'd like to work with Xcode, you can generate an Xcode project with "-G Xco > (10.4.4 ~ 10.6), CMake sets it all up for you if you use > `-DCMAKE_OSX_ARCHITECTURES="i386;x86_64"` when configuring. +iOS +------- + +1. Get an iOS cmake toolchain File: + +You can use a pre-existing toolchain file like [ios-cmake](https://github.com/leetal/ios-cmake) or write your own. + +2. Specify the toolchain and system Name: + +- The CMAKE_TOOLCHAIN_FILE variable points to the toolchain file for iOS. +- The CMAKE_SYSTEM_NAME should be set to iOS. + +3. Example Command: + +Assuming you're using the ios-cmake toolchain, the command might look like this: + +``` +cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=path/to/ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 .. +``` + +4. Build the Project: + +After generating the project, open the .xcodeproj file in Xcode, select your iOS device or simulator as the target, and build your project. + Android ------- From 4b63eb5dc8c24a6bd1b9a4ca2aeb4d57a31cfa73 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 17 Aug 2024 18:22:57 +0800 Subject: [PATCH 02/12] Fix iOS build issue --- cmake/SelectGSSAPI.cmake | 2 +- cmake/SelectHTTPSBackend.cmake | 2 +- src/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/SelectGSSAPI.cmake b/cmake/SelectGSSAPI.cmake index 5bde11697df..829850a4de9 100644 --- a/cmake/SelectGSSAPI.cmake +++ b/cmake/SelectGSSAPI.cmake @@ -2,7 +2,7 @@ include(SanitizeBool) # We try to find any packages our backends might use find_package(GSSAPI) -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS") include(FindGSSFramework) endif() diff --git a/cmake/SelectHTTPSBackend.cmake b/cmake/SelectHTTPSBackend.cmake index d293001f567..61bc763fce5 100644 --- a/cmake/SelectHTTPSBackend.cmake +++ b/cmake/SelectHTTPSBackend.cmake @@ -3,7 +3,7 @@ include(SanitizeBool) # We try to find any packages our backends might use find_package(OpenSSL) find_package(mbedTLS) -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS") find_package(Security) find_package(CoreFoundation) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed3f4a51427..51fc67757e2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -201,7 +201,7 @@ add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support") add_subdirectory(libgit2) add_subdirectory(util) -if(BUILD_CLI) +if(BUILD_CLI AND NOT CMAKE_SYSTEM_NAME MATCHES "iOS") add_subdirectory(cli) endif() From 8957d362280713241b507f74f1b06b68cb5ab977 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 17 Aug 2024 18:28:36 +0800 Subject: [PATCH 03/12] Add SecCopyErrorMessageString API when building for iOS SecCopyErrorMessageString is supported since iOS 11.3. I believe we do not need to use #if check here since the default IPHONEOS_DEPLOYMENT_TARGET is iOS 13.0 for Xcode 15.3. --- src/libgit2/streams/stransport.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/libgit2/streams/stransport.c b/src/libgit2/streams/stransport.c index 7a3585e246b..1b9fff584a4 100644 --- a/src/libgit2/streams/stransport.c +++ b/src/libgit2/streams/stransport.c @@ -26,16 +26,11 @@ static int stransport_error(OSStatus ret) return 0; } -#if !TARGET_OS_IPHONE message = SecCopyErrorMessageString(ret, NULL); GIT_ERROR_CHECK_ALLOC(message); git_error_set(GIT_ERROR_NET, "SecureTransport error: %s", CFStringGetCStringPtr(message, kCFStringEncodingUTF8)); CFRelease(message); -#else - git_error_set(GIT_ERROR_NET, "SecureTransport error: OSStatus %d", (unsigned int)ret); - GIT_UNUSED(message); -#endif return -1; } From 06a9dc995ac1e012426b46214859386e4599423d Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 17 Aug 2024 19:02:38 +0800 Subject: [PATCH 04/12] Add iOS CI support --- .github/workflows/main.yml | 11 +++++++++++ ci/setup-ios-benchmark.sh | 6 ++++++ ci/setup-ios-build.sh | 10 ++++++++++ 3 files changed, 27 insertions(+) create mode 100755 ci/setup-ios-benchmark.sh create mode 100755 ci/setup-ios-build.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 87e834f10db..8d71bea9c71 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,6 +73,17 @@ jobs: PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig SKIP_SSH_TESTS: true SKIP_NEGOTIATE_TESTS: true + - name: "iOS" + id: ios + os: macos-14 + setup-script: ios + env: + CC: clang + CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 + CMAKE_GENERATOR: Ninja + PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig + SKIP_SSH_TESTS: true + SKIP_NEGOTIATE_TESTS: true - name: "Windows (amd64, Visual Studio, Schannel)" id: windows-amd64-vs os: windows-2019 diff --git a/ci/setup-ios-benchmark.sh b/ci/setup-ios-benchmark.sh new file mode 100755 index 00000000000..80d87682b3e --- /dev/null +++ b/ci/setup-ios-benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +set -ex + +brew update +brew install hyperfine diff --git a/ci/setup-ios-build.sh b/ci/setup-ios-build.sh new file mode 100755 index 00000000000..94af4e486de --- /dev/null +++ b/ci/setup-ios-build.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -ex + +brew update +brew install pkgconfig libssh2 ninja + +ln -s /Applications/Xcode.app/Contents/Developer/usr/lib/libLeaksAtExit.dylib /usr/local/lib + +curl -s -L https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake -o ios.toolchain.cmake From 60cdd25709f7ee166d47e869aa30abf845671d85 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sun, 18 Aug 2024 12:00:09 +0800 Subject: [PATCH 05/12] =?UTF-8?q?Align=20the=20iOS=20CI=E2=80=99s=20host?= =?UTF-8?q?=20OS=20version=20to=20fix=20the=20permission=20issue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d71bea9c71..bef7873aeaa 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -75,7 +75,7 @@ jobs: SKIP_NEGOTIATE_TESTS: true - name: "iOS" id: ios - os: macos-14 + os: macos-12 setup-script: ios env: CC: clang From 07bb47ca5ca56f3139938d3e5592223c0997765b Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 24 Aug 2024 11:42:39 +0800 Subject: [PATCH 06/12] Fix CI toolchain file location issue --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bef7873aeaa..7a570462270 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,7 +79,7 @@ jobs: setup-script: ios env: CC: clang - CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 + CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 CMAKE_GENERATOR: Ninja PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig SKIP_SSH_TESTS: true From 841164ec395770cd2701e17a739ee6219309b945 Mon Sep 17 00:00:00 2001 From: Kyle Date: Sat, 24 Aug 2024 12:03:36 +0800 Subject: [PATCH 07/12] Fix regcomp_l compile issue --- .github/workflows/main.yml | 2 +- ci/setup-ios-build.sh | 2 ++ cmake/SelectRegex.cmake | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7a570462270..f6abfcdeadb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -79,7 +79,7 @@ jobs: setup-script: ios env: CC: clang - CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp_l -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 + CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 CMAKE_GENERATOR: Ninja PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig SKIP_SSH_TESTS: true diff --git a/ci/setup-ios-build.sh b/ci/setup-ios-build.sh index 94af4e486de..195106c51fd 100755 --- a/ci/setup-ios-build.sh +++ b/ci/setup-ios-build.sh @@ -7,4 +7,6 @@ brew install pkgconfig libssh2 ninja ln -s /Applications/Xcode.app/Contents/Developer/usr/lib/libLeaksAtExit.dylib /usr/local/lib +# The above is copied from setup-osx-build.sh + curl -s -L https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake -o ios.toolchain.cmake diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake index 2a3a91b8cd3..0e34b733059 100644 --- a/cmake/SelectRegex.cmake +++ b/cmake/SelectRegex.cmake @@ -5,7 +5,16 @@ if(REGEX_BACKEND STREQUAL "") check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L) if(HAVE_REGCOMP_L) - set(REGEX_BACKEND "regcomp_l") + if(CMAKE_SYSTEM_NAME MATCHES "iOS") + # 'regcomp_l' has been explicitly marked unavailable on iOS_SDK + # /usr/include/xlocale/_regex.h:34:5: + # int regcomp_l(regex_t * __restrict, const char * __restrict, int, + # locale_t __restrict) + # __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA); + set(REGEX_BACKEND "regcomp") + else() + set(REGEX_BACKEND "regcomp_l") + endif() elseif(PCRE_FOUND) set(REGEX_BACKEND "pcre") else() From 871208e9914b43b4e3257d9076fde90cc5388cf4 Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 5 Sep 2024 13:53:14 +0800 Subject: [PATCH 08/12] Fix iconv link issue --- cmake/FindIntlIconv.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/FindIntlIconv.cmake b/cmake/FindIntlIconv.cmake index 9e6ded99dc4..07959ca1a19 100644 --- a/cmake/FindIntlIconv.cmake +++ b/cmake/FindIntlIconv.cmake @@ -15,6 +15,12 @@ find_path(ICONV_INCLUDE_DIR iconv.h) check_function_exists(iconv_open libc_has_iconv) find_library(iconv_lib NAMES iconv libiconv libiconv-2 c) +# workaround the iOS issue where iconv is provided by libc +# We set it to false to force it add -liconv to the linker flags +if(CMAKE_SYSTEM_NAME MATCHES "iOS") + set(libc_has_iconv FALSE) +endif() + if(ICONV_INCLUDE_DIR AND libc_has_iconv) set(ICONV_FOUND TRUE) set(ICONV_LIBRARIES "") From 7fb1c8edcf1ed0de64c65aafa1c4f64ce4cadc3b Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 5 Sep 2024 14:03:30 +0800 Subject: [PATCH 09/12] Fix system API issue --- tests/clar/main.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/clar/main.c b/tests/clar/main.c index e3f4fe740bd..0a3ca354d3c 100644 --- a/tests/clar/main.c +++ b/tests/clar/main.c @@ -10,6 +10,15 @@ int __cdecl main(int argc, char *argv[]) #else int main(int argc, char *argv[]) #endif + +#if defined(__APPLE__) +#include +#else +#if !defined(TARGET_OS_IOS) +#define TARGET_OS_IOS 0 +#endif +#endif + { int res; char *at_exit_cmd; @@ -44,9 +53,13 @@ int main(int argc, char *argv[]) at_exit_cmd = getenv("CLAR_AT_EXIT"); if (at_exit_cmd != NULL) { + #if TARGET_OS_IOS + /* system is unavailable on iOS */ + return res; + #else int at_exit = system(at_exit_cmd); return res || at_exit; + #endif } - return res; } From b83d55c7550296060ca48d2e84395b6d8241c37c Mon Sep 17 00:00:00 2001 From: Kyle Date: Thu, 5 Sep 2024 23:31:34 +0800 Subject: [PATCH 10/12] Fix rt linker issue --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 51fc67757e2..2517df22fe9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -127,6 +127,13 @@ endif() # realtime support check_library_exists(rt clock_gettime "time.h" NEED_LIBRT) + +# workaround the iOS issue where clock_gettime is provided +# But we can't find rt library for some reason +if(CMAKE_SYSTEM_NAME MATCHES "iOS") + set(NEED_LIBRT FALSE) +endif() + if(NEED_LIBRT) list(APPEND LIBGIT2_SYSTEM_LIBS rt) list(APPEND LIBGIT2_PC_LIBS "-lrt") From 10c424ffc3c04d95e64810efb0791ae66571420e Mon Sep 17 00:00:00 2001 From: Kyle Date: Fri, 6 Sep 2024 00:41:00 +0800 Subject: [PATCH 11/12] Skip all test on iOS temporarily --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f6abfcdeadb..b42a5c992b6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -82,8 +82,10 @@ jobs: CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 CMAKE_GENERATOR: Ninja PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig - SKIP_SSH_TESTS: true - SKIP_NEGOTIATE_TESTS: true + # Skip all tests on iOS temporarily. + # 1. We need to update the path from libgit2_tests to libgit2_tests.app/libgit2_tests + # 2. We need to find a way to specify an iOS device / iOS simulator to run the tests. + SKIP_TESTS: true - name: "Windows (amd64, Visual Studio, Schannel)" id: windows-amd64-vs os: windows-2019 From 41f6f729104c770f59767d44efba60f1366ed571 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Thu, 26 Sep 2024 16:59:53 +0200 Subject: [PATCH 12/12] iOS Updates Some minor refactoring for iOS: - Roll back clar changes; these should be a bit more measured, and occur in clar upstream. - Move iOS to nightly builds --- .github/workflows/main.yml | 13 ------------- .github/workflows/nightly.yml | 10 ++++++++++ ci/setup-ios-benchmark.sh | 6 ------ ci/setup-ios-build.sh | 2 -- cmake/SelectRegex.cmake | 6 +----- src/CMakeLists.txt | 8 +------- tests/clar/main.c | 15 +-------------- 7 files changed, 13 insertions(+), 47 deletions(-) delete mode 100755 ci/setup-ios-benchmark.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b42a5c992b6..87e834f10db 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,19 +73,6 @@ jobs: PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig SKIP_SSH_TESTS: true SKIP_NEGOTIATE_TESTS: true - - name: "iOS" - id: ios - os: macos-12 - setup-script: ios - env: - CC: clang - CMAKE_OPTIONS: -DREGEX_BACKEND=regcomp -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 - CMAKE_GENERATOR: Ninja - PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig - # Skip all tests on iOS temporarily. - # 1. We need to update the path from libgit2_tests to libgit2_tests.app/libgit2_tests - # 2. We need to find a way to specify an iOS device / iOS simulator to run the tests. - SKIP_TESTS: true - name: "Windows (amd64, Visual Studio, Schannel)" id: windows-amd64-vs os: windows-2019 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 28a06189d98..f66febbfda6 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -74,6 +74,16 @@ jobs: PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig SKIP_SSH_TESTS: true SKIP_NEGOTIATE_TESTS: true + - name: "iOS" + id: ios + os: macos-12 + setup-script: ios + env: + CC: clang + CMAKE_OPTIONS: -DBUILD_TESTS=OFF -DDEPRECATE_HARD=ON -DUSE_LEAK_CHECKER=leaks -DUSE_GSSAPI=ON -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DCMAKE_SYSTEM_NAME=iOS -DPLATFORM=OS64 + CMAKE_GENERATOR: Ninja + PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig + SKIP_TESTS: true # Cannot exec iOS app on macOS - name: "Windows (amd64, Visual Studio, Schannel)" id: windows-amd64-vs os: windows-2019 diff --git a/ci/setup-ios-benchmark.sh b/ci/setup-ios-benchmark.sh deleted file mode 100755 index 80d87682b3e..00000000000 --- a/ci/setup-ios-benchmark.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -ex - -brew update -brew install hyperfine diff --git a/ci/setup-ios-build.sh b/ci/setup-ios-build.sh index 195106c51fd..94af4e486de 100755 --- a/ci/setup-ios-build.sh +++ b/ci/setup-ios-build.sh @@ -7,6 +7,4 @@ brew install pkgconfig libssh2 ninja ln -s /Applications/Xcode.app/Contents/Developer/usr/lib/libLeaksAtExit.dylib /usr/local/lib -# The above is copied from setup-osx-build.sh - curl -s -L https://raw.githubusercontent.com/leetal/ios-cmake/master/ios.toolchain.cmake -o ios.toolchain.cmake diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake index 0e34b733059..840ec7f349f 100644 --- a/cmake/SelectRegex.cmake +++ b/cmake/SelectRegex.cmake @@ -5,12 +5,8 @@ if(REGEX_BACKEND STREQUAL "") check_symbol_exists(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L) if(HAVE_REGCOMP_L) + # 'regcomp_l' has been explicitly marked unavailable on iOS_SDK if(CMAKE_SYSTEM_NAME MATCHES "iOS") - # 'regcomp_l' has been explicitly marked unavailable on iOS_SDK - # /usr/include/xlocale/_regex.h:34:5: - # int regcomp_l(regex_t * __restrict, const char * __restrict, int, - # locale_t __restrict) - # __OSX_AVAILABLE_STARTING(__MAC_10_8, __IPHONE_NA); set(REGEX_BACKEND "regcomp") else() set(REGEX_BACKEND "regcomp_l") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2517df22fe9..73c46e21043 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -128,13 +128,7 @@ endif() check_library_exists(rt clock_gettime "time.h" NEED_LIBRT) -# workaround the iOS issue where clock_gettime is provided -# But we can't find rt library for some reason -if(CMAKE_SYSTEM_NAME MATCHES "iOS") - set(NEED_LIBRT FALSE) -endif() - -if(NEED_LIBRT) +if(NEED_LIBRT AND NOT CMAKE_SYSTEM_NAME MATCHES "iOS") list(APPEND LIBGIT2_SYSTEM_LIBS rt) list(APPEND LIBGIT2_PC_LIBS "-lrt") endif() diff --git a/tests/clar/main.c b/tests/clar/main.c index 0a3ca354d3c..e3f4fe740bd 100644 --- a/tests/clar/main.c +++ b/tests/clar/main.c @@ -10,15 +10,6 @@ int __cdecl main(int argc, char *argv[]) #else int main(int argc, char *argv[]) #endif - -#if defined(__APPLE__) -#include -#else -#if !defined(TARGET_OS_IOS) -#define TARGET_OS_IOS 0 -#endif -#endif - { int res; char *at_exit_cmd; @@ -53,13 +44,9 @@ int main(int argc, char *argv[]) at_exit_cmd = getenv("CLAR_AT_EXIT"); if (at_exit_cmd != NULL) { - #if TARGET_OS_IOS - /* system is unavailable on iOS */ - return res; - #else int at_exit = system(at_exit_cmd); return res || at_exit; - #endif } + return res; }