source: trunk/base/src/port1.0/portmain.tcl @ 30091

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

portmain.tcl: Added modeline.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# portmain.tcl
3# $Id: portmain.tcl 30091 2007-10-19 12:40:21Z nox@macports.org $
4#
5# Copyright (c) 2002 - 2003 Apple Computer, Inc.
6# All rights reserved.
7#
8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions
10# are met:
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
17#    may be used to endorse or promote products derived from this software
18#    without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30# POSSIBILITY OF SUCH DAMAGE.
31#
32
33# the 'main' target is provided by this package
34# main is a magic target and should not be replaced
35
36package provide portmain 1.0
37package require portutil 1.0
38
39set org.macports.main [target_new org.macports.main main]
40target_provides ${org.macports.main} main
41
42# define options
43options prefix name version revision epoch categories maintainers
44options long_description description homepage
45options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group
46
47# Export options via PortInfo
48options_export name version revision epoch categories maintainers platforms description long_description homepage
49
50# Assign option procedure to default_variants
51option_proc default_variants handle_default_variants
52
53# Hard coded version number for resource location
54default portresourcepath {[file join $portsharepath resources/port1.0]}
55default distpath {[file join $portdbpath distfiles]}
56default workpath {[getportworkpath_from_buildpath $portbuildpath]}
57default worksymlink {[file join $portpath work]}
58default prefix /opt/local
59default x11prefix /usr/X11R6
60default destdir destroot
61default destpath {${workpath}/${destdir}}
62# destroot is provided as a clearer name for the "destpath" variable
63default destroot {${destpath}}
64default filesdir files
65default revision 0
66default epoch 0
67default distname {${portname}-${portversion}}
68default worksrcdir {$distname}
69default filespath {[file join $portpath $filesdir]}
70default worksrcpath {[file join $workpath $worksrcdir]}
71
72# Configure settings
73default install.user {${portutil::autoconf::install_user}}
74default install.group {${portutil::autoconf::install_group}}
75
76# Compatibility namespace
77default portname {$name}
78default portversion {$version}
79default portrevision {$revision}
80default portepoch {$epoch}
81
82# Platform Settings
83set os_arch $tcl_platform(machine)
84if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
85if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
86set os_major [lindex [split $tcl_platform(osVersion) .] 0]
87
88default os.platform {[string tolower $tcl_platform(os)]}
89default os.version {$tcl_platform(osVersion)}
90default os.major {$os_major}
91default os.arch {$os_arch}
92# Remove trailing "Endian"
93default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
94
95# Select implicit variants
96if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
97if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
98if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
99if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
100if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
101    # Declare default universal variant, on >10.3
102    variant universal {
103        if {[tbool use_xmkmf] || ![tbool use_configure]} {
104            return -code error "Default universal variant only works with ports based on configure"
105        }
106        configure.args-append ${configure.universal_args}
107        if {![file exists /Developer/SDKs/MacOSX10.4u.sdk/]} {
108            return -code error "MacOS X 10.4 universal SDK is not installed (are we running on 10.3? did you forget to install it?) and building with +universal will very likely fail"
109        }
110        configure.cflags-append ${configure.universal_cflags}
111        configure.cppflags-append ${configure.universal_cppflags}
112        configure.cxxflags-append ${configure.universal_cxxflags}
113        configure.ldflags-append ${configure.universal_ldflags}
114    }
115
116    # This is not a standard option, because we need to take an action when it's
117    # set, in order to alter the PortInfo structure in time.
118    proc universal_variant {state} {
119        if {${state} == "no"} {
120            variant_undef universal
121        }
122    }
123}
124
125proc main {args} {
126    return 0
127}
Note: See TracBrowser for help on using the repository browser.