diff --git a/cmake/darling_framework.cmake b/cmake/darling_framework.cmake index 452a7f484..3d08a188a 100644 --- a/cmake/darling_framework.cmake +++ b/cmake/darling_framework.cmake @@ -2,8 +2,12 @@ include(CMakeParseArguments) include(darling_lib) include(InstallSymlink) +define_property(TARGET PROPERTY DYLIB_INSTALL_NAME BRIEF_DOCS "Stores the DYLIB_INSTALL_NAME of the framework's main binary" + FULL_DOCS "Used to make reexporting child frameworks less painful.") + function(add_framework name) - cmake_parse_arguments(FRAMEWORK "CURRENT_VERSION;FAT;PRIVATE" "VERSION;LINK_FLAGS" "SOURCES;DEPENDENCIES;CIRCULAR_DEPENDENCIES;RESOURCES" ${ARGN}) + cmake_parse_arguments(FRAMEWORK "CURRENT_VERSION;FAT;PRIVATE" "VERSION;LINK_FLAGS;PARENT;PARENT_VERSION" + "SOURCES;DEPENDENCIES;CIRCULAR_DEPENDENCIES;RESOURCES" ${ARGN}) if (FRAMEWORK_CURRENT_VERSION) set(my_name "${name}") else (FRAMEWORK_CURRENT_VERSION) @@ -15,10 +19,19 @@ function(add_framework name) else (FRAMEWORK_PRIVATE) set(dir_name "Frameworks") endif (FRAMEWORK_PRIVATE) + + if(DEFINED FRAMEWORK_PARENT) + if(NOT DEFINED FRAMEWORK_PARENT_VERSION) + # 99% of the time it's version A + set(FRAMEWORK_PARENT_VERSION "A") + endif(NOT DEFINED FRAMEWORK_PARENT_VERSION) + InstallSymlink(Versions/Current/Frameworks + "${CMAKE_INSTALL_PREFIX}/libexec/darling/System/Library/${dir_name}/${FRAMEWORK_PARENT}.framework/Frameworks") + set(dir_name "${dir_name}/${FRAMEWORK_PARENT}.framework/Versions/${FRAMEWORK_PARENT_VERSION}/Frameworks") + endif(DEFINED FRAMEWORK_PARENT) set(DYLIB_INSTALL_NAME "/System/Library/${dir_name}/${name}.framework/Versions/${FRAMEWORK_VERSION}/${name}") - if (FRAMEWORK_CIRCULAR_DEPENDENCIES) if (FRAMEWORK_FAT) set (FRAMEWORK_FAT_ARG FAT) @@ -38,7 +51,8 @@ function(add_framework name) endif (FRAMEWORK_FAT) endif (FRAMEWORK_CIRCULAR_DEPENDENCIES) - + + set_property(TARGET ${my_name} PROPERTY DYLIB_INSTALL_NAME ${DYLIB_INSTALL_NAME}) if (FRAMEWORK_CURRENT_VERSION) add_library("${name}_${FRAMEWORK_VERSION}" ALIAS "${name}") diff --git a/cmake/use_ld64.cmake b/cmake/use_ld64.cmake index 3eeedeb53..925e430b1 100644 --- a/cmake/use_ld64.cmake +++ b/cmake/use_ld64.cmake @@ -1,4 +1,7 @@ +set(dylib_paths "") FUNCTION(use_ld64 target) + get_property(ld_dylib_paths GLOBAL PROPERTY ld_dylib_paths) + message("dylib path is ${ld_dylib_paths}") set_property(TARGET ${target} APPEND_STRING PROPERTY LINK_FLAGS " -B ${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/ld64/src/ \ -B ${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc/ \ @@ -58,9 +61,19 @@ FUNCTION(use_ld64 target) -Wl,-dylib_file,/usr/lib/native/libGL.dylib:${CMAKE_BINARY_DIR}/src/native/libGL.dylib \ -Wl,-dylib_file,/System/Library/Frameworks/CoreImage.framework/Versions/A/CoreImage:${CMAKE_BINARY_DIR}/src/CoreImage/CoreImage \ -Wl,-dylib_file,/System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo:${CMAKE_BINARY_DIR}/src/CoreVideo/CoreVideo \ -") +${ld_dylib_paths}") add_dependencies(${target} x86_64-apple-darwin11-ld) ENDFUNCTION(use_ld64) +function(reexport reexporter reexportee) + get_property(reexportee_binary_dir TARGET ${reexportee} PROPERTY BINARY_DIR) + get_property(reexportee_output_name TARGET ${reexportee} PROPERTY OUTPUT_NAME) + set(reexportee_output "${reexportee_binary_dir}/${reexportee_output_name}") + get_property(reexportee_install_name TARGET ${reexportee} PROPERTY DYLIB_INSTALL_NAME) + set_property(TARGET ${reexporter} APPEND_STRING PROPERTY + LINK_FLAGS " -Wl,-reexport_library,${reexportee_output} ") + set_property(GLOBAL APPEND_STRING PROPERTY ld_dylib_paths " -Wl,-dylib_file,${reexportee_install_name}:${reexportee_output} ") + add_dependencies(${reexporter} ${reexportee}) +endfunction(reexport) diff --git a/src/CoreServices/CMakeLists.txt b/src/CoreServices/CMakeLists.txt index 368783e16..edf82f9fd 100644 --- a/src/CoreServices/CMakeLists.txt +++ b/src/CoreServices/CMakeLists.txt @@ -46,9 +46,6 @@ set(CoreServices_SRCS LSApplicationProxy.m LSApplicationWorkspace.m constants.m - - src/FSEvents.c - src/LaunchServices.c ) if (WITH_COREAUDIO) @@ -56,7 +53,35 @@ if (WITH_COREAUDIO) endif (WITH_COREAUDIO) set(DYLIB_COMPAT_VERSION "1.0.0") -set(DYLIB_CURRENT_VERSION "1.0.0") +set(DYLIB_CURRENT_VERSION "1239.200.12") +add_framework(FSEvents + FAT + CURRENT_VERSION + VERSION "A" + PARENT "CoreServices" + SOURCES + src/FSEvents/FSEvents.c + DEPENDENCIES + CoreFoundation + system +) + +set(DYLIB_COMPAT_VERSION "1.0.0") +set(DYLIB_CURRENT_VERSION "945.0.0") +add_framework(LaunchServices + FAT + CURRENT_VERSION + VERSION "A" + PARENT "CoreServices" + SOURCES + src/LaunchServices/LaunchServices.c + DEPENDENCIES + CoreFoundation + system +) + +set(DYLIB_COMPAT_VERSION "1.0.0") +set(DYLIB_CURRENT_VERSION "945.0.0") add_framework(CoreServices FAT CURRENT_VERSION @@ -64,6 +89,8 @@ add_framework(CoreServices SOURCES ${CoreServices_SRCS} DEPENDENCIES + FSEvents + LaunchServices icucore system CoreFoundation @@ -73,5 +100,8 @@ add_framework(CoreServices ${EXTRA_LIBS} ) +reexport(CoreServices FSEvents) +reexport(CoreServices LaunchServices) + install(FILES SystemVersion.plist DESTINATION "libexec/darling/System/Library/CoreServices") diff --git a/src/CoreServices/src/FSEvents.c b/src/CoreServices/src/FSEvents/FSEvents.c similarity index 100% rename from src/CoreServices/src/FSEvents.c rename to src/CoreServices/src/FSEvents/FSEvents.c diff --git a/src/CoreServices/src/LaunchServices.c b/src/CoreServices/src/LaunchServices/LaunchServices.c similarity index 100% rename from src/CoreServices/src/LaunchServices.c rename to src/CoreServices/src/LaunchServices/LaunchServices.c