source: trunk/dports/_resources/port1.0/group/xcodeversion-1.0.tcl @ 63197

Last change on this file since 63197 was 63197, checked in by jmr@…, 10 years ago

revert r63189

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.9 KB
RevLine 
[54228]1# $Id: xcodeversion-1.0.tcl 63197 2010-01-29 08:03:35Z jmr@macports.org $
2#
3# Copyright (c) 2009 The MacPorts Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met:
9#
10# 1. Redistributions of source code must retain the above copyright
11#    notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright
13#    notice, this list of conditions and the following disclaimer in the
14#    documentation and/or other materials provided with the distribution.
15# 3. Neither the name of The MacPorts Project nor the names of its
16#    contributors may be used to endorse or promote products derived from
17#    this software without specific prior written permission.
18#
19# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30#
31#
32# This PortGroup lets a port check that the user's Xcode is sufficiently new.
33#
34# Usage:
35#
36#   PortGroup               xcodeversion 1.0
37#   minimum_xcodeversions   {darwin_major minimum_xcodeversion}
38#
39# where darwin_major is the major version of the underlying Darwin OS (e.g. 9
40# for Mac OS X 10.5 Leopard) and minimum_xcodeversion is the minimum version
41# of Xcode the port requires (e.g. 3.1).
42
43options minimum_xcodeversions
44default minimum_xcodeversions {}
45
46pre-extract {
47    if {"darwin" == ${os.platform}} {
[54278]48        if {![info exists developer_dir]} {
[54228]49            if {${os.major} < 9} {
50                set developer_dir /Developer
51            } else {
52                set developer_dir [exec xcode-select -print-path]
53            }
54        }
55        set current_xcodeversion [exec defaults read ${developer_dir}/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
56        foreach {darwin_major minimum_xcodeversion} [join ${minimum_xcodeversions}] {
57            if {${darwin_major} == ${os.major}} {
58                if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
[63197]59                    ui_msg "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} or later but you have Xcode ${current_xcodeversion}."
[54228]60                    return -code error "incompatible Xcode version"
61                }
62            }
63        }
64    }
65}
Note: See TracBrowser for help on using the repository browser.