This builds an executable for ios.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4511 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-10-12 00:29:17 +00:00
parent 7169f4a6cb
commit 1c621a602f
4 changed files with 97 additions and 6 deletions

View File

@ -8,6 +8,13 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
extern BOOLEAN NTAPI SystemFunction036(PVOID Buffer, ULONG BufferLength);
#elif __APPLE__
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#include <CommonCrypto/CommonRandom.h>
#else
#include <sys/random.h>
#endif
#else
#include <sys/random.h>
#endif
@ -44,7 +51,9 @@ JSValue _crypt_gensalt(JSContext* context, JSValueConst this_val, int argc, JSVa
char buffer[16];
#if defined(_WIN32)
ssize_t bytes = SystemFunction036(buffer, sizeof(buffer)) ? sizeof(buffer) : 0;
#elif defined(__APPLE__)
#elif defined(__APPLE__) && TARGET_OS_IPHONE
ssize_t bytes = CCRandomGenerateBytes(buffer, sizeof(buffer)) == kCCSuccess ? sizeof(buffer) : 0;
#elif defined(__APPLE__) && !TARGET_OS_IPHONE
ssize_t bytes = 0;
if (getentropy(buffer, sizeof(buffer)) == 0)
{

View File

@ -16,6 +16,11 @@
#define WEXITSTATUS(x) (x)
#endif
#if defined(__APPLE__)
#include <TargetConditionals.h>
#endif
#if !TARGET_OS_IPHONE
static void _test_nop(const tf_test_options_t* options)
{
FILE* file = fopen("out/test.js", "w");
@ -692,9 +697,11 @@ static void _tf_test_run(const tf_test_options_t* options, const char* name, voi
#undef RESET
}
}
#endif
void tf_tests(const tf_test_options_t* options)
{
#if !TARGET_OS_IPHONE
_tf_test_run(options, "ssb", tf_ssb_test_ssb, false);
_tf_test_run(options, "ssb_id", tf_ssb_test_id_conversion, false);
_tf_test_run(options, "ssb_following", tf_ssb_test_following, false);
@ -719,4 +726,5 @@ void tf_tests(const tf_test_options_t* options)
_tf_test_run(options, "bench", tf_ssb_test_bench, false);
_tf_test_run(options, "go-ssb-room", tf_ssb_test_go_ssb_room, true);
tf_printf("Tests completed.\n");
#endif
}