[47439] trunk/dports/devel/ncursesw/Portfile

mcalhoun at macports.org mcalhoun at macports.org
Fri Feb 27 20:23:16 PST 2009


Revision: 47439
          http://trac.macports.org/changeset/47439
Author:   mcalhoun at macports.org
Date:     2009-02-27 20:23:16 -0800 (Fri, 27 Feb 2009)
Log Message:
-----------
ncursesw: Allow cross-compiled build to find and run a valid program tic.
Attempt to fix #18675.

Modified Paths:
--------------
    trunk/dports/devel/ncursesw/Portfile

Modified: trunk/dports/devel/ncursesw/Portfile
===================================================================
--- trunk/dports/devel/ncursesw/Portfile	2009-02-28 04:13:42 UTC (rev 47438)
+++ trunk/dports/devel/ncursesw/Portfile	2009-02-28 04:23:16 UTC (rev 47439)
@@ -39,11 +39,59 @@
 
 if {[variant_isset universal]} {
 	pre-fetch {
-		global merger_dont_diff
-		# This test must be done in pre-fetch because it is the earliest stage in which universal_archs_to_use has the correct values.
+		global merger_dont_diff merger_destroot_env
+
+		# These tests must be done in pre-fetch because it is the earliest stage in which universal_archs_to_use has the correct values.
 		if { [llength ${universal_archs_to_use}] > 2 } {
 			lappend merger_dont_diff ${prefix}/include/${name}/curses.h
 		}
+
+		# The destroot phase needs to run the just built tic program.
+		#     Setting the PATH variable allows tic to be found.
+		#     tic links against shared libraries, which are found only after setting DYLD_LIBRARY_PATH.
+		set need_cross  "no"
+		set have_run    "no"
+		if { ${os.arch}=="i386" } {
+			# Determine if any cross-compiling is required.
+			foreach arch ${universal_archs_to_use} {
+				if { ${arch}=="ppc64" || (${os.major} >= 10 && ${arch}=="ppc") } {
+					set need_cross "yes"
+				}
+			}
+
+			# Find an architecture whose binaries will run on this platform.
+			foreach arch ${universal_archs_to_use} {
+				if { ${arch}=="i386" || ${arch}=="x86_64" || (${os.major} < 10 && ${arch}=="ppc") } {
+					if { ${os.major} >= 10 } {
+						set merger_destroot_env(ppc)     "DYLD_LIBRARY_PATH=${workpath}/${arch}/lib PATH=${workpath}/${arch}/progs:$env(PATH)"
+					}
+					set merger_destroot_env(ppc64)    "DYLD_LIBRARY_PATH=${workpath}/${arch}/lib PATH=${workpath}/${arch}/progs:$env(PATH)"
+					set have_run  "yes"
+					break
+				}
+			}
+		} else {
+			# Determine if any cross-compiling is required
+			foreach arch ${universal_archs_to_use} {
+				if { ${arch}=="i386" || ${arch}=="x86_64" } {
+					set need_cross "yes"
+				}
+			}
+
+			# Find an architecture whose binaries will run on this platform.
+			foreach arch ${universal_archs_to_use} {
+				if { ${arch}=="ppc" || ${arch}=="ppc64" } {
+					set merger_destroot_env(i386)    "DYLD_LIBRARY_PATH=${workpath}/${arch}/lib PATH=${workpath}/${arch}/progs:$env(PATH)"
+					set merger_destroot_env(x86_64)  "DYLD_LIBRARY_PATH=${workpath}/${arch}/lib PATH=${workpath}/${arch}/progs:$env(PATH)"
+					set have_run  "yes"
+					break
+				}
+			}
+		}
+
+		if { ${need_cross}=="yes" && ${have_run}=="no" } {
+			return -code error "At least one of the universal_archs values must run on your host architecture."
+		}
 	}
 
 	# When cross-compiling, force configure script to assume file system is the same on build and host architectures.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090227/61a653e4/attachment.html>


More information about the macports-changes mailing list