diff --git a/.gitmodules b/.gitmodules
index 96b4ed028..2821b5966 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -310,3 +310,6 @@
[submodule "src/external/rsync"]
path = src/external/rsync
url = ../darling-rsync.git
+[submodule "src/external/cups"]
+ path = src/external/cups
+ url = ../darling-cups.git
diff --git a/cmake/use_ld64.cmake b/cmake/use_ld64.cmake
index 2b9a249cd..49aa6f66c 100644
--- a/cmake/use_ld64.cmake
+++ b/cmake/use_ld64.cmake
@@ -30,6 +30,7 @@ FUNCTION(use_ld64 target)
-Wl,-dylib_file,/usr/lib/system/libsystem_platform.dylib:${CMAKE_BINARY_DIR}/src/external/libplatform/libplatform_firstpass.dylib \
-Wl,-dylib_file,/usr/lib/system/libsystem_trace.dylib:${CMAKE_BINARY_DIR}/src/external/libtrace/libsystem_trace_firstpass.dylib \
-Wl,-dylib_file,/usr/lib/system/libcorecrypto.dylib:${CMAKE_BINARY_DIR}/src/external/corecrypto/libcorecrypto_firstpass.dylib \
+-Wl,-dylib_file,/usr/lib/system/libsystem_dnssd.dylib:${CMAKE_BINARY_DIR}/src/lib/system/dnssd/libsystem_dnssd.dylib \
-Wl,-dylib_file,/usr/lib/system/libsystem_coretls.dylib:${CMAKE_BINARY_DIR}/src/external/coretls/libsystem_coretls.dylib \
-Wl,-dylib_file,/usr/lib/system/libcommonCrypto.dylib:${CMAKE_BINARY_DIR}/src/external/commoncrypto/libcommonCrypto.dylib \
-Wl,-dylib_file,/usr/lib/system/libsystem_asl.dylib:${CMAKE_BINARY_DIR}/src/external/syslog/libsystem_asl.tproj/libsystem_asl_firstpass.dylib \
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3da0206d3..60d79045c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -205,6 +205,8 @@ add_subdirectory(kernel)
add_subdirectory(libc)
add_subdirectory(vchroot)
+add_subdirectory(lib)
+
add_definitions(-D_LIBC_NO_FEATURE_VERIFICATION)
add_subdirectory(external/darling-dmg)
add_subdirectory(libm)
@@ -360,6 +362,7 @@ add_subdirectory(OpenCL)
add_subdirectory(OpenDirectory)
add_subdirectory(opendirectory)
add_subdirectory(MetalKit)
+add_subdirectory(external/cups)
add_subdirectory(clt)
diff --git a/src/SystemConfiguration/SCDynamicStoreCopySpecific.cpp b/src/SystemConfiguration/SCDynamicStoreCopySpecific.cpp
index bfb3ee112..ecaa0d36c 100644
--- a/src/SystemConfiguration/SCDynamicStoreCopySpecific.cpp
+++ b/src/SystemConfiguration/SCDynamicStoreCopySpecific.cpp
@@ -10,6 +10,8 @@
#define MAX_PASSENTRY_LENGTH 4096
+
+
CFStringRef SCDynamicStoreCopyComputerName (SCDynamicStoreRef store, CFStringEncoding *nameEncoding){
//LOG << "fixme: SCDynamicStoreCopyComputerName() - stub" << std::endl;
return NULL;
diff --git a/src/SystemConfiguration/stubs.c b/src/SystemConfiguration/stubs.c
index 9ac4b0013..b062a10cf 100644
--- a/src/SystemConfiguration/stubs.c
+++ b/src/SystemConfiguration/stubs.c
@@ -4,6 +4,18 @@
#define STUB() printf("STUB %s\n", __func__)
+const CFStringRef kSCDynamicStoreDomainState = CFSTR("State:");
+const CFStringRef kSCEntNetIPv4 = CFSTR("IPv4");
+const CFStringRef kSCEntNetIPv6 = CFSTR("IPv6");
+const CFStringRef kSCPropNetIPv4Router = CFSTR("Router");
+const CFStringRef kSCPropNetIPv6Router = CFSTR("Router"); /* Yes, they are the same */
+
+CFStringRef SCDynamicStoreKeyCreateNetworkGlobalEntity(CFAllocatorRef allocator, CFStringRef domain, CFStringRef entity)
+{
+ STUB();
+ return NULL;
+}
+
CFPropertyListRef SCDynamicStoreCopyValue(SCDynamicStoreRef store, CFStringRef key)
{
STUB();
diff --git a/src/external/cups b/src/external/cups
new file mode 160000
index 000000000..6d1050ebe
--- /dev/null
+++ b/src/external/cups
@@ -0,0 +1 @@
+Subproject commit 6d1050ebece9c18a25b9bc52149907d2a4fbbcd4
diff --git a/src/external/security b/src/external/security
index 466393c7a..30f90ed6e 160000
--- a/src/external/security
+++ b/src/external/security
@@ -1 +1 @@
-Subproject commit 466393c7aa92cda5a075d56f03bab358a20735d1
+Subproject commit 30f90ed6e98be1c6ca0de0a06e7bf5d562c63c2c
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
new file mode 100644
index 000000000..4cd46d92f
--- /dev/null
+++ b/src/lib/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(system)
diff --git a/src/lib/system/CMakeLists.txt b/src/lib/system/CMakeLists.txt
new file mode 100644
index 000000000..1828dc74d
--- /dev/null
+++ b/src/lib/system/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(dnssd)
diff --git a/src/lib/system/dnssd/CMakeLists.txt b/src/lib/system/dnssd/CMakeLists.txt
new file mode 100644
index 000000000..70b1ccb27
--- /dev/null
+++ b/src/lib/system/dnssd/CMakeLists.txt
@@ -0,0 +1,13 @@
+project(system_dnssd)
+
+set(DYLIB_INSTALL_NAME "/usr/lib/system/libsystem_dnssd.dylib")
+set(DYLIB_COMPAT_VERSION "1.0.0")
+set(DYLIB_CURRENT_VERSION "1096.60.2")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+add_darling_library(system_dnssd src/system_dnssd.c)
+make_fat(system_dnssd)
+target_link_libraries(system_dnssd PRIVATE system_c system_dyld)
+
+install(TARGETS system_dnssd DESTINATION libexec/darling/usr/lib/system)
diff --git a/src/lib/system/dnssd/constants.txt b/src/lib/system/dnssd/constants.txt
new file mode 100644
index 000000000..a1963df0d
--- /dev/null
+++ b/src/lib/system/dnssd/constants.txt
@@ -0,0 +1,40 @@
+00000000000053f4 T _DNSServiceAddRecord
+0000000000003753 T _DNSServiceBrowse
+000000000000444c T _DNSServiceBrowserCreate
+0000000000003a8c T _DNSServiceConstructFullName
+000000000000174c T _DNSServiceCreateConnection
+0000000000003261 T _DNSServiceCreateDelegateConnection
+00000000000044a3 T _DNSServiceDiscoveryDeallocate
+0000000000004485 T _DNSServiceDiscoveryMachPort
+0000000000004474 T _DNSServiceDiscovery_handleReply
+000000000000521f T _DNSServiceEnumerateDomains
+0000000000002586 T _DNSServiceGetAddrInfo
+000000000000487b T _DNSServiceGetPID
+0000000000004704 T _DNSServiceGetProperty
+0000000000005c06 T _DNSServiceNATPortMappingCreate
+000000000000289d T _DNSServiceProcessResult
+0000000000003d07 T _DNSServiceQueryRecord
+00000000000058c7 T _DNSServiceReconfirmRecord
+000000000000300c T _DNSServiceRefDeallocate
+000000000000281c T _DNSServiceRefSockFD
+0000000000004db2 T _DNSServiceRegister
+000000000000343b T _DNSServiceRegisterRecord
+000000000000577a T _DNSServiceRemoveRecord
+0000000000004963 T _DNSServiceResolve
+0000000000004460 T _DNSServiceResolverResolve
+0000000000004cb9 T _DNSServiceSetDefaultDomainForUser
+00000000000026ee T _DNSServiceSetDispatchQueue
+0000000000005e3d T _DNSServiceSleepKeepalive
+0000000000005618 T _DNSServiceUpdateRecord
+0000000000005a9a T _PeerConnectionRelease
+00000000000042c0 T _TXTRecordContainsKey
+0000000000004024 T _TXTRecordCreate
+000000000000403c T _TXTRecordDeallocate
+00000000000042b7 T _TXTRecordGetBytesPtr
+0000000000004324 T _TXTRecordGetCount
+0000000000004350 T _TXTRecordGetItemAtIndex
+00000000000042ad T _TXTRecordGetLength
+00000000000042e1 T _TXTRecordGetValuePtr
+00000000000041cd T _TXTRecordRemoveValue
+0000000000004052 T _TXTRecordSetValue
+
diff --git a/src/lib/system/dnssd/include/system_dnssd/system_dnssd.h b/src/lib/system/dnssd/include/system_dnssd/system_dnssd.h
new file mode 100644
index 000000000..98b089796
--- /dev/null
+++ b/src/lib/system/dnssd/include/system_dnssd/system_dnssd.h
@@ -0,0 +1,64 @@
+/*
+ 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 .
+*/
+
+
+#ifndef _system_dnssd_H_
+#define _system_dnssd_H_
+
+void* DNSServiceAddRecord(void);
+void* DNSServiceBrowse(void);
+void* DNSServiceBrowserCreate(void);
+void* DNSServiceConstructFullName(void);
+void* DNSServiceCreateConnection(void);
+void* DNSServiceCreateDelegateConnection(void);
+void* DNSServiceDiscoveryDeallocate(void);
+void* DNSServiceDiscoveryMachPort(void);
+void* DNSServiceDiscovery_handleReply(void);
+void* DNSServiceEnumerateDomains(void);
+void* DNSServiceGetAddrInfo(void);
+void* DNSServiceGetPID(void);
+void* DNSServiceGetProperty(void);
+void* DNSServiceNATPortMappingCreate(void);
+void* DNSServiceProcessResult(void);
+void* DNSServiceQueryRecord(void);
+void* DNSServiceReconfirmRecord(void);
+void* DNSServiceRefDeallocate(void);
+void* DNSServiceRefSockFD(void);
+void* DNSServiceRegister(void);
+void* DNSServiceRegisterRecord(void);
+void* DNSServiceRemoveRecord(void);
+void* DNSServiceResolve(void);
+void* DNSServiceResolverResolve(void);
+void* DNSServiceSetDefaultDomainForUser(void);
+void* DNSServiceSetDispatchQueue(void);
+void* DNSServiceSleepKeepalive(void);
+void* DNSServiceUpdateRecord(void);
+void* PeerConnectionRelease(void);
+void* TXTRecordContainsKey(void);
+void* TXTRecordCreate(void);
+void* TXTRecordDeallocate(void);
+void* TXTRecordGetBytesPtr(void);
+void* TXTRecordGetCount(void);
+void* TXTRecordGetItemAtIndex(void);
+void* TXTRecordGetLength(void);
+void* TXTRecordGetValuePtr(void);
+void* TXTRecordRemoveValue(void);
+void* TXTRecordSetValue(void);
+
+#endif
diff --git a/src/lib/system/dnssd/src/system_dnssd.c b/src/lib/system/dnssd/src/system_dnssd.c
new file mode 100644
index 000000000..668692241
--- /dev/null
+++ b/src/lib/system/dnssd/src/system_dnssd.c
@@ -0,0 +1,259 @@
+/*
+ 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
+
+static int verbose = 1;
+
+void* DNSServiceAddRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceAddRecord called");
+ return NULL;
+}
+
+void* DNSServiceBrowse(void)
+{
+ if (verbose) puts("STUB: DNSServiceBrowse called");
+ return NULL;
+}
+
+void* DNSServiceBrowserCreate(void)
+{
+ if (verbose) puts("STUB: DNSServiceBrowserCreate called");
+ return NULL;
+}
+
+void* DNSServiceConstructFullName(void)
+{
+ if (verbose) puts("STUB: DNSServiceConstructFullName called");
+ return NULL;
+}
+
+void* DNSServiceCreateConnection(void)
+{
+ if (verbose) puts("STUB: DNSServiceCreateConnection called");
+ return NULL;
+}
+
+void* DNSServiceCreateDelegateConnection(void)
+{
+ if (verbose) puts("STUB: DNSServiceCreateDelegateConnection called");
+ return NULL;
+}
+
+void* DNSServiceDiscoveryDeallocate(void)
+{
+ if (verbose) puts("STUB: DNSServiceDiscoveryDeallocate called");
+ return NULL;
+}
+
+void* DNSServiceDiscoveryMachPort(void)
+{
+ if (verbose) puts("STUB: DNSServiceDiscoveryMachPort called");
+ return NULL;
+}
+
+void* DNSServiceDiscovery_handleReply(void)
+{
+ if (verbose) puts("STUB: DNSServiceDiscovery_handleReply called");
+ return NULL;
+}
+
+void* DNSServiceEnumerateDomains(void)
+{
+ if (verbose) puts("STUB: DNSServiceEnumerateDomains called");
+ return NULL;
+}
+
+void* DNSServiceGetAddrInfo(void)
+{
+ if (verbose) puts("STUB: DNSServiceGetAddrInfo called");
+ return NULL;
+}
+
+void* DNSServiceGetPID(void)
+{
+ if (verbose) puts("STUB: DNSServiceGetPID called");
+ return NULL;
+}
+
+void* DNSServiceGetProperty(void)
+{
+ if (verbose) puts("STUB: DNSServiceGetProperty called");
+ return NULL;
+}
+
+void* DNSServiceNATPortMappingCreate(void)
+{
+ if (verbose) puts("STUB: DNSServiceNATPortMappingCreate called");
+ return NULL;
+}
+
+void* DNSServiceProcessResult(void)
+{
+ if (verbose) puts("STUB: DNSServiceProcessResult called");
+ return NULL;
+}
+
+void* DNSServiceQueryRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceQueryRecord called");
+ return NULL;
+}
+
+void* DNSServiceReconfirmRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceReconfirmRecord called");
+ return NULL;
+}
+
+void* DNSServiceRefDeallocate(void)
+{
+ if (verbose) puts("STUB: DNSServiceRefDeallocate called");
+ return NULL;
+}
+
+void* DNSServiceRefSockFD(void)
+{
+ if (verbose) puts("STUB: DNSServiceRefSockFD called");
+ return NULL;
+}
+
+void* DNSServiceRegister(void)
+{
+ if (verbose) puts("STUB: DNSServiceRegister called");
+ return NULL;
+}
+
+void* DNSServiceRegisterRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceRegisterRecord called");
+ return NULL;
+}
+
+void* DNSServiceRemoveRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceRemoveRecord called");
+ return NULL;
+}
+
+void* DNSServiceResolve(void)
+{
+ if (verbose) puts("STUB: DNSServiceResolve called");
+ return NULL;
+}
+
+void* DNSServiceResolverResolve(void)
+{
+ if (verbose) puts("STUB: DNSServiceResolverResolve called");
+ return NULL;
+}
+
+void* DNSServiceSetDefaultDomainForUser(void)
+{
+ if (verbose) puts("STUB: DNSServiceSetDefaultDomainForUser called");
+ return NULL;
+}
+
+void* DNSServiceSetDispatchQueue(void)
+{
+ if (verbose) puts("STUB: DNSServiceSetDispatchQueue called");
+ return NULL;
+}
+
+void* DNSServiceSleepKeepalive(void)
+{
+ if (verbose) puts("STUB: DNSServiceSleepKeepalive called");
+ return NULL;
+}
+
+void* DNSServiceUpdateRecord(void)
+{
+ if (verbose) puts("STUB: DNSServiceUpdateRecord called");
+ return NULL;
+}
+
+void* PeerConnectionRelease(void)
+{
+ if (verbose) puts("STUB: PeerConnectionRelease called");
+ return NULL;
+}
+
+void* TXTRecordContainsKey(void)
+{
+ if (verbose) puts("STUB: TXTRecordContainsKey called");
+ return NULL;
+}
+
+void* TXTRecordCreate(void)
+{
+ if (verbose) puts("STUB: TXTRecordCreate called");
+ return NULL;
+}
+
+void* TXTRecordDeallocate(void)
+{
+ if (verbose) puts("STUB: TXTRecordDeallocate called");
+ return NULL;
+}
+
+void* TXTRecordGetBytesPtr(void)
+{
+ if (verbose) puts("STUB: TXTRecordGetBytesPtr called");
+ return NULL;
+}
+
+void* TXTRecordGetCount(void)
+{
+ if (verbose) puts("STUB: TXTRecordGetCount called");
+ return NULL;
+}
+
+void* TXTRecordGetItemAtIndex(void)
+{
+ if (verbose) puts("STUB: TXTRecordGetItemAtIndex called");
+ return NULL;
+}
+
+void* TXTRecordGetLength(void)
+{
+ if (verbose) puts("STUB: TXTRecordGetLength called");
+ return NULL;
+}
+
+void* TXTRecordGetValuePtr(void)
+{
+ if (verbose) puts("STUB: TXTRecordGetValuePtr called");
+ return NULL;
+}
+
+void* TXTRecordRemoveValue(void)
+{
+ if (verbose) puts("STUB: TXTRecordRemoveValue called");
+ return NULL;
+}
+
+void* TXTRecordSetValue(void)
+{
+ if (verbose) puts("STUB: TXTRecordSetValue called");
+ return NULL;
+}
diff --git a/src/libsystem/CMakeLists.txt b/src/libsystem/CMakeLists.txt
index f5d5ed8cd..2a1bc4a5b 100644
--- a/src/libsystem/CMakeLists.txt
+++ b/src/libsystem/CMakeLists.txt
@@ -74,6 +74,7 @@ target_link_libraries(system PRIVATE
xpc
corecrypto
commonCrypto
+ system_dnssd
)
set_target_properties(system PROPERTIES OUTPUT_NAME "System.B")
@@ -106,6 +107,7 @@ set_property(TARGET system APPEND_STRING PROPERTY LINK_FLAGS
-sub_library libsystem_asl \
-sub_library libxpc \
-sub_library libcorecrypto \
+ -sub_library libsystem_dnssd \
-Wl,-compatibility_version,1.0.0 \
-Wl,-current_version,1238.0.0")