Skip to content

Commit

Permalink
fix for compile-test
Browse files Browse the repository at this point in the history
  • Loading branch information
roothider committed Jun 2, 2024
1 parent 966a194 commit 1644589
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/compile-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ jobs:
uses: actions/checkout@v4
with:
repository: theos/sdks
ref: bb425abf3acae8eac328b828628b82df544d2774 # pinned, should be updated as appropriate
sparse-checkout: iPhoneOS14.5.sdk
ref: master #bb425abf3acae8eac328b828628b82df544d2774 # pinned, should be updated as appropriate
sparse-checkout: iPhoneOS15.6.sdk
path: sdks

- name: Checkout theos/lib
- name: Checkout roothide/lib
uses: actions/checkout@v4
with:
repository: theos/lib
repository: roothide/lib
ref: master # always check out latest
path: lib

- name: Checkout theos/headers
- name: Checkout roothide/headers
uses: actions/checkout@v4
with:
path: headers
Expand Down Expand Up @@ -68,8 +68,8 @@ jobs:
{
echo "#import <${HEADER}>"
echo "int main() {}"
} | clang -I "${HEADER_DIR}" -F "lib" -isysroot sdks/iPhoneOS14.5.sdk \
-target arm64-apple-ios14.5 -arch arm64 \
} | clang -I "${HEADER_DIR}" -F "lib" -isysroot sdks/iPhoneOS15.6.sdk \
-target arm64-apple-ios15.6 -arch arm64 \
-x "${{ matrix.language }}" ${{ matrix.cflags }} \
${ADDITIONAL_FLAGS} -fsyntax-only -
done
28 changes: 13 additions & 15 deletions roothide/stub.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#ifndef ROOTHIDE_H
#define ROOTHIDE_H

#if defined(THEOS_PACKAGE_SCHEME_ROOTFUL)
#define __ROOT_PATH_VAR(x) x
#define __ROOT_PATH_NS_VAR(x) x
#pragma message("building for rootful, fall back to stub functions")
#elif defined(THEOS_PACKAGE_SCHEME_ROOTLESS)
#include <rootless.h>
#define __ROOT_PATH_VAR(x) ROOT_PATH_VAR(x)
#define __ROOT_PATH_NS_VAR(x) ROOT_PATH_NS_VAR(x)
#pragma message("building for rootless, fall back to rooless.h")
#ifdef THEOS_PACKAGE_SCHEME_ROOTHIDE
#define __C_STRING_PATH_FALLBACK(x) x
#define __NS_STRING_PATH_FALLBACK(x) x
// #pragma message("building for roothide")
#else
#pragma error("unknown package scheme")
#include <rootless.h>
#define __C_STRING_PATH_FALLBACK(x) ROOT_PATH_VAR(x)
#define __NS_STRING_PATH_FALLBACK(x) ROOT_PATH_NS_VAR(x)
// #pragma message("fall back to rootless.h")
#endif

#pragma GCC diagnostic push
Expand All @@ -35,15 +33,15 @@ extern "C" {
#endif

static const char* rootfs_alloc(const char* path) { return path ? strdup(path) : path; }
static const char* jbroot_alloc(const char* path) { return path ? strdup(__ROOT_PATH_VAR(path)) : path; }
static const char* jbrootat_alloc(int fd, const char* path) { return path ? strdup(__ROOT_PATH_VAR(path)) : path; }
static const char* jbroot_alloc(const char* path) { return path ? strdup(__C_STRING_PATH_FALLBACK(path)) : path; }
static const char* jbrootat_alloc(int fd, const char* path) { return path ? strdup(__C_STRING_PATH_FALLBACK(path)) : path; }

static unsigned long long jbrand() { return 0; }
static const char* jbroot(const char* path) { return __ROOT_PATH_VAR(path); }
static const char* jbroot(const char* path) { return __C_STRING_PATH_FALLBACK(path); }
static const char* rootfs(const char* path) { return path; }

#ifdef __OBJC__
static NSString* _Nonnull __attribute__((overloadable)) jbroot(NSString* _Nonnull path) { return __ROOT_PATH_NS_VAR(path); }
static NSString* _Nonnull __attribute__((overloadable)) jbroot(NSString* _Nonnull path) { return __NS_STRING_PATH_FALLBACK(path); }
static NSString* _Nonnull __attribute__((overloadable)) rootfs(NSString* _Nonnull path) { return path; }
#endif

Expand All @@ -52,7 +50,7 @@ static NSString* _Nonnull __attribute__((overloadable)) rootfs(NSString* _Nonnul
#endif

#ifdef __cplusplus
static std::string jbroot(std::string path) { return std::string(__ROOT_PATH_VAR(path.c_str())); }
static std::string jbroot(std::string path) { return std::string(__C_STRING_PATH_FALLBACK(path.c_str())); }
static std::string rootfs(std::string path) { return path; }
#endif

Expand Down

0 comments on commit 1644589

Please sign in to comment.