Ticket #16723: python-1.0.tcl

File python-1.0.tcl, 3.5 KB (added by jmroot (Joshua Root), 16 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# python-1.0.tcl
3#
4# $Id: python-1.0.tcl 28465 2007-08-31 22:59:48Z mww@macports.org $
5#
6# Copyright (c) 2008 Joshua Root <jmr at macports.org>
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions are
10# met:
11#
12# 1. Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in the
16#    documentation and/or other materials provided with the distribution.
17# 3. Neither the name of Apple Computer, Inc. nor the names of its
18#    contributors may be used to endorse or promote products derived from
19#    this software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33
34# arbitrary 'reasonable' defaults
35set python.versions {python24 python25 python26}
36set python.default_version python25
37
38proc python.versions {versions} {
39    global python.versions
40    set python.versions $versions
41}
42
43proc python.default_version {version} {
44    global python.default_version
45    set python.default_version $version
46}
47
48categories      python
49dist_subdir     python
50
51use_configure   no
52
53build.target    build
54
55destroot.destdir    --prefix=${prefix} --root=${destroot}
56pre-destroot    {
57    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}/examples
58}
59
60# select a default version if none set
61foreach v ${python.versions} {
62    if {[variant_isset $v]} {
63        set python.version_chosen yes
64    }
65}
66if {![info exists python.version_chosen]} {
67    variant_set ${python.default_version}
68}
69
70
71foreach v ${python.versions} {
72    variant $v {}
73    if {[variant_isset $v]} {
74        depends_lib-append      port:${v}
75        set python.dotversion [string range $v 0 end-1].[string index $v end]
76       
77        set ${v}.bin  ${prefix}/bin/${python.dotversion}
78        set ${v}.lib  ${prefix}/lib/lib${python.dotversion}.dylib
79        set ${v}.libdir ${prefix}/lib/${python.dotversion}
80        set ${v}.pkgd ${prefix}/lib/${python.dotversion}/site-packages
81        set ${v}.include  ${prefix}/include/${python.dotversion}
82    }
83}
84
85build {
86    foreach v ${python.versions} {
87        if {[variant_isset $v]} {
88            copy ${worksrcpath} ${worksrcpath}-${v}
89            set buildcmd [set ${v}.bin]
90            system "cd ${worksrcpath}-${v} && ${buildcmd} setup.py ${build.target}"
91        }
92    }
93}
94destroot {
95    foreach v ${python.versions} {
96        if {[variant_isset $v]} {
97            set destrootcmd [set ${v}.bin]
98            system "cd ${worksrcpath}-${v} && ${destrootcmd} setup.py install ${destroot.destdir}"
99        }
100    }
101}