From fb867cbd79b6cb9660e84c32ec9d65ca0cc30969 Mon Sep 17 00:00:00 2001 From: Andrew Hyatt Date: Thu, 10 Aug 2017 23:38:09 -0700 Subject: [PATCH] Use previous linking method for CF Also create PlistBuddy executable --- cmake/darling_framework.cmake | 2 +- src/AppleSystemInfo/CMakeLists.txt | 2 +- src/CMakeLists.txt | 10 +- src/CoreServices/CMakeLists.txt | 2 +- src/CryptoTokenKit/CMakeLists.txt | 2 +- src/DiskArbitration/CMakeLists.txt | 2 +- src/PlistBuddy/CMakeLists.txt | 11 ++ src/PlistBuddy/PlistBuddy.8 | 152 +++++++++++++++++++++++++ src/PlistBuddy/PlistBuddy.c | 7 ++ src/SystemConfiguration/CMakeLists.txt | 2 +- src/external/IOKitUser | 2 +- src/external/cocotron | 2 +- src/external/corefoundation | 2 +- src/external/gdb | 2 +- src/external/installer | 2 +- src/external/python | 2 +- src/external/system_cmds | 2 +- src/external/vim | 2 +- src/launchd/support/CMakeLists.txt | 2 +- src/tools/CMakeLists.txt | 2 +- src/xcselect/CMakeLists.txt | 2 +- 21 files changed, 195 insertions(+), 19 deletions(-) create mode 100644 src/PlistBuddy/CMakeLists.txt create mode 100644 src/PlistBuddy/PlistBuddy.8 create mode 100644 src/PlistBuddy/PlistBuddy.c diff --git a/cmake/darling_framework.cmake b/cmake/darling_framework.cmake index 8640ab770..656f2c99d 100644 --- a/cmake/darling_framework.cmake +++ b/cmake/darling_framework.cmake @@ -117,7 +117,7 @@ function(add_separated_framework name) set_property(TARGET ${my_name}_x86_64 APPEND_STRING PROPERTY LINK_FLAGS " ${FRAMEWORK_LINK_FLAGS}") endif (FRAMEWORK_LINK_FLAGS) - add_custom_target(${my_name} + add_custom_target(${my_name}_build COMMAND ${CMAKE_BINARY_DIR}/src/external/cctools-port/cctools/misc/lipo -arch i386 $ -arch x86_64 $ diff --git a/src/AppleSystemInfo/CMakeLists.txt b/src/AppleSystemInfo/CMakeLists.txt index c5cf4fe90..1fa189c4b 100644 --- a/src/AppleSystemInfo/CMakeLists.txt +++ b/src/AppleSystemInfo/CMakeLists.txt @@ -18,5 +18,5 @@ add_framework(AppleSystemInfo src/functions.c DEPENDENCIES system - ${CoreFoundation} + CoreFoundation ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23315754f..e9581f3ef 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -153,11 +153,16 @@ include_directories(AFTER ${CMAKE_CURRENT_SOURCE_DIR}/lkm/include ) -set(CoreFoundation "${CMAKE_BINARY_DIR}/src/external/corefoundation/CoreFoundation") +# It must be done in this scope +add_library(CoreFoundation SHARED IMPORTED) +set_property(TARGET CoreFoundation PROPERTY + IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/external/corefoundation/CoreFoundation +) +add_dependencies(CoreFoundation CoreFoundation_build) +set_target_properties(CoreFoundation PROPERTIES SUFFIX "" PREFIX "") add_subdirectory(external/libkqueue) - add_subdirectory(external/libplatform) add_subdirectory(external/libpthread) add_subdirectory(kernel) @@ -289,6 +294,7 @@ add_subdirectory(DebugSymbols) add_subdirectory(external/bsm) add_subdirectory(external/gdb) add_subdirectory(external/Heimdal) +add_subdirectory(PlistBuddy) # /Applications #add_subdirectory(external/TextEdit) diff --git a/src/CoreServices/CMakeLists.txt b/src/CoreServices/CMakeLists.txt index 36f809b7c..b25510331 100644 --- a/src/CoreServices/CMakeLists.txt +++ b/src/CoreServices/CMakeLists.txt @@ -59,7 +59,7 @@ add_framework(CoreServices DEPENDENCIES icucore system - ${CoreFoundation} + CoreFoundation cxx iconv ${EXTRA_LIBS} diff --git a/src/CryptoTokenKit/CMakeLists.txt b/src/CryptoTokenKit/CMakeLists.txt index e06061801..74b272bde 100644 --- a/src/CryptoTokenKit/CMakeLists.txt +++ b/src/CryptoTokenKit/CMakeLists.txt @@ -24,5 +24,5 @@ add_framework(CryptoTokenKit DEPENDENCIES system - ${CoreFoundation} + CoreFoundation ) diff --git a/src/DiskArbitration/CMakeLists.txt b/src/DiskArbitration/CMakeLists.txt index ad81cc01e..b8f8cb017 100644 --- a/src/DiskArbitration/CMakeLists.txt +++ b/src/DiskArbitration/CMakeLists.txt @@ -18,5 +18,5 @@ add_framework(DiskArbitration ${da_SRCS} DEPENDENCIES system - ${CoreFoundation} + CoreFoundation ) diff --git a/src/PlistBuddy/CMakeLists.txt b/src/PlistBuddy/CMakeLists.txt new file mode 100644 index 000000000..5efc8ed0e --- /dev/null +++ b/src/PlistBuddy/CMakeLists.txt @@ -0,0 +1,11 @@ +project(PlistBuddy) + +add_darling_executable(PlistBuddy + PlistBuddy.c +) + +target_link_libraries(PlistBuddy ${CoreFoundation}) + +install(TARGETS PlistBuddy DESTINATION libexec/darling/usr/libexec) + +install(FILES PlistBuddy.8 DESTINATION libexec/darling/usr/share/man/man8) diff --git a/src/PlistBuddy/PlistBuddy.8 b/src/PlistBuddy/PlistBuddy.8 new file mode 100644 index 000000000..2c17d8e7a --- /dev/null +++ b/src/PlistBuddy/PlistBuddy.8 @@ -0,0 +1,152 @@ +.\"Copyright (c) 1999-2012 Apple Computer, Inc. All Rights Reserved. +.\" +.\"This file contains Original Code and/or Modifications of Original Code +.\"as defined in and that are subject to the Apple Public Source License +.\"Version 2.0 (the 'License'). You may not use this file except in +.\"compliance with the License. Please obtain a copy of the License at +.\"http://www.opensource.apple.com/apsl/ and read it before using this +.\"file. +.\" +.\"The Original Code and all software distributed under the License are +.\"distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER +.\"EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, +.\"INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, +.\"FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. +.\"Please see the License for the specific language governing rights and +.\"limitations under the License. +.Dd February 19, 2007 +.Dt PLISTBUDDY 8 +.Os "Mac OS X" +.Sh NAME +.Nm PlistBuddy +.Nd read and write values to plists +.Sh SYNOPSIS +.Nm +.Op Fl cxh +.Ar file.plist +.Sh DESCRIPTION +The +.Nm +command is used to read and modify values inside of a plist. Unless specified by the +.Fl c +switch, +.Nm +runs in interactive mode. +.Pp +The following commands are used to manipulate plist data: +.Bl -tag -width "Clear Type" +.It Sy Help +Prints this information. +.It Sy Exit +Exits the program. Changes are not saved to the file. +.It Sy Save +Saves the current changes to the file. +.It Sy Revert +Reloads the last saved version of the file. +.It Sy Clear Ar type +Clears out all existing entries, and creates root of type +.Ar type . +See below for a list of types. +.It Sy Print Op entry +Prints value of +.Ar entry . +If an entry is not specified, prints entire file. See below for an explanation of how entry works. +.It Sy Set Ar entry Ar value +Sets the value at +.Ar entry +to +.Ar value . +.It Sy Add Ar entry Ar type Op value +Adds +.Ar entry +with type +.Ar type +and optional value +.Ar value . +See below for a list of types. +.It Sy Copy Ar entrySrc Ar entryDst +Copies the +.Ar entrySrc +property to +.Ar entryDst . +.It Sy Delete Ar entry +Deletes +.Ar entry +from the plist. +.It Sy Merge Ar file Op entry +Adds the contents of plist +.Ar file +to +.Ar entry . +.It Sy Import Ar entry Ar file +Creates or sets +.Ar entry +to the contents of +.Ar file . +.El +.Pp +Entries consist of property key names delimited by colons. Array items are specified by a zero-based integer index. Examples: +.Pp + :CFBundleShortVersionString + :CFBundleDocumentTypes:2:CFBundleTypeExtensions +.Pp +Entries may be of the following types: +.Pp + string + array + dict + bool + real + integer + date + data +.Sh OPTIONS +.Bl -tag -width "-c command" +.It Fl c Ar command +Execute command and exit. By default, PlistBuddy will run in interactive mode. +.It Fl x +Output will be in the form of an xml plist where appropriate. +.It Fl h +Print the complete help info. +.El +.Sh EXAMPLES +.Pp +Set the CFBundleIdentifier property to com.apple.plistbuddy: +.Vb 1 +.Pp +\& Set :CFBundleIdentifier com.apple.plistbuddy +.Ve +.Pp +Add the CFBundleGetInfoString property to the plist: +.Vb 1 +.Pp +\& Add :CFBundleGetInfoString string "App version 1.0.1" +.Ve +.Pp +Add a new item of type dict to the CFBundleDocumentTypes array: +.Vb 1 +.Pp +\& Add :CFBundleDocumentTypes: dict +.Ve +.Pp +Add the new item to the beginning of the array: +.Vb 1 +.Pp +\& Add :CFBundleDocumentTypes:0 dict +.Ve +.Pp +Delete the \s-1FIRST\s0 item in the array: +.Vb 1 +.Pp +\& Delete :CFBundleDocumentTypes:0 dict +.Ve +.Pp +Delete the \s-1ENTIRE\s0 CFBundleDocumentTypes array: +.Vb 1 +.Pp +\& Delete :CFBundleDocumentTypes +.Ve +.Pp +.Sh EXIT STATUS +.Nm +command returns a zero exit status if it succeeds. Non zero is returned in case of failure. diff --git a/src/PlistBuddy/PlistBuddy.c b/src/PlistBuddy/PlistBuddy.c new file mode 100644 index 000000000..cbd84f148 --- /dev/null +++ b/src/PlistBuddy/PlistBuddy.c @@ -0,0 +1,7 @@ +#include +#include +#include + +int main(int argc, char *argv[], char *envp[], char *apple[]) { + return EXIT_SUCCESS; +} diff --git a/src/SystemConfiguration/CMakeLists.txt b/src/SystemConfiguration/CMakeLists.txt index bf04436b9..31555d754 100644 --- a/src/SystemConfiguration/CMakeLists.txt +++ b/src/SystemConfiguration/CMakeLists.txt @@ -18,5 +18,5 @@ add_framework(SystemConfiguration ${SystemConfiguration_SRCS} DEPENDENCIES system - ${CoreFoundation} + CoreFoundation ) diff --git a/src/external/IOKitUser b/src/external/IOKitUser index 7fc68218c..88e409624 160000 --- a/src/external/IOKitUser +++ b/src/external/IOKitUser @@ -1 +1 @@ -Subproject commit 7fc68218c8f7616d5972da2955f337b197e2792d +Subproject commit 88e4096246ca37083ef1193ad8cabae586f50756 diff --git a/src/external/cocotron b/src/external/cocotron index a8364108d..e27ab4697 160000 --- a/src/external/cocotron +++ b/src/external/cocotron @@ -1 +1 @@ -Subproject commit a8364108d4dbd2f967574fc975a62d47fb2eff00 +Subproject commit e27ab4697013934c8b5ad26634fdda703206b22b diff --git a/src/external/corefoundation b/src/external/corefoundation index 4fade8083..15681a44c 160000 --- a/src/external/corefoundation +++ b/src/external/corefoundation @@ -1 +1 @@ -Subproject commit 4fade8083fc4a782d1260c51b9486bb56306edbd +Subproject commit 15681a44cde3c3342d0fc7e35093606f467268d7 diff --git a/src/external/gdb b/src/external/gdb index 6698008eb..0a297b1dc 160000 --- a/src/external/gdb +++ b/src/external/gdb @@ -1 +1 @@ -Subproject commit 6698008eb711e4320a8ee536090095abfda11916 +Subproject commit 0a297b1dca563a9d9878ca118ea8813653bbf09d diff --git a/src/external/installer b/src/external/installer index e1b7b5471..cde49e8da 160000 --- a/src/external/installer +++ b/src/external/installer @@ -1 +1 @@ -Subproject commit e1b7b5471c69d0c9123132c96887461b7df3dced +Subproject commit cde49e8dae4134e77457c42869fbef9afa2acff9 diff --git a/src/external/python b/src/external/python index 3185424c6..a16b72d01 160000 --- a/src/external/python +++ b/src/external/python @@ -1 +1 @@ -Subproject commit 3185424c6014e64df5213380f4b1f9933b06ba8d +Subproject commit a16b72d01eda77e5a9004ea67c7c793977b3367f diff --git a/src/external/system_cmds b/src/external/system_cmds index 5501c7bdf..87af584c2 160000 --- a/src/external/system_cmds +++ b/src/external/system_cmds @@ -1 +1 @@ -Subproject commit 5501c7bdf43e35dae8ef22f6a85c779a6d952c09 +Subproject commit 87af584c22a9b63cfab7bc685a9b2ad5e862f001 diff --git a/src/external/vim b/src/external/vim index b381b8740..476b532b3 160000 --- a/src/external/vim +++ b/src/external/vim @@ -1 +1 @@ -Subproject commit b381b8740bfbad7595644da77206efda4656fa6a +Subproject commit 476b532b3156df78c3c38a5e2dac960c9b1f87c2 diff --git a/src/launchd/support/CMakeLists.txt b/src/launchd/support/CMakeLists.txt index fdfdd8b04..352d45fb9 100644 --- a/src/launchd/support/CMakeLists.txt +++ b/src/launchd/support/CMakeLists.txt @@ -33,7 +33,7 @@ add_definitions(-DPRIVATE) include(darling_exe) add_darling_executable(launchctl launchctl.c) -target_link_libraries(launchctl xpc ${CoreFoundation} edit) +target_link_libraries(launchctl xpc CoreFoundation edit) add_darling_executable(launchproxy launchproxy.c) target_link_libraries(launchproxy xpc) diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index a1e91faf4..832d9d702 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -4,4 +4,4 @@ add_darling_executable(sw_vers sw_vers.c) add_darling_executable(sudo sudo.c) install(TARGETS sw_vers sudo DESTINATION libexec/darling/usr/bin) -target_link_libraries(sw_vers ${CoreFoundation}) +target_link_libraries(sw_vers CoreFoundation) diff --git a/src/xcselect/CMakeLists.txt b/src/xcselect/CMakeLists.txt index 6c1aca126..433c53f26 100644 --- a/src/xcselect/CMakeLists.txt +++ b/src/xcselect/CMakeLists.txt @@ -8,7 +8,7 @@ set(DYLIB_COMPAT_VERSION "1.0.0") set(DYLIB_CURRENT_VERSION "1.0.0") add_darling_library(xcselect xcselect.c) -target_link_libraries(xcselect system) +target_link_libraries(xcselect system CoreFoundation) add_darling_executable(xcrun xcrun.c) target_link_libraries(xcrun system xcselect) -- 2.51.2