From 8779a26894fec6aba2f95fe629a0237ffef5889d Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Sat, 23 Mar 2019 00:00:45 -0400 Subject: [PATCH] Fixes for xcodebuild --- src/CoreServices/CMakeLists.txt | 1 + src/CoreServices/LaunchServices.cpp | 7 +++ src/CoreServices/include/FSEvents/FSEvents.h | 57 ++++++++++++++++++++ src/CoreServices/src/FSEvents.c | 53 ++++++++++++++++++ src/external/foundation | 2 +- src/libc/darwin/CMakeLists.txt | 1 + src/libc/darwin/darling_hacks.c | 11 ++++ 7 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 src/CoreServices/include/FSEvents/FSEvents.h create mode 100644 src/CoreServices/src/FSEvents.c create mode 100644 src/libc/darwin/darling_hacks.c diff --git a/src/CoreServices/CMakeLists.txt b/src/CoreServices/CMakeLists.txt index 4ddd75ab2..06cd70cee 100644 --- a/src/CoreServices/CMakeLists.txt +++ b/src/CoreServices/CMakeLists.txt @@ -46,6 +46,7 @@ set(CoreServices_SRCS LSApplicationProxy.m LSApplicationWorkspace.m constants.m + src/FSEvents.c ) if (WITH_COREAUDIO) diff --git a/src/CoreServices/LaunchServices.cpp b/src/CoreServices/LaunchServices.cpp index 5d47cf3a4..8b722cf67 100644 --- a/src/CoreServices/LaunchServices.cpp +++ b/src/CoreServices/LaunchServices.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "UniChar.h" @@ -111,6 +112,12 @@ int execvpe(const char* name, char** argv, char** envp) return ret; } +OSStatus LSRegisterURL(CFURLRef inURL, Boolean inUpdate) +{ + printf("STUB: LSRegisterURL"); + return 0; +} + OSStatus LSOpenApplication(const LSApplicationParameters *appParams, ProcessSerialNumber *outPSN) { if (!appParams) diff --git a/src/CoreServices/include/FSEvents/FSEvents.h b/src/CoreServices/include/FSEvents/FSEvents.h new file mode 100644 index 000000000..8136e172e --- /dev/null +++ b/src/CoreServices/include/FSEvents/FSEvents.h @@ -0,0 +1,57 @@ +/* + This file is part of Darling. + + Copyright (C) 2019 Lubos Dolezel + + Darling is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Darling is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Darling. If not, see . +*/ + +#include +#include +#include + +typedef struct __FSEventStream* FSEventStreamRef; +typedef const struct __FSEventStream* ConstFSEventStreamRef; + +typedef UInt32 FSEventStreamCreateFlags; +typedef UInt64 FSEventStreamEventId; +typedef UInt32 FSEventStreamEventFlags; + +typedef CALLBACK_API_C(void, FSEventStreamCallback)( + ConstFSEventStreamRef streamRef, + void *clientCallBackInfo, + size_t numEvents, + void *eventPaths, + const FSEventStreamEventFlags *eventFlags, + const FSEventStreamEventId *eventIds); + +struct FSEventStreamContext { + CFIndex version; + void *info; + CFAllocatorRetainCallBack retain; + CFAllocatorReleaseCallBack release; + CFAllocatorCopyDescriptionCallBack copyDesc; +}; +typedef struct FSEventStreamContext FSEventStreamContext; + +extern FSEventStreamRef FSEventStreamCreate( + CFAllocatorRef allocator, + FSEventStreamCallback callback, + FSEventStreamContext *context, + CFArrayRef pathsToWatch, + FSEventStreamEventId sinceWhen, + CFTimeInterval latency, + FSEventStreamCreateFlags flags); + +extern CF_RETURNS_RETAINED CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef); diff --git a/src/CoreServices/src/FSEvents.c b/src/CoreServices/src/FSEvents.c new file mode 100644 index 000000000..993ce2c74 --- /dev/null +++ b/src/CoreServices/src/FSEvents.c @@ -0,0 +1,53 @@ +/* + This file is part of Darling. + + Copyright (C) 2019 Lubos Dolezel + + Darling is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Darling is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Darling. If not, see . +*/ + +#include +#include +#include + +struct __FSEventStream { + CFAllocatorRef allocator; + CFArrayRef pathsToWatch; +}; + +FSEventStreamRef FSEventStreamCreate( + CFAllocatorRef allocator, + FSEventStreamCallback callback, + FSEventStreamContext *context, + CFArrayRef pathsToWatch, + FSEventStreamEventId sinceWhen, + CFTimeInterval latency, + FSEventStreamCreateFlags flags) +{ + FSEventStreamRef stream = NULL; + printf("STUB %s\n", __PRETTY_FUNCTION__); + stream = CFAllocatorAllocate(allocator, sizeof(struct __FSEventStream), 0); + stream->allocator = allocator; + stream->pathsToWatch = pathsToWatch; + return stream; +} + +CFArrayRef FSEventStreamCopyPathsBeingWatched(ConstFSEventStreamRef streamRef) +{ + CFArrayRef copy; + printf("STUB %s\n", __PRETTY_FUNCTION__); + copy = CFArrayCreateCopy(streamRef->allocator, streamRef->pathsToWatch); + copy = CFRetain(copy); + return copy; +} diff --git a/src/external/foundation b/src/external/foundation index 00fc1ce19..ff0c404aa 160000 --- a/src/external/foundation +++ b/src/external/foundation @@ -1 +1 @@ -Subproject commit 00fc1ce19539d38517eaca988d30caba52f1a812 +Subproject commit ff0c404aa7d908eb5007a6e0785d1a25060e461e diff --git a/src/libc/darwin/CMakeLists.txt b/src/libc/darwin/CMakeLists.txt index 3676c284d..ec3de591e 100644 --- a/src/libc/darwin/CMakeLists.txt +++ b/src/libc/darwin/CMakeLists.txt @@ -9,6 +9,7 @@ set(darwin_sources init_cpu_capabilities.c kvm.c variant.c + darling_hacks.c ) add_library(libc-darwin OBJECT ${darwin_sources}) diff --git a/src/libc/darwin/darling_hacks.c b/src/libc/darwin/darling_hacks.c new file mode 100644 index 000000000..7da5dcd11 --- /dev/null +++ b/src/libc/darwin/darling_hacks.c @@ -0,0 +1,11 @@ +#include +#include + +void syslog$DARWIN_EXTSN(int priority, const char *arg1, ...) +{ + const char *format; + va_list args; + va_start(args, arg1); + vsyslog(priority, arg1, args); + va_end(args); +} -- 2.51.2