[23968] trunk/base

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 13 20:34:34 PDT 2007


Revision: 23968
          http://trac.macosforge.org/projects/macports/changeset/23968
Author:   pguyot at kallisys.net
Date:     2007-04-13 20:34:33 -0700 (Fri, 13 Apr 2007)

Log Message:
-----------
New option universal_variant to disable the automatic addition of the universal variant on MacOS X, with new tests to test this behavior.

Modified Paths:
--------------
    trunk/base/doc/portfile.7
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portutil.tcl
    trunk/base/tests/Makefile

Added Paths:
-----------
    trunk/base/tests/test/universal/
    trunk/base/tests/test/universal/Makefile
    trunk/base/tests/test/universal/Portfile
    trunk/base/tests/test/universal/master
    trunk/base/tests/test/universal-2/
    trunk/base/tests/test/universal-2/Makefile
    trunk/base/tests/test/universal-2/Portfile
    trunk/base/tests/test/universal-2/master

Modified: trunk/base/doc/portfile.7
===================================================================
--- trunk/base/doc/portfile.7	2007-04-14 01:54:40 UTC (rev 23967)
+++ trunk/base/doc/portfile.7	2007-04-14 03:34:33 UTC (rev 23968)
@@ -1331,6 +1331,26 @@
 .br
 .Sy Example:
 .Dl default_variants +ssl +tcpd
+.It Ic unversal_variant
+When using MacPorts on MacOS X, a universal variant is defined and
+the default behavior is to configure ports with universal flags
+(see the
+.Ic UNIVERSAL TARGET HOOKS
+section above). The variant can be
+overridden if the default code does not work. It can also be
+suppressed if having a universal variant for the port does not make
+sense. To suppress it, use the
+.Ic universal_variant
+option.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em yes
+.br
+.Sy Example:
+.Dl universal_variant no
 .El
 .Sh PLATFORM OPTIONS
 MacPorts allows for platform-specific conditional modification to be

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2007-04-14 01:54:40 UTC (rev 23967)
+++ trunk/base/src/port1.0/portmain.tcl	2007-04-14 03:34:33 UTC (rev 23968)
@@ -110,6 +110,14 @@
 		configure.cxxflags-append ${configure.universal_cxxflags}
 		configure.ldflags-append ${configure.universal_ldflags}
 	}
+
+	# This is not a standard option, because we need to take an action when it's
+	# set, in order to alter the PortInfo structure in time.
+	proc universal_variant {state} {
+		if {${state} == "no"} {
+			variant_undef universal
+		}
+	}
 }
 
 proc main {args} {

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-04-14 01:54:40 UTC (rev 23967)
+++ trunk/base/src/port1.0/portutil.tcl	2007-04-14 03:34:33 UTC (rev 23968)
@@ -403,6 +403,28 @@
     set variations($name) -
 }
 
+# variant_undef name
+# Undefine a variant for the current portfile.
+proc variant_undef {name} {
+    global variations PortInfo
+    
+    # Remove it from the list of selected variations.
+    array unset variations $name
+
+	# Remove the variant from the portinfo.
+	if {[info exists PortInfo(variants)]} {
+		set variant_index [lsearch -exact $PortInfo(variants) $name]
+		if {$variant_index >= 0} {
+			set new_list [lreplace $PortInfo(variants) $variant_index $variant_index]
+			if {"$new_list" == {}} {
+				unset PortInfo(variants) 
+			} else {
+				set PortInfo(variants) $new_list
+			}
+		}
+	}
+}
+
 # platform <os> [<release>] [<arch>] 
 # Portfile level procedure to provide support for declaring platform-specifics
 # Basically, just wrap 'variant', so that Portfiles' platform declarations can

Modified: trunk/base/tests/Makefile
===================================================================
--- trunk/base/tests/Makefile	2007-04-14 01:54:40 UTC (rev 23967)
+++ trunk/base/tests/Makefile	2007-04-14 03:34:33 UTC (rev 23968)
@@ -1,6 +1,6 @@
 include ../Mk/dports.autoconf.mk
 
-TESTS?=checksums-1 cvs-and-patchsites envvariables site-tags trace xcodeversion dependencies-c
+TESTS?=checksums-1 cvs-and-patchsites envvariables site-tags trace universal universal-2 xcodeversion dependencies-c
 
 .PHONY: test clean PortIndex
 

Added: trunk/base/tests/test/universal/Makefile
===================================================================
--- trunk/base/tests/test/universal/Makefile	                        (rev 0)
+++ trunk/base/tests/test/universal/Makefile	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,17 @@
+include ../../../Mk/dports.autoconf.mk
+
+.PHONY: test
+
+$(bindir)/port:
+	@echo "Please install MacPorts before running this test"
+	@exit 1
+	
+test:
+	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
+	@sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info" > output 2>&1 || (cat output; exit 1)
+	@diff output master 2>&1 | tee difference
+	@if [ -s difference ]; then \
+		exit 1; \
+	else \
+		rm -f difference; \
+	fi

Added: trunk/base/tests/test/universal/Portfile
===================================================================
--- trunk/base/tests/test/universal/Portfile	                        (rev 0)
+++ trunk/base/tests/test/universal/Portfile	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,25 @@
+# $Id$
+
+PortSystem 1.0
+name		universal
+version		1
+categories	test
+maintainers	pguyot at kallisys.net
+description	Test port for universal variant
+homepage	http://www.macports.org/
+platforms	darwin
+
+long_description ${description}
+
+fetch		{}
+checksum	{}
+extract		{}
+configure	{}
+build		{}
+destroot	{
+	system "touch ${destroot}${prefix}/lib/${name}"
+}
+
+test		{}
+
+default_variants +universal


Property changes on: trunk/base/tests/test/universal/Portfile
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/base/tests/test/universal/master
===================================================================
--- trunk/base/tests/test/universal/master	                        (rev 0)
+++ trunk/base/tests/test/universal/master	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,7 @@
+universal 1, test/universal (Variants: universal)
+http://www.macports.org/
+
+{Test port for universal variant}
+
+Platforms: darwin
+Maintainers: pguyot at kallisys.net

Added: trunk/base/tests/test/universal-2/Makefile
===================================================================
--- trunk/base/tests/test/universal-2/Makefile	                        (rev 0)
+++ trunk/base/tests/test/universal-2/Makefile	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,17 @@
+include ../../../Mk/dports.autoconf.mk
+
+.PHONY: test
+
+$(bindir)/port:
+	@echo "Please install MacPorts before running this test"
+	@exit 1
+	
+test:
+	@PORTSRC=$(PORTSRC) $(bindir)/port clean > /dev/null
+	@sh -c "export PORTSRC=$(PORTSRC); $(bindir)/port info" > output 2>&1 || (cat output; exit 1)
+	@diff output master 2>&1 | tee difference
+	@if [ -s difference ]; then \
+		exit 1; \
+	else \
+		rm -f difference; \
+	fi

Added: trunk/base/tests/test/universal-2/Portfile
===================================================================
--- trunk/base/tests/test/universal-2/Portfile	                        (rev 0)
+++ trunk/base/tests/test/universal-2/Portfile	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,25 @@
+# $Id$
+
+PortSystem 1.0
+name		universal-2
+version		1
+categories	test
+maintainers	pguyot at kallisys.net
+description	Test port for universal variant
+homepage	http://www.macports.org/
+platforms	darwin
+
+long_description ${description}
+
+fetch		{}
+checksum	{}
+extract		{}
+configure	{}
+build		{}
+destroot	{
+	system "touch ${destroot}${prefix}/lib/${name}"
+}
+
+test		{}
+
+universal_variant	no


Property changes on: trunk/base/tests/test/universal-2/Portfile
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native

Added: trunk/base/tests/test/universal-2/master
===================================================================
--- trunk/base/tests/test/universal-2/master	                        (rev 0)
+++ trunk/base/tests/test/universal-2/master	2007-04-14 03:34:33 UTC (rev 23968)
@@ -0,0 +1,7 @@
+universal-2 1, test/universal-2
+http://www.macports.org/
+
+{Test port for universal variant}
+
+Platforms: darwin
+Maintainers: pguyot at kallisys.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070413/d8bfdc68/attachment.html


More information about the macports-changes mailing list