diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8edc16923..900047cab 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -212,6 +212,7 @@ include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/AVFoundation/include ${CMAKE_CURRENT_SOURCE_DIR}/CoreAudio/include ${CMAKE_CURRENT_SOURCE_DIR}/CoreMedia/include + ${CMAKE_CURRENT_SOURCE_DIR}/JavaVM/include ) add_subdirectory(external/libkqueue) @@ -394,6 +395,7 @@ add_subdirectory(CoreMedia) # Just a stub add_subdirectory(WebKit) add_subdirectory(OpenGL) +add_subdirectory(JavaVM) # /Applications #add_subdirectory(external/TextEdit) diff --git a/src/JavaVM/CMakeLists.txt b/src/JavaVM/CMakeLists.txt new file mode 100644 index 000000000..fd4287e24 --- /dev/null +++ b/src/JavaVM/CMakeLists.txt @@ -0,0 +1,20 @@ +project(JavaVM) + +set(DYLIB_COMPAT_VERSION "1.0.0") +set(DYLIB_CURRENT_VERSION "1.0.0") + +add_framework(JavaVM + FAT + CURRENT_VERSION + VERSION "A" + + SOURCES + src/JavaVM.m + src/NSJavaVirtualMachine.m + src/NSJavaConfiguration.m + + DEPENDENCIES + system + objc + Foundation +) diff --git a/src/JavaVM/include/JavaVM/JavaVM.h b/src/JavaVM/include/JavaVM/JavaVM.h new file mode 100644 index 000000000..82b6315ca --- /dev/null +++ b/src/JavaVM/include/JavaVM/JavaVM.h @@ -0,0 +1,59 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 . +*/ + + +#ifndef _JavaVM_H_ +#define _JavaVM_H_ + +#import + +#import +#import + +void* CheckForInstalledJavaRuntimes(void); +void* JAWT_GetAWT(void); +void* JNI_CreateJavaVM(void); +void* JNI_GetCreatedJavaVMs(void); +void* JNI_GetDefaultJavaVMInitArgs(void); +void* JVMCopyDefaultPrefForTaskAndKey(void); +void* JVMCopyUserPrefForTaskAndKey(void); +void* JVMCreateCompleteJVMListForTask(void); +void* JVMCreateJVMListForTask(void); +void* JVMCreateJVMListForTaskVersionAndArch(void); +void* JVMCreateJVMListForTaskVersionAndArchs(void); +void* JVMCreateJVMListOfCurrentArchitectureForTask(void); +void* JVMCreateLatestJVMInfo(void); +void* JVMSaveUserPrefForTaskAndKey(void); +void* JVMSetPreferredOrderForTask(void); +void* _NSJVMAddressOfFunctionInLibrary(void); +void* _NSJVMAddressOfFunctionInLibraryNamed(void); +void* _NSJVMInitializeObjCRuntimeInLibraryNamed(void); +void* _NSJVMJNI_CreateJavaVM(void); +void* _NSJVMJNI_GetCreatedJavaVMs(void); +void* _NSJVMJNI_GetDefaultJavaVMInitArgs(void); +void* _NSJVMJavaVMLibraryName(void); +void* _NSJVMLoadLibrary(void); +void* _NSJVM_IHashCodeFunction(void); +void* _NSJVM_IsJVMLoaded(void); +void* _NSLoadJavaVirtualMachine(void); +void* scheduleUpdateSharing(void); +void* scheduleUpdateSharingUninstalled(void); +void* updateSharing(void); + +#endif diff --git a/src/JavaVM/include/JavaVM/NSJavaConfiguration.h b/src/JavaVM/include/JavaVM/NSJavaConfiguration.h new file mode 100644 index 000000000..ad2ea5e0b --- /dev/null +++ b/src/JavaVM/include/JavaVM/NSJavaConfiguration.h @@ -0,0 +1,24 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 + +@interface NSJavaConfiguration : NSObject + +@end diff --git a/src/JavaVM/include/JavaVM/NSJavaVirtualMachine.h b/src/JavaVM/include/JavaVM/NSJavaVirtualMachine.h new file mode 100644 index 000000000..ad29d142c --- /dev/null +++ b/src/JavaVM/include/JavaVM/NSJavaVirtualMachine.h @@ -0,0 +1,24 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 + +@interface NSJavaVirtualMachine : NSObject + +@end diff --git a/src/JavaVM/src/JavaVM.m b/src/JavaVM/src/JavaVM.m new file mode 100644 index 000000000..cea1ed73f --- /dev/null +++ b/src/JavaVM/src/JavaVM.m @@ -0,0 +1,175 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 + +static int verbose = 0; + +__attribute__((constructor)) +static void initme(void) { + verbose = getenv("STUB_VERBOSE") != NULL; +} + +void* CheckForInstalledJavaRuntimes(void) { + if (verbose) puts("STUB: CheckForInstalledJavaRuntimes called"); + return NULL; +} + +void* JAWT_GetAWT(void) { + if (verbose) puts("STUB: JAWT_GetAWT called"); + return NULL; +} + +void* JNI_CreateJavaVM(void) { + if (verbose) puts("STUB: JNI_CreateJavaVM called"); + return NULL; +} + +void* JNI_GetCreatedJavaVMs(void) { + if (verbose) puts("STUB: JNI_GetCreatedJavaVMs called"); + return NULL; +} + +void* JNI_GetDefaultJavaVMInitArgs(void) { + if (verbose) puts("STUB: JNI_GetDefaultJavaVMInitArgs called"); + return NULL; +} + +void* JVMCopyDefaultPrefForTaskAndKey(void) { + if (verbose) puts("STUB: JVMCopyDefaultPrefForTaskAndKey called"); + return NULL; +} + +void* JVMCopyUserPrefForTaskAndKey(void) { + if (verbose) puts("STUB: JVMCopyUserPrefForTaskAndKey called"); + return NULL; +} + +void* JVMCreateCompleteJVMListForTask(void) { + if (verbose) puts("STUB: JVMCreateCompleteJVMListForTask called"); + return NULL; +} + +void* JVMCreateJVMListForTask(void) { + if (verbose) puts("STUB: JVMCreateJVMListForTask called"); + return NULL; +} + +void* JVMCreateJVMListForTaskVersionAndArch(void) { + if (verbose) puts("STUB: JVMCreateJVMListForTaskVersionAndArch called"); + return NULL; +} + +void* JVMCreateJVMListForTaskVersionAndArchs(void) { + if (verbose) puts("STUB: JVMCreateJVMListForTaskVersionAndArchs called"); + return NULL; +} + +void* JVMCreateJVMListOfCurrentArchitectureForTask(void) { + if (verbose) puts("STUB: JVMCreateJVMListOfCurrentArchitectureForTask called"); + return NULL; +} + +void* JVMCreateLatestJVMInfo(void) { + if (verbose) puts("STUB: JVMCreateLatestJVMInfo called"); + return NULL; +} + +void* JVMSaveUserPrefForTaskAndKey(void) { + if (verbose) puts("STUB: JVMSaveUserPrefForTaskAndKey called"); + return NULL; +} + +void* JVMSetPreferredOrderForTask(void) { + if (verbose) puts("STUB: JVMSetPreferredOrderForTask called"); + return NULL; +} + +void* _NSJVMAddressOfFunctionInLibrary(void) { + if (verbose) puts("STUB: _NSJVMAddressOfFunctionInLibrary called"); + return NULL; +} + +void* _NSJVMAddressOfFunctionInLibraryNamed(void) { + if (verbose) puts("STUB: _NSJVMAddressOfFunctionInLibraryNamed called"); + return NULL; +} + +void* _NSJVMInitializeObjCRuntimeInLibraryNamed(void) { + if (verbose) puts("STUB: _NSJVMInitializeObjCRuntimeInLibraryNamed called"); + return NULL; +} + +void* _NSJVMJNI_CreateJavaVM(void) { + if (verbose) puts("STUB: _NSJVMJNI_CreateJavaVM called"); + return NULL; +} + +void* _NSJVMJNI_GetCreatedJavaVMs(void) { + if (verbose) puts("STUB: _NSJVMJNI_GetCreatedJavaVMs called"); + return NULL; +} + +void* _NSJVMJNI_GetDefaultJavaVMInitArgs(void) { + if (verbose) puts("STUB: _NSJVMJNI_GetDefaultJavaVMInitArgs called"); + return NULL; +} + +void* _NSJVMJavaVMLibraryName(void) { + if (verbose) puts("STUB: _NSJVMJavaVMLibraryName called"); + return NULL; +} + +void* _NSJVMLoadLibrary(void) { + if (verbose) puts("STUB: _NSJVMLoadLibrary called"); + return NULL; +} + +void* _NSJVM_IHashCodeFunction(void) { + if (verbose) puts("STUB: _NSJVM_IHashCodeFunction called"); + return NULL; +} + +void* _NSJVM_IsJVMLoaded(void) { + if (verbose) puts("STUB: _NSJVM_IsJVMLoaded called"); + return NULL; +} + +void* _NSLoadJavaVirtualMachine(void) { + if (verbose) puts("STUB: _NSLoadJavaVirtualMachine called"); + return NULL; +} + +void* scheduleUpdateSharing(void) { + if (verbose) puts("STUB: scheduleUpdateSharing called"); + return NULL; +} + +void* scheduleUpdateSharingUninstalled(void) { + if (verbose) puts("STUB: scheduleUpdateSharingUninstalled called"); + return NULL; +} + +void* updateSharing(void) { + if (verbose) puts("STUB: updateSharing called"); + return NULL; +} diff --git a/src/JavaVM/src/NSJavaConfiguration.m b/src/JavaVM/src/NSJavaConfiguration.m new file mode 100644 index 000000000..f95e97cf9 --- /dev/null +++ b/src/JavaVM/src/NSJavaConfiguration.m @@ -0,0 +1,32 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 . +*/ + +#import + +@implementation NSJavaConfiguration + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { + return [NSMethodSignature signatureWithObjCTypes: "v@:"]; +} + +- (void)forwardInvocation:(NSInvocation *)anInvocation { + NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]); +} + +@end diff --git a/src/JavaVM/src/NSJavaVirtualMachine.m b/src/JavaVM/src/NSJavaVirtualMachine.m new file mode 100644 index 000000000..7f4a2e39c --- /dev/null +++ b/src/JavaVM/src/NSJavaVirtualMachine.m @@ -0,0 +1,32 @@ +/* + This file is part of Darling. + + Copyright (C) 2017 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 . +*/ + +#import + +@implementation NSJavaVirtualMachine + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector { + return [NSMethodSignature signatureWithObjCTypes: "v@:"]; +} + +- (void)forwardInvocation:(NSInvocation *)anInvocation { + NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]); +} + +@end