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

Last change on this file since 49087 was 49087, checked in by raimue@…, 11 years ago

port1.0:
Create namespaces for the packages in port1.0, stop polluting the global
namespace with many local helper functions.

  • 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 49087 2009-04-03 11:34:32Z raimue@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 portmain::main]
40target_provides ${org.macports.main} main
41target_state ${org.macports.main} no
42
43namespace eval portmain {
44}
45
46# define options
47options prefix macportsuser name version revision epoch categories maintainers
48options long_description description homepage
49options 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 macosx_deployment_target
50options universal_variant os.universal_supported
51
52# Export options via PortInfo
53options_export name version revision epoch categories maintainers platforms description long_description homepage
54
55# Assign option procedure to default_variants
56option_proc default_variants handle_default_variants
57
58default distpath {[file join $portdbpath distfiles]}
59default workpath {[getportworkpath_from_buildpath $portbuildpath]}
60default worksymlink {[file join $portpath work]}
61default prefix /opt/local
62default x11prefix /usr/X11R6
63default applications_dir /Applications/MacPorts
64default frameworks_dir {${prefix}/Library/Frameworks}
65default destdir destroot
66default destpath {${workpath}/${destdir}}
67# destroot is provided as a clearer name for the "destpath" variable
68default destroot {${destpath}}
69default filesdir files
70default revision 0
71default epoch 0
72default distname {${portname}-${portversion}}
73default worksrcdir {$distname}
74default filespath {[file join $portpath $filesdir]}
75default worksrcpath {[file join $workpath $worksrcdir]}
76
77# Configure settings
78default macportsuser {${portutil::autoconf::macportsuser}}
79default install.user {${portutil::autoconf::install_user}}
80default install.group {${portutil::autoconf::install_group}}
81
82# Compatibility namespace
83default portname {$name}
84default portversion {$version}
85default portrevision {$revision}
86default portepoch {$epoch}
87
88# Platform Settings
89set os_arch $tcl_platform(machine)
90if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
91if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
92set os_version $tcl_platform(osVersion)
93set os_major [lindex [split $os_version .] 0]
94set os_platform [string tolower $tcl_platform(os)]
95
96default os.platform {$os_platform}
97default os.version {$os_version}
98default os.major {$os_major}
99default os.arch {$os_arch}
100# Remove trailing "Endian"
101default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
102default os.universal_supported no
103
104set macosx_version {}
105if {$os_platform == "darwin"} {
106    # This will probably break when Apple changes versioning
107    set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
108}
109
110ui_debug "OS Platform: [option os.platform]"
111ui_debug "OS Version: [option os.version]"
112if {$macosx_version != ""} {
113    ui_debug "Mac OS X Version: ${macosx_version}"
114}
115ui_debug "System Arch: [option os.arch]"
116
117default macosx_deployment_target {$macosx_version}
118
119default universal_variant yes
120
121# Select implicit variants
122if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
123if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
124if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
125if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
126if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
127    # the universal variant itself is now created in
128    # add_default_universal_variant, which is called from mportopen
129    option os.universal_supported yes
130
131    if {[info exists variations(universal)] && $variations(universal) == "+"} {
132        # cannot go into the variant, due to the amount of ports overriding it
133        eval macosx_deployment_target ${universal_target}
134    }
135}
136
137proc portmain::main {args} {
138    return 0
139}
Note: See TracBrowser for help on using the repository browser.