[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Sun Oct 17 21:29:09 PDT 2010


Changed page "PortfileRecipes" by ryandesign at macports.org from 75.34.103.216*
Page URL: <https://trac.macports.org/wiki/PortfileRecipes>
Diff URL: <https://trac.macports.org/wiki/PortfileRecipes?action=diff&version=22>
Revision 22
Comment: update Xcode version checking section to use xcodeversion portgroup

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 21)
+++ PortfileRecipes (version: 22)
@@ -117,27 +117,30 @@
 
 == Xcode version checking == #xcode_version
 
-MacPorts [ticket:12794 does not check the version of Xcode] being used at runtime, but many ports will fail to build if the version of Xcode is too old. If you discover that your port requires a particular minimum version of Xcode, add this code to the port to print an error if the user's Xcode is too old:
-
-{{{
-pre-extract {
-    if {"darwin" == ${os.platform} && 9 == ${os.major}} {
-        set minimum_xcodeversion 3.1
-        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
-        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
-            ui_error "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} or later but you have Xcode ${current_xcodeversion}."
-            return -code error "incompatible Xcode version"
-        }
-    }
-}
-}}}
-
-This example is from [browser:trunk/dports/multimedia/x264 x264].
-Note that the check [http://lists.macosforge.org/pipermail/macports-dev/2009-April/008112.html is done at pre-extract time].
-
-You can change the "9" in the os.major check to "8" if you're checking Tiger (Xcode 2.x) or "7" for Panther (Xcode 1.x) and update the minimum_xcodeversion accordingly.
+MacPorts [ticket:12794 checks the version of Xcode] being used at runtime and warns if it is an old version known to cause problems, but for specific ports that are known to fail to build with older versions of Xcode, you may want to actively prevent the installation from continuing, rather than just printing a warning.
+If you discover that your port requires a particular minimum version of Xcode, use the xcodeversion portgroup to print an error and exit if the user's Xcode is too old.
+At the top of the portfile, after the PortSystem line and near any other PortGroup lines you may have, add this line:
+
+{{{
+PortGroup               xcodeversion 1.0
+}}}
+
+Then somewhere in the body of the portfile you can write a line like this:
+
+{{{
+minimum_xcodeversions {9 3.1}
+}}}
+
+This example is from [browser:trunk/dports/multimedia/x264 x264] and ensures that, on Darwin 9 (Mac OS X 10.5 Leopard), Xcode 3.1 or greater is used.
+
+If you need to check the minimum Xcode version of more than one OS version, simply add more pairs of arguments. For example, to check for a minimum of Xcode 3.1 on Darwin 9 and a minimum of Xcode 2.5 on Darwin 8 (Mac OS X 10.4 Tiger), you would write:
+
+{{{
+minimum_xcodeversions {9 3.1 8 2.5}
+}}}
+
 If you don't know what minimum version of Xcode would work, it's ok to just put whatever version you found that the port worked with.
-For example, libpixman is known to work with Xcode 1.5 but fail with 1.1, so [changeset:45892 libpixman now requires Xcode 1.5] on Panther, even though compatibility with Xcode 1.2 was not tested.
+For example if someone reports a problem building a port on Leopard with Xcode 3.0, and you verified it works fine with Xcode 3.1.4, it's ok to list 3.1.4 as the minimum Xcode version, even without testing whether earlier 3.1.x versions would have worked.
 It is better to make a user upgrade to a newer Xcode than for a port maintainer to spend time testing old versions.
 
 == Stealth updates == #stealth-updates

-------8<------8<------8<------8<------8<------8<------8<------8<--------

* The IP shown here might not mean anything if the user or the server is
behind a proxy.

--
MacPorts <http://www.macports.org/>
Ports system for Mac OS

This is an automated message. Someone at http://www.macports.org/ added your email
address to be notified of changes on PortfileRecipes. If it was not you, please
report to .


More information about the macports-changes mailing list