Changes between Version 3 and Version 4 of PortfileRecipes


Ignore:
Timestamp:
May 14, 2009, 7:01:30 AM (15 years ago)
Author:
ryandesign (Ryan Carsten Schmidt)
Comment:

add Xcode version check section

Legend:

Unmodified
Added
Removed
Modified
  • PortfileRecipes

    v3 v4  
    7878}}}
    7979that is then run in post-patch (see for example [browser:trunk/dports/devel/glib2 glib2]).
     80
     81
     82== Xcode version checking == #xcode_version
     83
     84MacPorts [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:
     85
     86{{{
     87pre-extract {
     88    if {"darwin" == ${os.platform} && 9 == ${os.major}} {
     89        set minimum_xcodeversion 3.1
     90        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
     91        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
     92            ui_error "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} or later but you have Xcode ${current_xcodeversion}."
     93            return -code error "incompatible Xcode version"
     94        }
     95    }
     96}
     97}}}
     98
     99This example is from [browser:trunk/dports/multimedia/x264 x264].
     100Note that the check [http://lists.macosforge.org/pipermail/macports-dev/2009-April/008112.html is done at pre-extract time].
     101
     102You 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.
     103If 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.
     104For 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.
     105It is better to make a user upgrade to a newer Xcode than for a port maintainer to spend time testing old versions.
     106
     107