diff -ur -X diff-exclude.txt /opt/local/etc/macports/macports.conf /opt/local/etc/macports/macports.conf
--- /opt/local/etc/macports/macports.conf	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/etc/macports/macports.conf	2011-02-16 17:58:17.000000000 -0800
@@ -22,7 +22,9 @@
 #binpath		/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 
 # Directory containing Xcode Tools (default is to ask xcode-select)
-#developer_dir       /Developer
+#developer_dir       /Developer/Platforms/iPhoneOS.platform/Developer
+#developer_dir       /Developer/Platforms/iPhoneSimulator.platform/Developer
+developer_dir       /Developer
 
 # Directory containing Applications from ports.
 applications_dir	/opt/local/Applications
@@ -56,10 +58,13 @@
 # CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X 10.5
 # and earlier, depending on the CPU type detected at runtime. On Mac OS X 10.6
 # the default is x86_64 if the CPU supports it, i386 otherwise.
+#build_arch			armv6
 #build_arch			i386
 
 # CPU architectures to use for Universal Binaries (+universal variant)
-universal_archs		x86_64 i386
+#universal_archs		armv6 armv7
+universal_archs		i386 x86_64
+#universal_archs		i386 x86_64 ppc ppc64
 
 # Use ccache (C/C++ compiler cache) - see http://ccache.samba.org/
 #configureccache		no
@@ -141,3 +146,19 @@
 # hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
 # and FTP, but not rsync):
 #proxy_skip            internal1, internal2, internal3
+
+use_parallel_build  yes
+
+#new cross-compiler options:
+#os_target_platform darwin.iPhoneOS.iphone 
+#os_target_platform darwin.iPhoneSimulator.iphone
+#os_target_platform darwin.macosx.pc
+
+#os_target_version 4.2
+os_target_version 10.5
+
+#configure_host_compiler clang
+
+#configure_target_compiler clang
+#configure_target_compiler macports-clang-2.0
+
diff -ur -X diff-exclude.txt /opt/local/etc/macports/macports.conf.default /opt/local/etc/macports/macports.conf.default
--- /opt/local/etc/macports/macports.conf.default	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/etc/macports/macports.conf.default	2011-01-11 13:53:04.000000000 -0800
@@ -22,7 +22,7 @@
 #binpath		/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 
 # Directory containing Xcode Tools (default is to ask xcode-select)
-#developer_dir       /Developer
+#developer_dir       /Xcode4
 
 # Directory containing Applications from ports.
 applications_dir	/opt/local/Applications
Only in /iopt: lib
Only in /iopt: sbin
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/macports1.0/macports.tcl /opt/local/share/macports/Tcl/macports1.0/macports.tcl
--- /opt/local/share/macports/Tcl/macports1.0/macports.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/macports1.0/macports.tcl	2011-01-31 16:39:53.000000000 -0800
@@ -46,7 +46,7 @@
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_deployment_target \
-        macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
+        macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip os_target_platform os_target_version configure_target_compiler os_host_platform os_host_version configure_host_compiler"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
@@ -55,7 +55,7 @@
         rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
-        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target $user_options"
+        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target os_target_platform os_target_version configure_target_compiler os_host_platform os_host_version configure_host_compiler $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -467,6 +467,16 @@
     global macports::os_platform
     global macports::macosx_version
     global macports::macosx_deployment_target
+	
+	#cross-compiling options
+	
+	global macports::os_host_platform
+	global macports::os_host_version
+	global macports::configure_host_compiler
+	global macports::os_target_platform
+	global macports::os_target_version
+	global macports::configure_target_compiler
+
 
     # Set the system encoding to utf-8
     encoding system utf-8
@@ -485,7 +495,20 @@
     if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
     set os_version $tcl_platform(osVersion)
     set os_major [lindex [split $os_version .] 0]
-    set os_platform [string tolower $tcl_platform(os)]
+    set os_platform [string tolower $tcl_platform(os)]	
+
+
+	#initialize cross-compiling options
+
+	set macports::os_host_platform ""
+	set macports::os_host_version ""
+	set macports::configure_host_compiler ""
+
+
+	set macports::os_target_platform ""
+	set macports::os_target_version ""
+	set macports::configure_target_compiler ""
+	
     # Remove trailing "Endian"
     set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
     set macosx_version {}
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/port1.0/port_autoconf.tcl /opt/local/share/macports/Tcl/port1.0/port_autoconf.tcl
--- /opt/local/share/macports/Tcl/port1.0/port_autoconf.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/port1.0/port_autoconf.tcl	2011-01-11 13:53:05.000000000 -0800
@@ -40,7 +40,7 @@
 	variable bzr_path ""
 	variable cvs_path "/usr/bin/cvs"
 	variable svn_path "/usr/bin/svn"
-	variable git_path ""
+	variable git_path "/usr/bin/git"
 	variable hg_path ""
 	variable gzip_path "/usr/bin/gzip"
 	variable lipo_path "/usr/bin/lipo"
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/port1.0/portbuild.tcl /opt/local/share/macports/Tcl/port1.0/portbuild.tcl
--- /opt/local/share/macports/Tcl/port1.0/portbuild.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/port1.0/portbuild.tcl	2011-02-16 13:47:57.000000000 -0800
@@ -150,7 +150,6 @@
     global build.cmd
 
     set jobs_suffix [build_getjobsarg]
-
     set realcmd ${build.cmd}
     set build.cmd "${build.cmd}$jobs_suffix"
     command_exec build
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl
--- /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/port1.0/portconfigure.tcl	2011-02-16 15:49:33.000000000 -0800
@@ -34,7 +34,7 @@
 package provide portconfigure 1.0
 package require portutil 1.0
 
-set org.macports.configure [target_new org.macports.configure portconfigure::configure_main]
+set org.macports.configure [target_new org.macports.configure portconfigure::private_configure_main]
 target_provides ${org.macports.configure} configure
 target_requires ${org.macports.configure} main fetch checksum extract patch
 target_prerun ${org.macports.configure} portconfigure::configure_start
@@ -123,7 +123,7 @@
 
 # Configure special environment variables.
 # We could have m32/m64/march/mtune be global configurable at some point.
-options configure.m32 configure.m64 configure.march configure.mtune
+options configure.m32 configure.m64 configure.march configure.mtune configure.host_canonical_system_type configure.target_canonical_system_type configure.target_uses_host_option
 default configure.march     {}
 default configure.mtune     {}
 # We could have debug/optimizations be global configurable at some point.
@@ -152,11 +152,14 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
-options configure.build_arch configure.ld_archflags configure.sdkroot
+options configure.build_arch configure.ld_archflags configure.sdkroot configure.host_sdkroot configure.target_sdkroot
 default configure.build_arch {[portconfigure::choose_supported_archs ${build_arch}]}
 default configure.ld_archflags {[portconfigure::configure_get_ld_archflags]}
-default configure.sdkroot {[portconfigure::configure_get_sdkroot]}
-foreach tool {cc cxx objc f77 f90 fc} {
+default configure.sdkroot {[portconfigure::configure_get_sdkroot target]}
+default configure.host_sdkroot {[portconfigure::configure_get_sdkroot host]}
+default configure.target_sdkroot {[portconfigure::configure_get_sdkroot target]}
+
+foreach tool {cc cxx cpp objc f77 f90 fc} {
     options configure.${tool}_archflags
     default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
 }
@@ -165,24 +168,65 @@
 default configure.universal_archs       {[portconfigure::choose_supported_archs ${universal_archs}]}
 default configure.universal_args        {--disable-dependency-tracking}
 default configure.universal_cflags      {[portconfigure::configure_get_universal_cflags]}
-default configure.universal_cppflags    {}
+default configure.universal_cppflags    {[portconfigure::configure_get_universal_cflags]}
 default configure.universal_cxxflags    {[portconfigure::configure_get_universal_cflags]}
 default configure.universal_ldflags     {[portconfigure::configure_get_universal_ldflags]}
 
+
+#cross-compiling support:
+#add various variables to support cross-compiling. existing variables are mapped to corresponding "target" variables.
+#modify sdkroot calculation and compiler calculations to use new variables appropriately.
+#
+#the modifications are targeted at C, C++, Objc and Objc++. non-C-language compiler variables need to be competed and tested.
+#
+#"canonical system type" is the triplet id passed to configure scripts using --host=.
+
 # Select a distinct compiler (C, C preprocessor, C++)
-options configure.ccache configure.distcc configure.pipe configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc configure.javac configure.compiler
+options configure.ccache configure.distcc configure.pipe configure.cc configure.host_cc configure.target_cc configure.cxx configure.host_cxx configure.target_cxx configure.cpp configure.host_cpp configure.target_cpp configure.objc configure.host_objc configure.target_objc configure.f77 configure.f90 configure.fc configure.javac configure.compiler configure.host_compiler configure.target_compiler
 default configure.ccache        {${configureccache}}
 default configure.distcc        {${configuredistcc}}
 default configure.pipe          {${configurepipe}}
-default configure.cc            {[portconfigure::configure_get_compiler cc]}
-default configure.cxx           {[portconfigure::configure_get_compiler cxx]}
-default configure.cpp           {[portconfigure::configure_get_compiler cpp]}
-default configure.objc          {[portconfigure::configure_get_compiler objc]}
-default configure.f77           {[portconfigure::configure_get_compiler f77]}
-default configure.f90           {[portconfigure::configure_get_compiler f90]}
-default configure.fc            {[portconfigure::configure_get_compiler fc]}
-default configure.javac         {[portconfigure::configure_get_compiler javac]}
-default configure.compiler      {[portconfigure::configure_get_default_compiler]}
+default configure.cc            {[portconfigure::configure_get_compiler target cc]}
+default configure.host_cc       {[portconfigure::configure_get_compiler host   cc]}
+default configure.target_cc     {[portconfigure::configure_get_compiler target cc]}
+default configure.target_cxx    {[portconfigure::configure_get_compiler target cxx]}
+default configure.host_cxx      {[portconfigure::configure_get_compiler host cxx]}
+default configure.cxx           {[portconfigure::configure_get_compiler target cxx]}
+default configure.cpp           {[portconfigure::configure_get_compiler target cpp]}
+default configure.host_cpp      {[portconfigure::configure_get_compiler host   cpp]}
+default configure.target_cpp    {[portconfigure::configure_get_compiler target cpp]}
+default configure.objc          {[portconfigure::configure_get_compiler target objc]}
+default configure.host_objc     {[portconfigure::configure_get_compiler host   objc]}
+default configure.target_objc   {[portconfigure::configure_get_compiler target objc]}
+default configure.f77           {[portconfigure::configure_get_compiler target f77]}
+default configure.f90           {[portconfigure::configure_get_compiler target f90]}
+default configure.fc            {[portconfigure::configure_get_compiler target fc]}
+default configure.javac         {[portconfigure::configure_get_compiler target javac]}
+
+
+if { $configure_host_compiler == "" } {
+
+	default configure.host_compiler      {[portconfigure::configure_get_default_compiler host]}
+} else {
+
+	default configure.host_compiler      ${configure_host_compiler}
+}
+
+if { $configure_target_compiler == "" } {
+
+	default configure.compiler			{[portconfigure::configure_get_default_compiler target]}
+	default configure.target_compiler   {[portconfigure::configure_get_default_compiler target]}
+} else {
+
+	default configure.compiler			${configure_target_compiler}
+	default configure.target_compiler   ${configure_target_compiler}
+}
+
+default configure.host_canonical_system_type   {[portconfigure::canonical_system_type ${os.arch} ${os.host_major_platform} ${os.host_minor_platform} ${os.host_device} ${os.host_version}]} 
+default configure.target_canonical_system_type {[portconfigure::canonical_system_type ${build_arch} ${os.target_major_platform} ${os.target_minor_platform} ${os.target_device} ${os.target_version}]}
+
+default configure.target_uses_host_option {yes}
+
 
 set_ui_prefix
 
@@ -210,6 +254,9 @@
         macports-gcc-4.3 { set name "MacPorts gcc 4.3" }
         macports-gcc-4.4 { set name "MacPorts gcc 4.4" }
         macports-gcc-4.5 { set name "MacPorts gcc 4.5" }
+		
+		#add proof-of-concept support for clang 2
+		macports-clang-2.0 { set name "MacPorts clang 2" }
         default { return -code error "Invalid value for configure.compiler" }
     }
     ui_debug "Using compiler '$name'"
@@ -241,6 +288,17 @@
     return $ret
 }
 
+proc portconfigure::canonical_system_type {theArchName theMajorPlatformName theMinorPlatformName theDeviceName theMajorPlatformVersion} {
+
+	#hardcode to apple systems since macports is currently apple specific. One could invoke config.guess to get a generic
+	# type id for the host system.
+	
+	set tmpResult "${theArchName}-apple-${theMajorPlatformName}${theMajorPlatformVersion}"
+	return $tmpResult
+}
+
+
+
 # internal function to determine the compiler flags to select an arch
 proc portconfigure::configure_get_archflags {tool} {
     global configure.build_arch configure.m32 configure.m64 configure.compiler
@@ -250,7 +308,8 @@
     } elseif {[tbool configure.m32]} {
         set flags "-m32"
     } elseif {${configure.build_arch} != ""} {
-        if {[arch_flag_supported] && ($tool == "cc" || $tool == "cxx" || $tool == "objc")} {
+	
+        if {[arch_flag_supported] && ($tool == "cc" || $tool == "cxx" || $tool == "cpp" || $tool == "objc")} {
             set flags "-arch ${configure.build_arch}"
         } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
             set flags "-m64"
@@ -274,19 +333,56 @@
     }
 }
 
-proc portconfigure::configure_get_sdkroot {} {
-    global developer_dir macosx_deployment_target macosx_version os.arch os.platform
-    if {${os.platform} == "darwin" && ($macosx_deployment_target != $macosx_version
-        || (${os.arch} == "powerpc" && $macosx_version == "10.4" && [variant_exists universal] && [variant_isset universal]))} {
+proc portconfigure::configure_get_sdkroot {thePlatformChoice} {
+    global developer_dir macosx_deployment_target macosx_version os.arch os.platform os.target_is_apple_platform os.target_apple_sdk_name os.host_major_platform os.target_major_platform os.host_minor_platform os.target_minor_platform os.host_is_apple_platform
+
+	
+	set tmpMajorOSPlatform ""
+	set tmpMinorPlatform ""
+	set tmpIsApplePlatform no
+	
+	if { $thePlatformChoice == "host" } {
+	
+		set tmpMajorOSPlatform ${os.host_major_platform}
+		set tmpIsApplePlatform ${os.host_is_apple_platform}
+		set tmpMinorPlatform ${os.host_minor_platform}
+		
+	} elseif {$thePlatformChoice == "target" } {
+		
+		set tmpMajorOSPlatform ${os.target_major_platform}
+		set tmpIsApplePlatform ${os.target_is_apple_platform}
+		set tmpMinorPlatform ${os.target_minor_platform}
+	
+	} else {
+	
+		return ""
+	}
+	
+	
+	if {${tmpMajorOSPlatform} != "darwin" || ${tmpIsApplePlatform} == no } {
+		return ""
+	}
+
+	set sdk ""
+	
+	if { ${tmpMinorPlatform} != "macosx" } {
+	
+		set sdk "${developer_dir}/SDKs/${os.target_apple_sdk_name}.sdk"
+		
+	} elseif {$macosx_deployment_target != $macosx_version || (${os.arch} == "powerpc" && $macosx_version == "10.4" && [variant_exists universal] && [variant_isset universal])} {
         if {$macosx_deployment_target == "10.4"} {
             set sdk "${developer_dir}/SDKs/MacOSX10.4u.sdk"
         } else {
             set sdk "${developer_dir}/SDKs/MacOSX${macosx_deployment_target}.sdk"
         }
-        if {[file exists $sdk]} {
-            return $sdk
-        }
+
     }
+
+	
+	if {[file exists $sdk]} {
+		return $sdk
+	}	
+	
     return ""
 }
 
@@ -317,11 +413,15 @@
 # internal proc to determine if the compiler supports -arch
 proc portconfigure::arch_flag_supported {args} {
     global configure.compiler
-    switch -exact ${configure.compiler} {
+    
+	#add proof-of-concept support for clang 2
+	
+	switch -exact ${configure.compiler} {
         gcc-4.0 -
         gcc-4.2 -
         llvm-gcc-4.2 -
         clang -
+		macports-clang-2.0 -
         apple-gcc-4.0 -
         apple-gcc-4.2 {
             return yes
@@ -333,8 +433,29 @@
 }
 
 # internal function to determine the default compiler
-proc portconfigure::configure_get_default_compiler {args} {
-    global macosx_deployment_target
+proc portconfigure::configure_get_default_compiler {thePlatformChoice} {
+    global macosx_deployment_target os.host_minor_platform os.target_minor_platform
+
+
+	set tmpMinorPlatform ""
+	
+	if { $thePlatformChoice == "host" } {
+	
+		set tmpMinorPlatform ${os.host_minor_platform}
+		
+	} elseif {$thePlatformChoice == "target" } {
+		
+		set tmpMinorPlatform ${os.target_minor_platform}
+	
+	} else {
+	
+		return ""
+	}
+
+	if { ${tmpMinorPlatform} == "iPhoneOS" || ${tmpMinorPlatform} == "iPhoneSimulator" } {
+		return llvm-gcc-4.2
+	}
+	
     switch -exact ${macosx_deployment_target} {
         "10.4"      -
         "10.5"      { return gcc-4.0 }
@@ -345,10 +466,32 @@
 }
 
 # internal function to find correct compilers
-proc portconfigure::configure_get_compiler {type} {
-    global configure.compiler prefix developer_dir
-    set ret ""
-    switch -exact ${configure.compiler} {
+proc portconfigure::configure_get_compiler {thePlatformChoice type} {
+    global configure.host_compiler configure.target_compiler prefix developer_dir
+    
+	
+	set tmpCompilerName ""
+	
+	if { $thePlatformChoice == "host" } {
+	
+		set tmpCompilerName ${configure.host_compiler}
+		
+	} elseif {$thePlatformChoice == "target" } {
+		
+		set tmpCompilerName ${configure.target_compiler}
+	
+	} else {
+	
+		return ""
+	}
+	
+	set ret ""
+	
+	#note: to supports cross compiling with a macports compiler on a host-based copy of macports, 
+	#the compiler location should be based on a new variable rather than $prefix. perhaps: 
+	#$host_macports_prefix
+	
+    switch -exact ${tmpCompilerName} {
         gcc {
             switch -exact ${type} {
                 cc   { set ret /usr/bin/gcc }
@@ -393,6 +536,8 @@
             switch -exact ${type} {
                 cc   { set ret ${developer_dir}/usr/bin/clang }
                 objc { set ret ${developer_dir}/usr/bin/clang }
+				cxx  { set ret ${developer_dir}/usr/bin/clang }
+				cpp  { set ret ${developer_dir}/usr/bin/clang }
             }
         }
         apple-gcc-3.3 {
@@ -495,17 +640,55 @@
                 f90  { set ret ${prefix}/bin/gfortran-mp-4.5 }
             }
         }
+		macports-clang-2.0 {
+			#add proof-of-concept support for clang 2
+		
+            switch -exact ${type} {
+                cc   { set ret /opt/bin/clang }
+                objc { set ret /opt/bin/clang }
+                cxx  { set ret /opt/bin/clang++ }
+                cpp  { set ret /opt/bin/clang }
+            }
+		}
     }
     return $ret
 }
 
+proc portconfigure::private_configure_main {args} {
+	global use_configure os.cross_compile_required_for_target configure.target_canonical_system_type configure.target_uses_host_option
+	#called internally. add in --host support if cross-compiling
+
+	if {[tbool use_configure] && ${configure.target_uses_host_option} == yes && ${os.cross_compile_required_for_target} == yes } {
+
+		configure.args-append  "--host=${configure.target_canonical_system_type}"
+	} 
+	
+	if {[variant_exists universal] && [variant_isset universal]} {
+	
+		global configure.universal_cflags configure.universal_cxxflags configure.universal_cppflags configure.universal_ldflags configure.universal_args
+		
+		foreach flags {CFLAGS OBJCFLAGS} {
+			append_list_to_environment_value configure $flags ${configure.universal_cflags}
+		}
+		
+		append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
+		append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
+		append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
+		eval configure.pre_args-append ${configure.universal_args}
+	}
+
+	portconfigure::configure_main $args
+}
+
 proc portconfigure::configure_main {args} {
     global [info globals]
     global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
-    global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
+    global configure.env configure.pipe configure.libs configure.classpath configure.universal_args configure.target_sdkroot
     global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
     global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune configure.sdkroot
-    foreach tool {cc cxx objc f77 f90 fc ld} {
+	global os.cross_compile_required_for_target configure.target_canonical_system_type
+	
+	foreach tool {cc cxx cpp objc f77 f90 fc ld} {
         global configure.${tool} configure.${tool}_archflags
     }
     foreach flags {cflags cppflags cxxflags objcflags ldflags fflags f90flags fcflags} {
@@ -539,6 +722,7 @@
             system "cd ${worksrcpath} && make Makefiles"
         }
     } elseif {[tbool use_configure]} {
+	
         # Merge (ld|c|cpp|cxx)flags into the environment variable.
         parse_environment configure
 
@@ -589,6 +773,7 @@
         append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
 
         # add SDK flags if cross-compiling (or universal on ppc tiger)
+
         if {${configure.sdkroot} != ""} {
             foreach flags {CPPFLAGS CFLAGS CXXFLAGS OBJCFLAGS} {
                 append_list_to_environment_value configure $flags "-isysroot ${configure.sdkroot}"
@@ -598,22 +783,21 @@
 
         # add extra flags that are conditional on whether we're building universal
         if {[variant_exists universal] && [variant_isset universal]} {
-            foreach flags {CFLAGS OBJCFLAGS} {
-                append_list_to_environment_value configure $flags ${configure.universal_cflags}
-            }
-            append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
-            append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
-            append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
-            eval configure.pre_args-append ${configure.universal_args}
+		
+			
         } else {
-            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
-                append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
+		
+		
+            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS cpp CPPFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
+			
+				append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
                 if {${configure.march} != {}} {
                     append_list_to_environment_value configure $flags "-march=${configure.march}"
                 }
                 if {${configure.mtune} != {}} {
                     append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
                 }
+				
             }
         }
 
@@ -624,3 +808,6 @@
     }
     return 0
 }
+
+
+
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/port1.0/portmain.tcl /opt/local/share/macports/Tcl/port1.0/portmain.tcl
--- /opt/local/share/macports/Tcl/port1.0/portmain.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/port1.0/portmain.tcl	2011-02-15 17:29:07.000000000 -0800
@@ -43,10 +43,11 @@
 namespace eval portmain {
 }
 
+
 # define options
 options prefix name version revision epoch categories maintainers
 options long_description description homepage notes license provides conflicts replaced_by
-options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.subplatform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
+options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.subplatform os.version os.major os.arch os.endian os.target_platform os.target_version os.host_platform os.cross_compile_required_for_target os.target_is_apple_platform os.target_major_platform os.target_minor_platform os.target_device os.target_apple_sdk_name os.host_is_apple_platform os.host_major_platform os.host_minor_platform os.host_device platforms default_variants install.user install.group macosx_deployment_target
 options universal_variant os.universal_supported
 options supported_archs depends_skip_archcheck
 options copy_log_files
@@ -94,6 +95,7 @@
 default os.arch {$os_arch}
 default os.endian {$os_endian}
 
+
 set macosx_version_text {}
 if {[option os.platform] == "darwin"} {
     set macosx_version_text "(Mac OS X ${macosx_version}) "
@@ -112,11 +114,247 @@
         default os.subplatform puredarwin
         default os.universal_supported no
     }
+	
 } else {
     default os.subplatform {}
     default os.universal_supported no
 }
 
+#beginning of cross-compiling support variables
+#
+#variables are set up with a host/target symmetry.
+
+#design choice:  piggy-back new variables on top of existing variables so that existing ports won't be broken. 
+#					price:  portfiles must be modified to support cross-compiling.
+
+
+if {$os_host_platform == ""} {
+
+	if { ${os.subplatform} != ""} {
+
+		if { ${os.subplatform} == "macosx" } {
+
+			#macosx running on a Personal Computer
+			default os.host_platform ${os_platform}.${os.subplatform}.pc
+			
+		} else {
+		
+			default os.host_platform ${os_platform}.${os.subplatform}
+		}
+	} else {
+
+		default os.host_platform ${os_platform}
+	}
+	
+} else {
+
+	default os.host_platform {$os_host_platform}
+}
+
+
+if {$os_target_platform == ""} {
+
+	if { ${os.subplatform} != ""} {
+
+		if { ${os.subplatform} == "macosx" } {
+		
+			#macosx running on a Personal Computer
+			default os.target_platform ${os_platform}.${os.subplatform}.pc
+			
+		} else {
+		
+			default os.target_platform ${os_platform}.${os.subplatform}
+		}
+	} else {
+	
+		default os.target_platform ${os_platform}
+	}
+
+} else {
+	default os.target_platform {$os_target_platform}
+}
+
+
+if {$os_host_version == ""} {
+
+	default os.host_version {$macosx_deployment_target}	
+} else {
+
+	default os.host_version {$os_host_version}
+}
+
+if {$os_target_version == ""} {
+
+	default os.target_version {$macosx_deployment_target}	
+} else {
+
+	default os.target_version {$os_target_version}
+	
+	#if os_target_version is supplied, override macosx_deployment_target
+	set macosx_deployment_target $os_target_version
+}
+
+if { ${os.subplatform} != ""} {
+	
+	if { ${os.subplatform} == "macosx" } {
+	
+		#macosx running on a Personal Computer
+		default os.host_platform ${os.platform}.${os.subplatform}.pc
+		
+	} else {
+	
+		default os.host_platform ${os.platform}.${os.subplatform}
+	}
+	
+} else {
+
+	default os.host_platform ${os.platform}
+}
+
+
+
+if { ${os.host_platform} != ${os.target_platform} } {
+
+	default os.cross_compile_required_for_target yes
+
+} else {
+
+	default os.cross_compile_required_for_target no
+}
+
+
+
+#'yes' if the host os is an apple os and follows the normal apple conventions for sdk placement.
+if {		[string first "darwin.macosx"          ${os.host_platform}] != -1 
+		||	[string first "darwin.iPhoneOS"        ${os.host_platform}] != -1 
+		||	[string first "darwin.iPhoneSimulator" ${os.host_platform}] != -1 } {
+
+	default os.host_is_apple_platform yes
+
+} else {
+	default os.host_is_apple_platform no
+}
+
+#'yes' if the host os is an apple os and follows the normal apple conventions for sdk placement.
+if {		[string first "darwin.macosx"          ${os.host_platform}] != -1 
+		||	[string first "darwin.iPhoneOS"        ${os.host_platform}] != -1 
+		||	[string first "darwin.iPhoneSimulator" ${os.host_platform}] != -1 } {
+
+	default os.host_is_apple_platform yes
+
+} else {
+	default os.host_is_apple_platform no
+}
+
+
+
+#'yes' if the target os is an apple os and follows the normal apple conventions for sdk placement.
+if {		[string first "darwin.macosx"          ${os.target_platform}] != -1 
+		||	[string first "darwin.iPhoneOS"        ${os.target_platform}] != -1 
+		||	[string first "darwin.iPhoneSimulator" ${os.target_platform}] != -1 } {
+
+	default os.target_is_apple_platform yes
+
+} else {
+	default os.target_is_apple_platform no
+}
+
+#'yes' if the target os is an apple os and follows the normal apple conventions for sdk placement.
+if {		[string first "darwin.macosx"          ${os.target_platform}] != -1 
+		||	[string first "darwin.iPhoneOS"        ${os.target_platform}] != -1 
+		||	[string first "darwin.iPhoneSimulator" ${os.target_platform}] != -1 } {
+
+	default os.target_is_apple_platform yes
+
+} else {
+	default os.target_is_apple_platform no
+}
+
+
+set host_platform_components [split ${os.host_platform} "."]
+
+
+set host_platform_component_count [llength $host_platform_components]
+
+
+
+if { $host_platform_component_count == 3 } {
+
+	default os.host_major_platform {[lindex ${host_platform_components} 0]}
+	default os.host_minor_platform {[lindex ${host_platform_components} 1]}
+	default os.host_device {[lindex ${host_platform_components} 2]}
+} elseif { $host_platform_component_count == 2 } {
+
+	default os.host_major_platform [lindex ${host_platform_components} 0]
+	default os.host_minor_platform [lindex ${host_platform_components} 1]
+	default os.host_device ""
+} else {
+
+	#ui_error "invalid host platform specifier"
+	return -code error "invalid host platform specifier"
+}
+
+
+set target_platform_components [split ${os.target_platform} "."]
+
+set target_platform_component_count [llength $target_platform_components]
+
+
+
+if { $target_platform_component_count == 3 } {
+
+	default os.target_major_platform {[lindex ${target_platform_components} 0]}
+	default os.target_minor_platform {[lindex ${target_platform_components} 1]}
+	default os.target_device {[lindex ${target_platform_components} 2]}
+} elseif { $target_platform_component_count == 2 } {
+
+	default os.target_major_platform [lindex ${target_platform_components} 0]
+	default os.target_minor_platform [lindex ${target_platform_components} 1]
+	default os.target_device ""
+} else {
+
+	#ui_error "invalid target platform specifier"
+	return -code error "invalid target platform specifier"
+}
+
+
+
+if { ${os.host_is_apple_platform} == no } {
+	default os.host_apple_sdk_name ""
+} elseif { ${os.host_minor_platform} == "macosx"} {
+	
+	set tmp10_4u ""
+	
+	if { ${os.host_version} == "10.4" } {
+		set tmp10_4u "u"
+	}
+	
+	default os.host_apple_sdk_name MacOSX${os.host_version}$tmp10_4u
+} else {
+
+	default os.host_apple_sdk_name ${os.host_minor_platform}${os.host_version}
+}
+
+
+if { ${os.target_is_apple_platform} == no } {
+	default os.target_apple_sdk_name ""
+} elseif { ${os.target_minor_platform} == "macosx"} {
+
+	set tmp10_4u ""
+	
+	if { ${os.host_version} == "10.4" } {
+		set tmp10_4u "u"
+	}
+	
+	default os.target_apple_sdk_name MacOSX${os.target_version}$tmp10_4u
+} else {
+
+	default os.target_apple_sdk_name ${os.target_minor_platform}${os.target_version}
+}
+
+#end of cross-compiling support variables
+
+
 default compiler.cpath {${prefix}/include}
 default compiler.library_path {${prefix}/lib}
 
diff -ur -X diff-exclude.txt /opt/local/share/macports/Tcl/port1.0/portutil.tcl /opt/local/share/macports/Tcl/port1.0/portutil.tcl
--- /opt/local/share/macports/Tcl/port1.0/portutil.tcl	2012-01-30 18:19:41.000000000 -0800
+++ /opt/local/share/macports/Tcl/port1.0/portutil.tcl	2011-02-16 13:37:27.000000000 -0800
@@ -328,7 +328,7 @@
 # command_prefix    additional command prefix (typically pipe command)
 # command_suffix    additional command suffix (typically redirection)
 proc command_exec {command args} {
-    global ${command}.env ${command}.env_array ${command}.nice env macosx_version
+    global ${command}.env ${command}.env_array ${command}.nice env macosx_version os.target_minor_platform os.host_version os.target_version
     set notty ""
     set command_prefix ""
     set command_suffix ""
@@ -355,9 +355,31 @@
     if {![array exists ${command}.env_array]} {
         parse_environment ${command}
     }
-    if {[option macosx_deployment_target] ne ""} {
-        set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
-    }
+    
+
+	if { ${os.target_minor_platform} == "macosx" && [option macosx_deployment_target] ne ""} {
+        
+		set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
+    } elseif { ${os.target_minor_platform} == "iPhoneOS" } {
+	
+		set ${command}.env_array(IPHONEOS_DEPLOYMENT_TARGET) ${os.target_version}
+	} elseif {${os.target_minor_platform} == "iPhoneSimulator" } {
+	
+		set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) ${os.host_version}
+	}
+	
+    #if {[option macosx_deployment_target] ne ""} {
+	#
+	#	if {[option macosx_deployment_target] == "iOS42"} {
+	#		set ${command}.env_array(IPHONEOS_DEPLOYMENT_TARGET) "4.2"
+	#	} elseif {[option macosx_deployment_target] == "iOS42s"} {
+	#		set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) "10.6"
+	#	} else {
+	#		set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
+	#	}
+    #}
+	
+	
     set ${command}.env_array(CC_PRINT_OPTIONS) "YES"
     set ${command}.env_array(CC_PRINT_OPTIONS_FILE) [file join [option workpath] ".CC_PRINT_OPTIONS"]
     if {[option compiler.cpath] ne ""} {
@@ -387,7 +409,10 @@
     array set env [array get ${command}.env_array]
     # Call the command.
     set fullcmdstring "$command_prefix $cmdstring $command_suffix"
-    set code [catch {eval system $notty $nice \$fullcmdstring} result]
+	
+	#puts "fullcmdstring:${fullcmdstring}"
+    
+	set code [catch {eval system $notty $nice \$fullcmdstring} result]
 
     # Unset the command array until next time.
     array unset ${command}.env_array
Only in /opt/local/var/macports: sources
