diff -ruN --exclude='*~' emacs-22.3/Makefile.in emacs-22.3.patched/Makefile.in
--- emacs-22.3/Makefile.in	2008-01-07 09:53:19.000000000 +0100
+++ emacs-22.3.patched/Makefile.in	2009-09-09 13:01:41.000000000 +0200
@@ -438,7 +438,7 @@
 	      (cd $${dir}; tar -chf - . ) \
 		| (cd $${dest}; umask 022; \
                    tar -xvf - && cat > /dev/null) || exit 1; \
-	      find $${dest} -exec chown $${LOGNAME:-$$USERNAME} {} ';' ;\
+	      find $${dest} -exec chown root:admin {} ';' ;\
 	      for subdir in `find $${dest} -type d ! -name RCS ! -name CVS -print` ; do \
 		chmod a+rx $${subdir} ; \
 		rm -rf $${subdir}/RCS ; \
@@ -478,7 +478,7 @@
 	   echo "Copying etc/DOC-* to $(DESTDIR)${docdir} ..." ; \
 	   (cd ./etc; tar -chf - DOC*) \
 	     |(cd $(DESTDIR)${docdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
-	   (cd $(DESTDIR)$(docdir); chown $${LOGNAME:-$$USERNAME} DOC*; chmod a+r DOC*; \
+	   (cd $(DESTDIR)$(docdir); chown root:admin DOC*; chmod a+r DOC*; \
 	    if test "`echo DOC-*`" != "DOC-*"; then rm -f DOC; fi); \
 	else true; fi
 	-unset CDPATH; \
@@ -490,7 +490,7 @@
 	   echo "Copying lisp/*.el and lisp/*.elc to $(DESTDIR)${lispdir} ..." ; \
 	   (cd lisp; tar -chf - *.el *.elc) \
 	     |(cd $(DESTDIR)${lispdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
-	   (cd $(DESTDIR)${lispdir}; find . -exec chown $${LOGNAME:-$$USERNAME} {} ';') ; \
+	   (cd $(DESTDIR)${lispdir}; find . -exec chown root:admin {} ';') ; \
 	else true; fi
 	-unset CDPATH; \
 	if [ -n "${GZIP_PROG}" ]; \
diff -ruN --exclude='*~' emacs-22.3/configure emacs-22.3.patched/configure
--- emacs-22.3/configure	2008-09-05 18:21:51.000000000 +0200
+++ emacs-22.3.patched/configure	2009-09-09 13:01:41.000000000 +0200
@@ -1807,7 +1807,7 @@
 etcdir='${datadir}/emacs/${version}/etc'
 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
 docdir='${datadir}/emacs/${version}/etc'
-gamedir='${localstatedir}/games/emacs'
+gamedir='${localstatedir}/games/emacs22'
 
 gameuser=games
 
@@ -13958,9 +13958,9 @@
 fi
 { echo "$as_me:$LINENO: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5
 echo "${ECHO_T}$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; }
-if test $ac_cv_lib_ungif_EGifPutExtensionLast = yes; then
+#if test $ac_cv_lib_ungif_EGifPutExtensionLast = yes; then
   HAVE_GIF=yes
-fi
+#fi
 
 fi
 
diff -ruN --exclude='*~' emacs-22.3/fix-info emacs-22.3.patched/fix-info
--- emacs-22.3/fix-info	1970-01-01 01:00:00.000000000 +0100
+++ emacs-22.3.patched/fix-info	2009-09-09 13:01:41.000000000 +0200
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+THE_INFO_PREFIX=$1
+
+for file in ada-mode autotype calc ccmode cl dired-x ebrowse ediff efaq \
+           elisp eintr emacs emacs-mime eshell eudc flymake \
+           forms gnus idlwave info message mh-e newsticker org pcl-cvs \
+           pgg reftex sc ses sieve speedbar tramp vip viper widget \
+           woman smtpmail url rcirc erc
+do
+    ./mangle-info ${THE_INFO_PREFIX}/${file}
+done
\ No newline at end of file
diff -ruN --exclude='*~' emacs-22.3/leim/Makefile.in emacs-22.3.patched/leim/Makefile.in
--- emacs-22.3/leim/Makefile.in	2008-01-07 09:09:43.000000000 +0100
+++ emacs-22.3.patched/leim/Makefile.in	2009-09-09 13:01:41.000000000 +0200
@@ -253,7 +253,7 @@
 	    done) \
 	else true; fi
 	-chmod -R a+r ${INSTALLDIR}
-	-find ${INSTALLDIR} -exec chown $${LOGNAME:-$$USERNAME} '{}' ';'
+	-find ${INSTALLDIR} -exec chown root:admin '{}' ';'
 
 clean mostlyclean:
 	rm -f ${TIT-MISC} ${TIT-MISC:.elc=.el} \
diff -ruN --exclude='*~' emacs-22.3/lisp/startup.el emacs-22.3.patched/lisp/startup.el
--- emacs-22.3/lisp/startup.el	2008-03-06 01:08:01.000000000 +0100
+++ emacs-22.3.patched/lisp/startup.el	2009-09-09 13:01:41.000000000 +0200
@@ -291,6 +291,10 @@
 
 (defvar normal-top-level-add-subdirs-inode-list nil)
 
+(defconst fink-emacs-flavor 'emacs22
+  "A symbol representing the particular fink flavor of emacs running.
+Something like 'emacs20, 'xemacs20, etc.")
+
 (defvar no-blinking-cursor nil)
 
 (defvar default-frame-background-mode)
@@ -826,9 +830,19 @@
     ;; be loaded from site-run-file and wants to test if -q was given
     ;; should check init-file-user instead, since that is already set.
     ;; See cus-edit.el for an example.
-    (if site-run-file
-	(load site-run-file t t))
-
+    ;; (if site-run-file                                                       
+    ;;     (load site-run-file t t))                                           
+                                                                               
+    ;; Fink version of site-start.                                           
+    (if site-run-file                                                          
+ 	(progn                                                                 
+ 	  ;; Load all the fink package snippets.                             
+ 	  ;; It's in here because we want -q to kill it too.                   
+ 	  (if (load "fink-startup" t t nil)                                  
+ 	      (fink-startup fink-emacs-flavor))                            
+ 	  ;; Now the normal site file...                                       
+ 	  (load site-run-file t t nil)))
+    
     ;; Sites should not disable this.  Only individuals should disable
     ;; the startup screen.
     (setq inhibit-startup-screen nil)
diff -ruN --exclude='*~' emacs-22.3/mangle-info emacs-22.3.patched/mangle-info
--- emacs-22.3/mangle-info	1970-01-01 01:00:00.000000000 +0100
+++ emacs-22.3.patched/mangle-info	2009-09-09 13:01:41.000000000 +0200
@@ -0,0 +1,18 @@
+#!/usr/bin/perl -w -i
+
+use English;
+use strict;
+
+$RS = undef;
+
+my $prefix = "emacs-22";
+
+my $x = <>;
+if(!($x =~ m/^(\s*START-INFO-DIR-ENTRY\s+\*\s*[^:]+:\s*)\(([^\)]+)\)/mo)) {
+  die "Couldn't find START-INFO-DIR-ENTRY.";
+}
+   
+print ${PREMATCH};
+print "$1($prefix/$2)";
+print ${POSTMATCH};
+
diff -ruN --exclude='*~' emacs-22.3/src/Makefile.in emacs-22.3.patched/src/Makefile.in
--- emacs-22.3/src/Makefile.in	2008-07-11 10:52:53.000000000 +0200
+++ emacs-22.3.patched/src/Makefile.in	2009-09-09 13:01:41.000000000 +0200
@@ -441,7 +441,7 @@
 
 #if HAVE_GIF
 #ifndef LIBGIF
-#define LIBGIF -lungif
+#define LIBGIF -lgif
 #endif /* not defined LIBGIF */
 #else /* not HAVE_GIF */
 #define LIBGIF
diff -ruN --exclude='*~' emacs-22.3/src/s/darwin.h emacs-22.3.patched/src/s/darwin.h
--- emacs-22.3/src/s/darwin.h	2008-07-23 18:40:47.000000000 +0200
+++ emacs-22.3.patched/src/s/darwin.h	2009-09-09 13:20:52.000000000 +0200
@@ -351,6 +351,9 @@
 #define malloc unexec_malloc
 #define realloc unexec_realloc
 #define free unexec_free
+/* Don't use posix_memalign because it is not compatible with
+   unexmacosx.c.  */
+#undef HAVE_POSIX_MEMALIGN
 #endif
 
 /* This makes create_process in process.c save and restore signal
diff -ruN --exclude='*~' emacs-22.3/src/unexmacosx.c emacs-22.3.patched/src/unexmacosx.c
--- emacs-22.3/src/unexmacosx.c	2008-01-08 05:29:48.000000000 +0100
+++ emacs-22.3.patched/src/unexmacosx.c	2009-09-09 13:24:03.000000000 +0200
@@ -584,6 +584,14 @@
       printf ("LC_UUID          ");
       break;
 #endif
+#ifdef LC_DYLD_INFO
+    case LC_DYLD_INFO:
+      printf ("LC_DYLD_INFO     ");
+      break;
+    case LC_DYLD_INFO_ONLY:
+      printf ("LC_DYLD_INFO_ONLY");
+      break;
+#endif
     default:
       printf ("unknown          ");
     }
@@ -821,6 +829,7 @@
 	       || strncmp (sectp->sectname, "__const", 16) == 0
 	       || strncmp (sectp->sectname, "__cfstring", 16) == 0
 	       || strncmp (sectp->sectname, "__gcc_except_tab", 16) == 0
+	       || strncmp (sectp->sectname, "__program_vars", 16) == 0
 	       || strncmp (sectp->sectname, "__objc_", 7) == 0)
 	{
 	  if (!unexec_copy (sectp->offset, old_file_offset, sectp->size))
@@ -1088,6 +1097,36 @@
   curr_header_offset += lc->cmdsize;
 }
 
+#ifdef LC_DYLD_INFO
+/* Copy a LC_DYLD_INFO(_ONLY) load command from the input file to the output
+   file, adjusting the file offset fields.  */
+static void
+copy_dyld_info (struct load_command *lc, long delta)
+{
+  struct dyld_info_command *dip = (struct dyld_info_command *) lc;
+
+  if (dip->rebase_off > 0)
+    dip->rebase_off += delta;
+  if (dip->bind_off > 0)
+    dip->bind_off += delta;
+  if (dip->weak_bind_off > 0)
+    dip->weak_bind_off += delta;
+  if (dip->lazy_bind_off > 0)
+    dip->lazy_bind_off += delta;
+  if (dip->export_off > 0)
+    dip->export_off += delta;
+
+  printf ("Writing ");
+  print_load_command_name (lc->cmd);
+  printf (" command\n");
+
+  if (!unexec_write (curr_header_offset, lc, lc->cmdsize))
+    unexec_error ("cannot write dyld info command to header");
+
+  curr_header_offset += lc->cmdsize;
+}
+#endif
+
 /* Copy other kinds of load commands from the input file to the output
    file, ones that do not require adjustments of file offsets.  */
 static void
@@ -1154,6 +1193,12 @@
       case LC_TWOLEVEL_HINTS:
 	copy_twolevelhints (lca[i], linkedit_delta);
 	break;
+#ifdef LC_DYLD_INFO
+      case LC_DYLD_INFO:
+      case LC_DYLD_INFO_ONLY:
+	copy_dyld_info (lca[i], linkedit_delta);
+	break;
+#endif
       default:
 	copy_other (lca[i]);
 	break;
