[MacPorts] PortfileRecipes modified

MacPorts noreply at macports.org
Thu May 14 00:01:33 PDT 2009


Changed page "PortfileRecipes" by ryandesign at macports.org from 70.114.129.90*
Page URL: <http://trac.macports.org/wiki/PortfileRecipes>
Diff URL: <http://trac.macports.org/wiki/PortfileRecipes?action=diff&version=4>
Revision 4
Comment: add Xcode version check section

-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: PortfileRecipes
=========================================================================
--- PortfileRecipes (version: 3)
+++ PortfileRecipes (version: 4)
@@ -77,3 +77,31 @@
 reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/configure
 }}}
 that is then run in post-patch (see for example [browser:trunk/dports/devel/glib2 glib2]).
+
+
+== 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.
+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.
+It is better to make a user upgrade to a newer Xcode than for a port maintainer to spend time testing old versions.
+
+

-------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