This patch adds a --crtimes (-N) option that will preserve
create times on OS X.

To use this patch, run these commands for a successful build:

    patch -p1 <patches/flags.diff
    patch -p1 <patches/crtimes.diff
    patch -p1 <patches/rsync10.3xattr_support.diff
    ./configure                      (optional if already run)
    make

Binary files ../rsync-3.0.0pre9/.DS_Store and ./.DS_Store differ
diff -rPC2 ../rsync-3.0.0pre9/Makefile.in ./Makefile.in
*** ../rsync-3.0.0pre9/Makefile.in	Tue Jan  1 19:43:55 2008
--- ./Makefile.in	Wed Feb 13 11:37:07 2008
***************
*** 62,65 ****
--- 62,71 ----
  all: conf_stop make_stop rsync$(EXEEXT) @MAKE_MAN@
  
+ # Separate rule to accommodate extra options for lib/sysxattrs.o on pre-Tiger OS X
+ lib/sysxattrs.o: lib/sysxattrs.c
+ @OBJ_SAVE@
+ 	$(CC) -I. -I$(srcdir) @SYSXATTRS_CFLAGS@ $(CFLAGS) $(CPPFLAGS) -c $< @CC_SHOBJ_FLAG@
+ @OBJ_RESTORE@
+ 
  install: all
  	-mkdir -p ${DESTDIR}${bindir}
diff -rPC2 ../rsync-3.0.0pre9/config.h.in ./config.h.in
*** ../rsync-3.0.0pre9/config.h.in	Wed Feb 13 11:28:19 2008
--- ./config.h.in	Wed Feb 13 19:41:04 2008
***************
*** 114,117 ****
--- 114,120 ----
  #undef HAVE_GETADDRINFO
  
+ /* Define to 1 if you have the `getattrlist' function. */
+ #undef HAVE_GETATTRLIST
+ 
  /* Define to 1 if you have the `getcwd' function. */
  #undef HAVE_GETCWD
***************
*** 289,292 ****
--- 292,298 ----
  /* true if you have posix ACLs */
  #undef HAVE_POSIX_ACLS
+ 
+ /* True if you have Mac OS X PreTiger attrs */
+ #undef HAVE_PRE_TIGER_OSX_ATTRS
  
  /* Define to 1 if you have the `putenv' function. */
diff -rPC2 ../rsync-3.0.0pre9/configure.in ./configure.in
*** ../rsync-3.0.0pre9/configure.in	Wed Feb 13 11:28:19 2008
--- ./configure.in	Wed Feb 13 19:37:55 2008
***************
*** 553,557 ****
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      chflags strerror putenv iconv_open locale_charset nl_langinfo getxattr \
!     extattr_get_link sigaction sigprocmask setattrlist)
  
  dnl cygwin iconv.h defines iconv_open as libiconv_open
--- 553,557 ----
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      chflags strerror putenv iconv_open locale_charset nl_langinfo getxattr \
!     extattr_get_link sigaction sigprocmask setattrlist getattrlist)
  
  dnl cygwin iconv.h defines iconv_open as libiconv_open
***************
*** 871,875 ****
  	LIBS="$LIBS -lpacl"
  	;;
!     darwin*)
  	AC_MSG_RESULT(Using OS X ACLs)
  	AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
--- 871,875 ----
  	LIBS="$LIBS -lpacl"
  	;;
!     darwin[[0-38-9]].*)
  	AC_MSG_RESULT(Using OS X ACLs)
  	AC_DEFINE(HAVE_OSX_ACLS, 1, [true if you have Mac OS X ACLs])
***************
*** 918,922 ****
      AC_HELP_STRING([--disable-xattr-support],
  	    [disable extended attributes]),
!     [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
  	*yes*) enable_xattr_support=maybe ;;
  	*) enable_xattr_support=no ;;
--- 918,922 ----
      AC_HELP_STRING([--disable-xattr-support],
  	    [disable extended attributes]),
!     [], [case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_getattrlist" in
  	*yes*) enable_xattr_support=maybe ;;
  	*) enable_xattr_support=no ;;
***************
*** 933,937 ****
  	AC_DEFINE(SUPPORT_XATTRS, 1)
  	;;
!     darwin*)
  	AC_MSG_RESULT(Using OS X xattrs)
  	AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
--- 933,946 ----
  	AC_DEFINE(SUPPORT_XATTRS, 1)
  	;;
!     # The square brackets in the next line are doubled in configure.in
!     # because autoconf strips out one pair as quoting symbols.
!     darwin[[4-7]].*)
! 	AC_MSG_RESULT(Using OS X PreTiger attrs)
! 	AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
! 	AC_DEFINE(HAVE_PRE_TIGER_OSX_ATTRS, 1, [True if you have Mac OS X PreTiger attrs])
! 	AC_DEFINE(SUPPORT_XATTRS, 1)
! 	SYSXATTRS_CFLAGS="-I /Developer/SDKs/MacOSX10.3.0.sdk/Developer/Headers/CFMCarbon/"
! 	;;
! 	darwin*)
  	AC_MSG_RESULT(Using OS X xattrs)
  	AC_DEFINE(HAVE_OSX_XATTRS, 1, [True if you have Mac OS X xattrs])
***************
*** 952,955 ****
--- 961,965 ----
      esac
  fi
+ AC_SUBST(SYSXATTRS_CFLAGS)
  
  AC_CONFIG_FILES([Makefile lib/dummy zlib/dummy popt/dummy shconfig])
diff -rPC2 ../rsync-3.0.0pre9/configure.sh ./configure.sh
*** ../rsync-3.0.0pre9/configure.sh	Wed Feb 13 11:28:20 2008
--- ./configure.sh	Wed Feb 13 19:41:02 2008
***************
*** 687,690 ****
--- 687,691 ----
  BUILD_POPT
  MAKE_MAN
+ SYSXATTRS_CFLAGS
  LTLIBOBJS'
  ac_subst_files=''
***************
*** 14791,14794 ****
--- 14792,14796 ----
  
  
+ 
  for ac_func in waitpid wait4 getcwd strdup chown chmod lchmod mknod mkfifo \
      fchmod fstat ftruncate strchr readlink link utime utimes lutimes strftime \
***************
*** 14797,14801 ****
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      chflags strerror putenv iconv_open locale_charset nl_langinfo getxattr \
!     extattr_get_link sigaction sigprocmask setattrlist
  do
  as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
--- 14799,14803 ----
      setlocale setmode open64 lseek64 mkstemp64 mtrace va_copy __va_copy \
      chflags strerror putenv iconv_open locale_charset nl_langinfo getxattr \
!     extattr_get_link sigaction sigprocmask setattrlist getattrlist
  do
  as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
***************
*** 16463,16467 ****
  	LIBS="$LIBS -lpacl"
  	;;
!     darwin*)
  	{ echo "$as_me:$LINENO: result: Using OS X ACLs" >&5
  echo "${ECHO_T}Using OS X ACLs" >&6; }
--- 16465,16469 ----
  	LIBS="$LIBS -lpacl"
  	;;
!     darwin[0-38-9].*)
  	{ echo "$as_me:$LINENO: result: Using OS X ACLs" >&5
  echo "${ECHO_T}Using OS X ACLs" >&6; }
***************
*** 17120,17124 ****
    enableval=$enable_xattr_support;
  else
!   case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link" in
  	*yes*) enable_xattr_support=maybe ;;
  	*) enable_xattr_support=no ;;
--- 17122,17126 ----
    enableval=$enable_xattr_support;
  else
!   case "$ac_cv_func_getxattr$ac_cv_func_extattr_get_link$ac_cv_func_getattrlist" in
  	*yes*) enable_xattr_support=maybe ;;
  	*) enable_xattr_support=no ;;
***************
*** 17146,17150 ****
  
  	;;
!     darwin*)
  	{ echo "$as_me:$LINENO: result: Using OS X xattrs" >&5
  echo "${ECHO_T}Using OS X xattrs" >&6; }
--- 17148,17173 ----
  
  	;;
!     # The square brackets in the next line are doubled in configure.in
!     # because autoconf strips out one pair as quoting symbols.
!     darwin[4-7].*)
! 	{ echo "$as_me:$LINENO: result: Using OS X PreTiger attrs" >&5
! echo "${ECHO_T}Using OS X PreTiger attrs" >&6; }
! 
! cat >>confdefs.h <<\_ACEOF
! #define HAVE_OSX_XATTRS 1
! _ACEOF
! 
! 
! cat >>confdefs.h <<\_ACEOF
! #define HAVE_PRE_TIGER_OSX_ATTRS 1
! _ACEOF
! 
! 	cat >>confdefs.h <<\_ACEOF
! #define SUPPORT_XATTRS 1
! _ACEOF
! 
! 	SYSXATTRS_CFLAGS="-I /Developer/SDKs/MacOSX10.3.0.sdk/Developer/Headers/CFMCarbon/"
! 	;;
! 	darwin*)
  	{ echo "$as_me:$LINENO: result: Using OS X xattrs" >&5
  echo "${ECHO_T}Using OS X xattrs" >&6; }
***************
*** 17185,17188 ****
--- 17208,17212 ----
  fi
  
+ 
  ac_config_files="$ac_config_files Makefile lib/dummy zlib/dummy popt/dummy shconfig"
  
***************
*** 17879,17886 ****
  BUILD_POPT!$BUILD_POPT$ac_delim
  MAKE_MAN!$MAKE_MAN$ac_delim
  LTLIBOBJS!$LTLIBOBJS$ac_delim
  _ACEOF
  
!   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then
      break
    elif $ac_last_try; then
--- 17903,17911 ----
  BUILD_POPT!$BUILD_POPT$ac_delim
  MAKE_MAN!$MAKE_MAN$ac_delim
+ SYSXATTRS_CFLAGS!$SYSXATTRS_CFLAGS$ac_delim
  LTLIBOBJS!$LTLIBOBJS$ac_delim
  _ACEOF
  
!   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 74; then
      break
    elif $ac_last_try; then
Binary files ../rsync-3.0.0pre9/lib/.DS_Store and ./lib/.DS_Store differ
diff -rPC2 ../rsync-3.0.0pre9/lib/dummy ./lib/dummy
*** ../rsync-3.0.0pre9/lib/dummy	Thu Jan  1 01:00:00 1970
--- ./lib/dummy	Wed Feb 13 19:44:14 2008
***************
*** 0 ****
--- 1,2 ----
+ This is a dummy file to ensure that the lib directory gets created
+ by configure when a VPATH is used.
diff -rPC2 ../rsync-3.0.0pre9/lib/sysxattrs.c ./lib/sysxattrs.c
*** ../rsync-3.0.0pre9/lib/sysxattrs.c	Tue Jul 10 15:55:49 2007
--- ./lib/sysxattrs.c	Wed Feb 13 11:37:08 2008
***************
*** 53,56 ****
--- 53,289 ----
  #elif HAVE_OSX_XATTRS
  
+ #ifdef HAVE_PRE_TIGER_OSX_ATTRS
+ 
+ #include <sys/attr.h>
+ #include <unistd.h>
+ #include <string.h>
+ #include <CarbonCore/Files.h>
+ 
+ #define FINDER_INFO_XATTR_NAME "com.apple.FinderInfo"
+ #define RESOURCE_FORK_XATTR_NAME "com.apple.ResourceFork"
+ 
+ ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
+ {
+ 	struct attrlist attrList; //List of attributes
+ 	
+ 	/* initialisation */
+ 	attrList.bitmapcount=ATTR_BIT_MAP_COUNT;
+ 	attrList.reserved=0;
+ 	attrList.commonattr=0;
+ 	attrList.volattr=0;
+ 	attrList.dirattr=0;
+ 	attrList.fileattr=0;
+ 	attrList.forkattr=0;
+ 	
+ 	/* Uses getattrlist to get FinderInfo */
+ 	if(strcmp(name, FINDER_INFO_XATTR_NAME)==0)
+ 	{
+ 		attrList.commonattr+=ATTR_CMN_FNDRINFO;
+ 		if(getattrlist(path, &attrList, value, size, FSOPT_NOFOLLOW)==0)
+ 			return 32; /* Size of the FinderInfo */
+ 		else
+ 			return -1; /* Errno is setup by getattrlist */
+ 	}
+ 	/* Uses carbon to get ResourceFork */
+ 	else if(strcmp(name, RESOURCE_FORK_XATTR_NAME)==0)
+ 	{
+ 		char path_with_name[PATH_MAX]; /* POSIX name of the file */
+ 		FSRef ref; /* A Carbon reference to the file (analogue to a POSIX Path) */
+ 		HFSUniStr255 resourceForkName; /* Carbon Unicode String for the resource fork name */
+ 		FSIORefNum forkRefNum; /* The Carbon file descriptor */
+ 		ssize_t read; /* The read size */
+ 		
+ 		/* Concatenates the path and the name of the file */
+ 		strcpy(path_with_name, path);
+ 		strcat(path_with_name, name);
+ 		
+ 		/* Transformates the POSIX path in a Carbon one */
+ 		OSStatus carbon_status = FSPathMakeRef (
+ 												path_with_name, /* POSIX Path */
+ 												&ref, /* Carbon path */
+ 												NULL /* Optionnal boolean result saying if it's a directory */
+ 												);
+ 		if(carbon_status != noErr) /* If things don't finish as wanted*/
+ 		{
+ 			errno=carbon_status; /* I don't think We should do this way, but I'm too lazy by now to make a constant conversion from Apple OSErr table to errno constants */
+ 			return -1;
+ 		}
+ 		
+ 		/* Gets a Unicode string with the name of the Resource Fork as needed later */
+ 		OSErr carbon_error = FSGetResourceForkName(&resourceForkName);
+ 		if(carbon_error != noErr)
+ 		{
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		
+ 		/* Open the resource fork */
+ 		carbon_error = FSOpenFork (
+ 							  &ref, /* Carbon path to the file we want to open*/
+ 							  resourceForkName.length, /* lenght of the name of the fork we want */
+ 							  resourceForkName.unicode, /* fork we want */
+ 							  fsRdPerm, /* Opening read-only */
+ 							  &forkRefNum /* The file descriptor of the resource we are opening */
+ 							  );
+ 		if(carbon_error != noErr)
+ 		{
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		
+ 		if(value==NULL && size==0) /*If we are testing to get the size of the buffer */
+ 		{
+ 			carbon_error = FSGetForkSize(forkRefNum, &read);
+ 			FSCloseFork(forkRefNum);
+ 			if(carbon_error != noErr)
+ 			{
+ 				errno=carbon_error;
+ 				return -1;
+ 			}
+ 			return read;
+ 		}
+ 		/* Copy the content to the value buffer */
+ 		carbon_error = FSReadFork (
+ 					forkRefNum, /* File descriptor from where we want to read */
+ 					fsFromStart, /* From the begin. Are we sure we have enough space in the value buffer to do one-pass read? */
+ 					0, /* offset */
+ 					size, /* size of the value buffer */
+ 					&value, /* buffer on which we are writing */
+ 					&read /* size effectively written */
+ 					);
+ 		if(carbon_error != noErr)
+ 		{
+ 			FSCloseFork(forkRefNum);
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		/* Close the file and return how much data we read */
+ 		FSCloseFork(forkRefNum);
+ 		return read;
+ 	}
+ 	errno=ENOATTR;
+ 	return -1; //Says that the Attribute doesn't exist and return
+ }
+ 
+ ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size)
+ {
+ 	/* getattrlist needs the path of the file,
+ 	but it's almost impossible to get the path from the filedes
+ 	(we would need to scan all the filesystem looking for and inode number)
+ 	Do we really need this function? */
+ 	return -1;
+ }
+ 
+ int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size)
+ {
+ 	struct attrlist attrList; //List of attributes
+ 	
+ 	/* initialisation */
+ 	attrList.bitmapcount=ATTR_BIT_MAP_COUNT;
+ 	attrList.reserved=0;
+ 	attrList.commonattr=0;
+ 	attrList.volattr=0;
+ 	attrList.dirattr=0;
+ 	attrList.fileattr=0;
+ 	attrList.forkattr=0;
+ 	
+ 	/* Uses getattrlist to get FinderInfo */
+ 	if(strcmp(name, FINDER_INFO_XATTR_NAME)==0)
+ 	{
+ 		attrList.commonattr+=ATTR_CMN_FNDRINFO;
+ 		return setattrlist(path, &attrList, value, size, FSOPT_NOFOLLOW);
+ 	}
+ 	
+ 	/* Uses carbon to set ResourceFork */
+ 	else if(strcmp(name, RESOURCE_FORK_XATTR_NAME)==0)
+ 	{
+ 		char path_with_name[PATH_MAX]; /* POSIX name of the file */
+ 		FSRef ref; /* A Carbon reference to the file (analogue to a POSIX Path) */
+ 		FSUniStr255 resourceForkName; /* Carbon Unicode String for the resource fork name */
+ 		FSIORefNum forkRefNum; /* The Carbon file descriptor */
+ 		ssize_t read; /* The read size */
+ 		
+ 		/* Concatenates the path and the name of the file */
+ 		strcpy(path_with_name, path);
+ 		strcat(path_with_name, name);
+ 		
+ 		/* Transformates the POSIX path in a Carbon one */
+ 		OSStatus carbon_status = FSPathMakeRef (
+ 												path_with_name, /* POSIX Path */
+ 												&ref, /* Carbon path */
+ 												NULL /* Optionnal boolean result saying if it's a directory */
+ 												);
+ 		if(carbon_status != noErr) /* If things don't finish as wanted*/
+ 		{
+ 			errno=carbon_status; /* I don't think We should do this way, but I'm too lazy by now to make a constant conversion from Apple OSErr table to errno constants */
+ 			return -1;
+ 		}
+ 		
+ 		/* Gets a Unicode string with the name of the Resource Fork as needed later */
+ 		OSErr carbon_error = FSGetResourceForkName(&resourceForkName);
+ 		if(carbon_error != noErr)
+ 		{
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		
+ 		/* Open the resource fork */
+ 		carbon_error = FSOpenFork (
+ 								   &ref, /* Carbon path to the file we want to open*/
+ 								   resourceForkName.length, /* lenght of the name of the fork we want */
+ 								   resourceForkName.unicode, /* fork we want */
+ 								   fsWrPerm, /* Opening Write-only (read-write, in reality) */
+ 								   &forkRefNum /* The file descriptor of the resource we are opening */
+ 								   );
+ 		if(carbon_error != noErr)
+ 		{
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		
+ 		/* Copy the content from the value buffer */
+ 		carbon_error = FSWriteFork (
+ 								   forkRefNum, /* File descriptor to where we want to write */
+ 								   fsFromStart, /* From the begin. Are we sure we have enough space in the value buffer to do one-pass read? */
+ 								   0, /* offset */
+ 								   size, /* size of the value buffer */
+ 								   &value, /* buffer from which we are reading */
+ 								   &read /* size effectively written */
+ 								   );
+ 		if(carbon_error != noErr)
+ 		{
+ 			FSCloseFork(forkRefNum);
+ 			errno=carbon_error;
+ 			return -1;
+ 		}
+ 		/* Close the file and return how much data we read */
+ 		FSCloseFork(forkRefNum);
+ 		if(read==size)
+ 			return 0;
+ 		return -1;
+ 	}
+ 	errno=ENOATTR;
+ 	return -1; //Says that the Attribute doesn't exist and return
+ }
+ 
+ int sys_lremovexattr(const char *path, const char *name)
+ {
+ 	//this fonction isn't useful (not used) and can't be coded for OS X prior to 10.4
+ 	//As the attributes are fixed and not named
+ 	return 0;
+ }
+ 
+ static const char *xattr_list = FINDER_INFO_XATTR_NAME "\0" RESOURCE_FORK_XATTR_NAME;
+ 
+ ssize_t sys_llistxattr(const char *path, char *list, size_t size)
+ {
+ 	if(size>=sizeof xattr_list)
+ 	{
+ 		memcpy(dest, xattr_list, sizeof xattr_list);
+ 	}
+ 	return sizeof xattr_list;
+ }
+ 
+ #else
  ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size)
  {
***************
*** 77,80 ****
--- 310,314 ----
  	return listxattr(path, list, size, XATTR_NOFOLLOW);
  }
+ #endif /* HAVE_PRE_TIGER_OSX_ATTRS */
  
  #elif HAVE_FREEBSD_XATTRS
diff -rPC2 ../rsync-3.0.0pre9/zlib/dummy ./zlib/dummy
*** ../rsync-3.0.0pre9/zlib/dummy	Thu Jan  1 01:00:00 1970
--- ./zlib/dummy	Wed Feb 13 19:44:15 2008
***************
*** 0 ****
--- 1,2 ----
+ This is a dummy file to ensure that the lib directory gets created
+ by configure when a VPATH is used.
