[libdispatch-changes] [214] trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 8 22:08:56 PDT 2012


Revision: 214
          http://trac.macosforge.org/projects/libdispatch/changeset/214
Author:   dsteffen at apple.com
Date:     2012-08-08 22:08:56 -0700 (Wed, 08 Aug 2012)
Log Message:
-----------
autotools buildsystem and portability changes for MountainLion source

Modified Paths:
--------------
    trunk/INSTALL
    trunk/Makefile.am
    trunk/config/config.h
    trunk/configure.ac
    trunk/man/Makefile.am
    trunk/os/object.h
    trunk/private/Makefile.am
    trunk/src/Makefile.am
    trunk/src/init.c
    trunk/src/transform.c

Added Paths:
-----------
    trunk/os/Makefile.am

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/INSTALL	2012-08-09 05:08:56 UTC (rev 214)
@@ -45,6 +45,16 @@
 The following options are likely to only be useful when building libdispatch on
 Mac OS X as a replacement for /usr/lib/system/libdispatch.dylib:
 
+--with-apple-objc4-source
+
+	Specify the path to Apple's objc4 package, so that appropriate headers can
+	be found and used.
+
+--with-apple-libauto-source
+
+	Specify the path to Apple's libauto package, so that appropriate headers
+	can be found and used.
+
 --disable-libdispatch-init-constructor
 
 	Do not tag libdispatch's init routine as __constructor, in which case it
@@ -61,16 +71,19 @@
   Typical configuration commands
 
 The following command lines create the configuration required to build
-libdispatch for /usr/lib/system on Mac OS X Lion:
+libdispatch for /usr/lib/system on OS X MountainLion:
 
 	sh autogen.sh
-	./configure CFLAGS='-arch x86_64 -arch i386 -g -Os' \
+	cflags='-arch x86_64 -arch i386 -g -Os'
+	./configure CFLAGS="$cflags" OBJCFLAGS="$cflags" CXXFLAGS="$cflags" \
 		--prefix=/usr --libdir=/usr/lib/system \
 		--disable-dependency-tracking --disable-static \
 		--enable-apple-tsd-optimizations \
-		--with-apple-libc-source=/path/to/10.7.0/Libc-763.11 \
-		--with-apple-libclosure-source=/path/to/10.7.0/libclosure-53 \
-		--with-apple-xnu-source=/path/to/10.7.0/xnu-1699.22.73
+		--with-apple-libc-source=/path/to/10.8.0/Libc-825.24 \
+		--with-apple-libclosure-source=/path/to/10.8.0/libclosure-59 \
+		--with-apple-xnu-source=/path/to/10.8.0/xnu-2050.7.9 \
+		--with-apple-objc4-source=/path/to/10.8.0/objc4-532 \
+		--with-apple-libauto-source=/path/to/10.8.0/libauto-185.1
 	make check
 
 Typical configuration line for FreeBSD 8.x and 9.x to build libdispatch with

Modified: trunk/Makefile.am
===================================================================
--- trunk/Makefile.am	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/Makefile.am	2012-08-09 05:08:56 UTC (rev 214)
@@ -7,6 +7,7 @@
 SUBDIRS=					\
 	dispatch				\
 	man						\
+	os						\
 	private					\
 	src
 

Modified: trunk/config/config.h
===================================================================
--- trunk/config/config.h	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/config/config.h	2012-08-09 05:08:56 UTC (rev 214)
@@ -143,13 +143,13 @@
 #define PACKAGE_NAME "libdispatch"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libdispatch 1.1"
+#define PACKAGE_STRING "libdispatch 1.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libdispatch"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.1"
+#define PACKAGE_VERSION "1.2"
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
@@ -170,7 +170,7 @@
 /* #undef USE_POSIX_SEM */
 
 /* Version number of package */
-#define VERSION "1.1"
+#define VERSION "1.2"
 
 /* Define to 1 if on AIX 3.
    System headers sometimes define this.

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/configure.ac	2012-08-09 05:08:56 UTC (rev 214)
@@ -3,7 +3,7 @@
 #
 
 AC_PREREQ(2.59)
-AC_INIT([libdispatch], [1.1], [libdispatch at macosforge.org], [libdispatch])
+AC_INIT([libdispatch], [1.2], [libdispatch at macosforge.org], [libdispatch])
 AC_REVISION([$$])
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_HEADER([config/config.h])
@@ -37,10 +37,24 @@
   [AS_HELP_STRING([--with-apple-xnu-source],
     [Specify path to Apple XNU source])], [
   apple_xnu_source_libkern_path=${withval}/libkern
+  apple_xnu_source_bsd_path=${withval}/bsd
   apple_xnu_source_osfmk_path=${withval}/osfmk
-  CPPFLAGS="$CPPFLAGS -I$apple_xnu_source_libkern_path"
+  CPPFLAGS="$CPPFLAGS -idirafter $apple_xnu_source_libkern_path -isystem $apple_xnu_source_bsd_path"
 ])
 
+AC_ARG_WITH([apple-objc4-source],
+  [AS_HELP_STRING([--with-apple-objc4-source],
+    [Specify path to Apple objc4 source])], [
+  apple_objc4_source_runtime_path=${withval}/runtime
+])
+
+AC_ARG_WITH([apple-libauto-source],
+  [AS_HELP_STRING([--with-apple-libauto-source],
+    [Specify path to Apple libauto source])], [
+  apple_libauto_source_path=${withval}
+  CPPFLAGS="$CPPFLAGS -I$apple_libauto_source_path"
+])
+
 AC_CACHE_CHECK([for System.framework/PrivateHeaders], dispatch_cv_system_privateheaders,
   [AS_IF([test -d /System/Library/Frameworks/System.framework/PrivateHeaders],
     [dispatch_cv_system_privateheaders=yes], [dispatch_cv_system_privateheaders=no])]
@@ -78,17 +92,16 @@
 )
 
 AC_USE_SYSTEM_EXTENSIONS
+AM_INIT_AUTOMAKE([foreign no-dependencies])
+LT_INIT([disable-static])
+
 AC_PROG_INSTALL
-AC_PROG_LIBTOOL
 AC_PATH_PROGS(MIG, mig)
-
 AC_PATH_PROG(LEAKS, leaks)
 AS_IF([test "x$LEAKS" != "x"],
   [AC_DEFINE(HAVE_LEAKS, 1, [Define if Apple leaks program is present])]
 )
 
-AM_INIT_AUTOMAKE([foreign])
-
 DISPATCH_C_ATOMIC_BUILTINS
 
 case $dispatch_cv_atomic in
@@ -131,20 +144,43 @@
     [ln -fsh "$apple_xnu_source_osfmk_path" src/System],
     [apple_xnu_source_osfmk_path="$apple_xnu_source_osfmk_path"])
 ])
+# hack for xnu/bsd/sys/event.h EVFILT_SOCK declaration
+AS_IF([test -n "$apple_xnu_source_bsd_path"], [
+  CPPFLAGS="$CPPFLAGS -DPRIVATE=1"
+])
 
 #
-# Parts of the testsuite use CoreFoundation and Foundation
+# Check for CoreFoundation, Foundation and objc
 #
 AC_CHECK_HEADER([CoreFoundation/CoreFoundation.h],
   [have_corefoundation=true], [have_corefoundation=false]
 )
 AM_CONDITIONAL(HAVE_COREFOUNDATION, $have_corefoundation)
+
 AC_LANG_PUSH([Objective C])
-AC_CHECK_HEADER([Foundation/Foundation.h], [
-    AC_DEFINE(USE_OBJC, 1, [Define to use Objective-C runtime])
-    have_foundation=true], [have_foundation=false]
+AC_CHECK_HEADER([Foundation/Foundation.h],
+  [have_foundation=true], [have_foundation=false]
 )
 AM_CONDITIONAL(HAVE_FOUNDATION, $have_foundation)
+# hack for objc4/runtime/objc-internal.h
+AS_IF([test -n "$apple_objc4_source_runtime_path"], [
+  saveCPPFLAGS="$CPPFLAGS"
+  CPPFLAGS="$CPPFLAGS -I."
+  ln -fsh "$apple_objc4_source_runtime_path" objc
+])
+AC_CHECK_HEADER([objc/objc-internal.h], [
+  AC_DEFINE(USE_OBJC, 1, [Define to use Objective-C runtime])
+  have_objc=true], [have_objc=false],
+  [#include <objc/runtime.h>]
+)
+AS_IF([test -n "$apple_objc4_source_runtime_path"], [
+  rm -f objc
+  CPPFLAGS="$saveCPPFLAGS"
+  AC_CONFIG_COMMANDS([src/objc],
+    [ln -fsh "$apple_objc4_source_runtime_path" src/objc],
+    [apple_objc4_source_runtime_path="$apple_objc4_source_runtime_path"])
+])
+AM_CONDITIONAL(USE_OBJC, $have_objc)
 AC_LANG_POP([Objective C])
 
 #
@@ -152,9 +188,9 @@
 # of Machisms, including using Mach ports as event sources, etc.
 #
 AC_CHECK_HEADER([mach/mach.h], [
-    AC_DEFINE(HAVE_MACH, 1, [Define if mach is present])
-    AC_DEFINE(__DARWIN_NON_CANCELABLE, 1, [Define if using Darwin $NOCANCEL])
-    have_mach=true], [have_mach=false]
+  AC_DEFINE(HAVE_MACH, 1, [Define if mach is present])
+  AC_DEFINE(__DARWIN_NON_CANCELABLE, 1, [Define if using Darwin $NOCANCEL])
+  have_mach=true], [have_mach=false]
 )
 AM_CONDITIONAL(USE_MIG, $have_mach)
 
@@ -239,7 +275,7 @@
 
 AC_CACHE_CHECK([for darwin linker], [dispatch_cv_ld_darwin], [
   saveLDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -dynamiclib -compatibility_version 1.2.3 -current_version 4.5.6"
+  LDFLAGS="$LDFLAGS -dynamiclib -compatibility_version 1.2.3 -current_version 4.5.6 -dead_strip"
   AC_LINK_IFELSE([AC_LANG_PROGRAM([
     extern int foo; int foo;], [foo = 0;])],
     [dispatch_cv_ld_darwin="yes"], [dispatch_cv_ld_darwin="no"])
@@ -259,5 +295,5 @@
 #
 # Generate Makefiles.
 #
-AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile private/Makefile src/Makefile])
+AC_CONFIG_FILES([Makefile dispatch/Makefile man/Makefile os/Makefile private/Makefile src/Makefile])
 AC_OUTPUT

Modified: trunk/man/Makefile.am
===================================================================
--- trunk/man/Makefile.am	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/man/Makefile.am	2012-08-09 05:08:56 UTC (rev 214)
@@ -77,10 +77,8 @@
 		$(LN) -f dispatch_data_create.3 dispatch_data_create_subrange.3 &&	\
 		$(LN) -f dispatch_data_create.3 dispatch_data_create_map.3 &&	\
 		$(LN) -f dispatch_data_create.3 dispatch_data_apply.3 &&	\
-		$(LN) -f dispatch_data_create.3 dispatch_data_copy_subrange.3 &&	\
 		$(LN) -f dispatch_data_create.3 dispatch_data_copy_region.3 &&	\
 		$(LN) -f dispatch_data_create.3 dispatch_data_get_size.3 &&	\
-		$(LN) -f dispatch_data_create.3 dispatch_data_copy_subrange.3 &&	\
 		$(LN) -f dispatch_data_create.3 dispatch_data_empty.3 &&	\
 		$(LN) -f dispatch_io_create.3 dispatch_io_create_with_path.3 &&	\
 		$(LN) -f dispatch_io_create.3 dispatch_io_set_high_water.3 &&	\
@@ -139,10 +137,8 @@
 			dispatch_data_create_subrange.3	\
 			dispatch_data_create_map.3	\
 			dispatch_data_apply.3	\
-			dispatch_data_copy_subrange.3	\
 			dispatch_data_copy_region.3	\
 			dispatch_data_get_size.3	\
-			dispatch_data_copy_subrange.3	\
 			dispatch_data_empty.3	\
 			dispatch_io_create_with_path.3	\
 			dispatch_io_set_high_water.3	\

Added: trunk/os/Makefile.am
===================================================================
--- trunk/os/Makefile.am	                        (rev 0)
+++ trunk/os/Makefile.am	2012-08-09 05:08:56 UTC (rev 214)
@@ -0,0 +1,11 @@
+#
+#
+#
+
+osdir=$(includedir)/os
+
+os_HEADERS=	\
+	object.h
+
+noinst_HEADERS=	\
+	object_private.h

Modified: trunk/os/object.h
===================================================================
--- trunk/os/object.h	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/os/object.h	2012-08-09 05:08:56 UTC (rev 214)
@@ -49,7 +49,7 @@
  */
 
 #ifndef OS_OBJECT_HAVE_OBJC_SUPPORT
-#if defined(__OBJC2__) && !defined(__OBJC_GC__) && ( \
+#if defined(__OBJC__) && defined(__OBJC2__) && !defined(__OBJC_GC__) && ( \
 		__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8 || \
 		__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_6_0)
 #define OS_OBJECT_HAVE_OBJC_SUPPORT 1

Modified: trunk/private/Makefile.am
===================================================================
--- trunk/private/Makefile.am	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/private/Makefile.am	2012-08-09 05:08:56 UTC (rev 214)
@@ -4,6 +4,8 @@
 
 noinst_HEADERS=			\
 	benchmark.h			\
+	data_private.h		\
+	dispatch.h			\
 	private.h			\
 	queue_private.h		\
 	source_private.h

Modified: trunk/src/Makefile.am
===================================================================
--- trunk/src/Makefile.am	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/src/Makefile.am	2012-08-09 05:08:56 UTC (rev 214)
@@ -16,6 +16,7 @@
 	semaphore.c				\
 	source.c				\
 	time.c					\
+	transform.c				\
 	protocol.defs			\
 	provider.d				\
 	data_internal.h			\
@@ -35,19 +36,30 @@
 	shims/time.h			\
 	shims/tsd.h
 
-INCLUDES=-I$(top_builddir) -I$(top_srcdir) -I$(top_srcdir)/private
+AM_CPPFLAGS=-I$(top_builddir) -I$(top_srcdir) \
+	-I$(top_srcdir)/private -I$(top_srcdir)/os
 
-libdispatch_la_CFLAGS=-Wall $(VISIBILITY_FLAGS) $(OMIT_LEAF_FP_FLAGS)
-libdispatch_la_CFLAGS+=$(MARCH_FLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS)
+AM_CFLAGS=-Wall $(VISIBILITY_FLAGS) $(OMIT_LEAF_FP_FLAGS) \
+	$(MARCH_FLAGS) $(CBLOCKS_FLAGS) $(KQUEUE_CFLAGS)
 
 libdispatch_la_LDFLAGS=-avoid-version
 
 if HAVE_DARWIN_LD
-libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 -Wl,-current_version,$(VERSION)
+libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \
+	-Wl,-current_version,$(VERSION) -Wl,-dead_strip
 endif
 
+if USE_OBJC
+libdispatch_la_SOURCES+=object.m
+libdispatch_la_OBJCFLAGS=$(AM_CFLAGS) -fobjc-gc
+libdispatch_la_LDFLAGS+=-Wl,-upward-lobjc -Wl,-upward-lauto \
+	-Wl,-order_file,$(top_srcdir)/xcodeconfig/libdispatch.order \
+	-Wl,-alias_list,$(top_srcdir)/xcodeconfig/libdispatch.aliases \
+	-Wl,-unexported_symbols_list,$(top_srcdir)/xcodeconfig/libdispatch.unexport
+endif
+
 CLEANFILES=
-DISTCLEANFILES=System
+DISTCLEANFILES=System objc
 
 if USE_MIG
 BUILT_SOURCES=				\

Modified: trunk/src/init.c
===================================================================
--- trunk/src/init.c	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/src/init.c	2012-08-09 05:08:56 UTC (rev 214)
@@ -780,6 +780,7 @@
 };
 
 const struct dispatch_source_type_s _dispatch_source_type_sock = {
+#ifdef EVFILT_SOCK
 	.ke = {
 		.filter = EVFILT_SOCK,
 		.flags = EV_CLEAR,
@@ -787,6 +788,7 @@
 	.mask = NOTE_CONNRESET |  NOTE_READCLOSED | NOTE_WRITECLOSED |
 		NOTE_TIMEOUT | NOTE_NOSRCADDR |  NOTE_IFDENIED | NOTE_SUSPEND |
 		NOTE_RESUME | NOTE_KEEPALIVE,
+#endif
 };
 
 #pragma mark -

Modified: trunk/src/transform.c
===================================================================
--- trunk/src/transform.c	2012-08-09 05:08:50 UTC (rev 213)
+++ trunk/src/transform.c	2012-08-09 05:08:56 UTC (rev 214)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Apple Inc. All rights reserved.
+ * Copyright (c) 2011-2012 Apple Inc. All rights reserved.
  *
  * @APPLE_APACHE_LICENSE_HEADER_START@
  *
@@ -352,6 +352,7 @@
 	});
 
 	if (!success) {
+		(void)_dispatch_transform_buffer_new(&buffer, 0, 0);
 		dispatch_release(buffer.data);
 		return NULL;
 	}
@@ -491,6 +492,7 @@
 	});
 
 	if (!success) {
+		(void)_dispatch_transform_buffer_new(&buffer, 0, 0);
 		dispatch_release(buffer.data);
 		return NULL;
 	}
@@ -910,6 +912,9 @@
 {
 	if (input->type == _DISPATCH_DATA_FORMAT_UTF_ANY) {
 		input = _dispatch_transform_detect_utf(data);
+		if (input == NULL) {
+			return NULL;
+		}
 	}
 
 	if ((input->type & ~output->input_mask) != 0) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20120808/507687e3/attachment-0001.html>


More information about the libdispatch-changes mailing list