Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/Portfile
===================================================================
diff --git a/trunk/dports/lang/chicken/Portfile b/trunk/dports/lang/chicken/Portfile
--- a/trunk/dports/lang/chicken/Portfile	(revision 103230)
+++ b/trunk/dports/lang/chicken/Portfile	(working copy)
@@ -4,8 +4,7 @@
 PortSystem 1.0
 
 name		chicken
-version		4.7.0
-revision	2
+version		4.8.0.1
 categories	lang scheme
 license         BSD public-domain
 maintainers	gmail.com:arto.bendiken gmail.com:ivan.g.raikov
@@ -17,51 +16,68 @@
 	enhancements and extensions.
 homepage	http://www.call-with-current-continuation.org/
 platforms	darwin
-master_sites	http://code.call-cc.org/releases/${version}
 
-checksums           md5     9389388fdf04c3c64de29633aae12539 \
-                    sha1    504036951eccda7680547dae63ad44e8960d3f72 \
-                    rmd160  421f6e7383a666b836a7ad9d5ac342c8033bfff6
-
-patchfiles	patch-Makefile.macosx \
-            eval.c.patch \
-            clang.patch
-
-post-patch {
-    # use full path with dlopen (#28617)
-    # this is ugly because we can't edit the scheme source (we'd need to
-    # already have the compiler) and the generated C uses an octal length
-    # prefix for strings.
-    set len [expr [string length ${prefix}] + [string length "/lib/libchicken"]]
-    reinplace "s|031__PREFIX__|[format %03o $len]${prefix}|" ${worksrcpath}/eval.c
+# Restrict universal variant to Tiger and Leopard because upstream only
+# supports i386/ppc universal binaries. Define this up here, before
+# get_canonical_archflags is called.
+if {${os.platform} == "darwin" && ${os.major} < 10} {
+    variant universal {}
 }
 
-# https://trac.macports.org/ticket/32298
-compiler.whitelist-append gcc-4.2 apple-gcc-4.2 gcc-4.0
+set branch [join [lrange [split ${version} .] 0 2] .]
+master_sites	http://code.call-cc.org/releases/${branch}
 
-# TODO: base should do this: http://trac.macports.org/ticket/32542
-if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
-    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
+checksums	rmd160  8a784006e94ea8144664ce3740f88b7a0572619e \
+		sha256  a60efa9d2a621ecb9e03b41ebdd03ae27ecb32c1292671fd969506c9baf88d0c
 
-    # base 2.1.x ignores the argument and just use ${configure.compiler}
-    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
-        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
-    }
-
-    if {[string match macports-gcc* ${configure.compiler}]} {
-        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
-    }
+# Use the correct architecture and SDK flags.
+patchfiles	patch-Makefile.macosx.diff \
+		patch-rules.make.diff
+post-patch {
+    reinplace "s/__MP_ARCH_CFLAGS__/[get_canonical_archflags cc]/" \
+        Makefile.macosx rules.make
+    reinplace "s/__MP_ARCH_LDFLAGS__/[get_canonical_archflags ld]/" \
+        Makefile.macosx
+    reinplace "s/__MP_SDK_CFLAGS__/-isysroot ${configure.sdkroot}/" \
+        Makefile.macosx
+    reinplace "s/__MP_SDK_LDFLAGS__/-Wl,-syslibroot,${configure.sdkroot}/" \
+        Makefile.macosx
 }
 
 use_configure	no
-use_parallel_build no
 
+# Upstream explicitly requires GNU make.
+build.type	gnu
 build.args	C_COMPILER=${configure.cc} \
+		CXX_COMPILER=${configure.cxx} \
 		PLATFORM=macosx \
 		PREFIX=${prefix}
+# Upstream does not support parallel builds.
+use_parallel_build no
 
-if {"x86_64" == ${configure.build_arch}} {
-    build.args-append ARCH=x86-64
+# Force build system to respect build_arch; otherwise it chooses
+# architecture using uname.
+if {[variant_isset universal]} {
+    if {${os.major} == 9} {
+        macosx_deployment_target    10.4
+    }
+    build.args-append               ARCH=universal
+} else {
+    switch -glob ${configure.build_arch} {
+        i386 {
+            build.args-append       ARCH=x86
+        }
+        x86_64 {
+            build.args-append       ARCH=x86-64
+        }
+        ppc* {
+            if {${os.platform} == "darwin"} {
+                build.args-append   ARCH=ppc.darwin
+            } else {
+                build.args-append   ARCH=ppc.sysv
+            }
+        }
+    }
 }
 
 destroot.args	${build.args}
Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/files/clang.patch
===================================================================
diff --git a/trunk/dports/lang/chicken/files/clang.patch b/trunk/dports/lang/chicken/files/clang.patch
deleted file mode 10644
--- a/trunk/dports/lang/chicken/files/clang.patch	(revision 103230)
+++ /dev/null	(working copy)
@@ -1,15 +0,0 @@
---- chicken.h.orig	2013-01-30 00:22:08.000000000 -0800
-+++ chicken.h	2013-01-30 00:22:10.000000000 -0800
-@@ -226,11 +226,7 @@ void *alloca ();
- # ifndef __cplusplus
- #  define C_cblock                ({
- #  define C_cblockend             })
--#  ifdef __clang__
--#   define C_noret
--#  else
--#   define C_noret                __attribute__ ((noreturn))
--#  endif
-+#  define C_noret                __attribute__ ((noreturn))
- #  define C_noret_decl(name)
- #  define C_aligned               __attribute__ ((aligned))
- # endif
Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/files/eval.c.patch
===================================================================
diff --git a/trunk/dports/lang/chicken/files/eval.c.patch b/trunk/dports/lang/chicken/files/eval.c.patch
deleted file mode 10644
--- a/trunk/dports/lang/chicken/files/eval.c.patch	(revision 103230)
+++ /dev/null	(working copy)
@@ -1,11 +0,0 @@
---- eval.c.orig	2011-05-24 19:19:11.000000000 +1000
-+++ eval.c	2012-02-16 13:48:39.000000000 +1100
-@@ -3522,7 +3522,7 @@
- lf[214]=C_h_intern(&lf[214],26,"\003sysload-library-extension");
- lf[215]=C_h_intern(&lf[215],6,"cygwin");
- lf[216]=C_decode_literal(C_heaptop,"\376\003\000\000\002\376B\000\000\014cygchicken-0\376\377\016");
--lf[217]=C_decode_literal(C_heaptop,"\376\003\000\000\002\376B\000\000\012libchicken\376\377\016");
-+lf[217]=C_decode_literal(C_heaptop,"\376\003\000\000\002\376B\000\000\031__PREFIX__/lib/libchicken\376\377\016");
- lf[218]=C_h_intern(&lf[218],34,"\003sysdefault-dynamic-load-libraries");
- lf[219]=C_h_intern(&lf[219],22,"dynamic-load-libraries");
- lf[220]=C_h_intern(&lf[220],13,"string-append");
Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/files/patch-Makefile.macosx
===================================================================
diff --git a/trunk/dports/lang/chicken/files/patch-Makefile.macosx b/trunk/dports/lang/chicken/files/patch-Makefile.macosx
deleted file mode 10644
--- a/trunk/dports/lang/chicken/files/patch-Makefile.macosx	(revision 103230)
+++ /dev/null	(working copy)
@@ -1,11 +0,0 @@
---- Makefile.macosx.orig	2011-10-08 22:44:42.000000000 -0400
-+++ Makefile.macosx	2011-10-08 22:45:09.000000000 -0400
-@@ -51,7 +51,7 @@
- C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
- endif
- endif
--LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dynamiclib -compatibility_version 1 -current_version 1.0 -install_name $@
-+LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dynamiclib -compatibility_version 1 -current_version 1.0 -install_name ${LIBDIR}/$@
- POSTINSTALL_PROGRAM_FLAGS = -change lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO) $(LIBDIR)/lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)
- LIBRARIAN_OPTIONS = scru
- LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -bundle -L.
Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/files/patch-Makefile.macosx.diff
===================================================================
diff --git a/trunk/dports/lang/chicken/files/patch-Makefile.macosx b/trunk/dports/lang/chicken/files/patch-Makefile.macosx.diff
copy from trunk/dports/lang/chicken/files/patch-Makefile.macosx
copy to trunk/dports/lang/chicken/files/patch-Makefile.macosx.diff
--- a/trunk/dports/lang/chicken/files/patch-Makefile.macosx	(revision 0)
+++ b/trunk/dports/lang/chicken/files/patch-Makefile.macosx.diff	(working copy)
@@ -1,11 +1,24 @@
---- Makefile.macosx.orig	2011-10-08 22:44:42.000000000 -0400
-+++ Makefile.macosx	2011-10-08 22:45:09.000000000 -0400
-@@ -51,7 +51,7 @@
- C_COMPILER_OPTIMIZATION_OPTIONS ?= -Os -fomit-frame-pointer
+--- Makefile.macosx.orig	2013-01-08 22:57:09.000000000 -0500
++++ Makefile.macosx	2013-02-19 13:37:08.000000000 -0500
+@@ -69,16 +69,17 @@
+ 
+ # architectures
+ 
++C_COMPILER_OPTIONS += __MP_ARCH_CFLAGS__
++LINKER_OPTIONS += __MP_ARCH_LDFLAGS__
++
+ ifeq ($(ARCH),x86-64)
+-C_COMPILER_OPTIONS += -m64
+-LINKER_OPTIONS += -m64
+ # Avoid bus error in install_name_tool
+ LINKER_LINK_SHARED_DLOADABLE_OPTIONS += -Wl,-headerpad -Wl,128
+ else
+ 
+ ifeq ($(ARCH),universal)
+-C_COMPILER_OPTIONS += -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
+-LINKER_OPTIONS += -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
++C_COMPILER_OPTIONS += __MP_SDK_CFLAGS__
++LINKER_OPTIONS += __MP_SDK_LDFLAGS__
  endif
+ 
  endif
--LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dynamiclib -compatibility_version 1 -current_version 1.0 -install_name $@
-+LINKER_LINK_SHARED_LIBRARY_OPTIONS = -dynamiclib -compatibility_version 1 -current_version 1.0 -install_name ${LIBDIR}/$@
- POSTINSTALL_PROGRAM_FLAGS = -change lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO) $(LIBDIR)/lib$(PROGRAM_PREFIX)chicken$(PROGRAM_SUFFIX)$(SO)
- LIBRARIAN_OPTIONS = scru
- LINKER_LINK_SHARED_DLOADABLE_OPTIONS = -bundle -L.
Index: /Users/larryv/Projects/MacPorts/trunk/dports/lang/chicken/files/patch-rules.make.diff
===================================================================
diff --git a/trunk/dports/lang/chicken/files/patch-rules.make.diff b/trunk/dports/lang/chicken/files/patch-rules.make.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/lang/chicken/files/patch-rules.make.diff	(working copy)
@@ -0,0 +1,11 @@
+--- rules.make.orig	2013-01-08 22:57:09.000000000 -0500
++++ rules.make	2013-02-19 13:49:24.000000000 -0500
+@@ -181,7 +181,7 @@
+ 
+ ifneq ($(HACKED_APPLY),)
+ $(APPLY_HACK_OBJECT): $(SRCDIR)apply-hack.$(ARCH)$(ASM)
+-	$(ASSEMBLER) $(ASSEMBLER_OPTIONS) $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
++	$(ASSEMBLER) __MP_ARCH_CFLAGS__ $(ASSEMBLER_OPTIONS) $(ASSEMBLER_COMPILE_OPTION) $< $(ASSEMBLER_OUTPUT)
+ endif
+ 
+ # program objects
