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

Last change on this file was 133630, checked in by raimue@…, 6 years ago

base: add 'port info --patchfiles' by exporting the list of patchfiles in PortInfo

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.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 133630 2015-03-07 15:02:36Z raimue@macports.org $
4#
5# Copyright (c) 2004 - 2005, 2007 - 2012 The MacPorts Project
6# Copyright (c) 2002 - 2003 Apple Inc.
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
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 Inc. nor the names of its contributors
18#    may be used to endorse or promote products derived from this software
19#    without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31# POSSIBILITY OF SUCH DAMAGE.
32#
33
34# the 'main' target is provided by this package
35# main is a magic target and should not be replaced
36
37package provide portmain 1.0
38package require portutil 1.0
39
40set org.macports.main [target_new org.macports.main portmain::main]
41target_provides ${org.macports.main} main
42target_state ${org.macports.main} no
43
44namespace eval portmain {
45}
46
47set_ui_prefix
48
49# define options
50options prefix name version revision epoch categories maintainers \
51        long_description description homepage notes license \
52        provides conflicts replaced_by \
53        worksrcdir filesdir distname portdbpath libpath distpath sources_conf \
54        os.platform os.subplatform os.version os.major os.minor os.arch os.endian \
55        platforms default_variants install.user install.group \
56        macosx_deployment_target universal_variant os.universal_supported \
57        supported_archs depends_skip_archcheck installs_libs \
58        license_noconflict copy_log_files \
59        compiler.cpath compiler.library_path \
60        add_users altprefix
61
62# Order of option_proc and option_export matters. Filter before exporting.
63
64# Assign option procedure to default_variants
65option_proc default_variants handle_default_variants
66# Handle notes special for better formatting
67option_proc notes handle_option_string
68
69# Export options via PortInfo
70options_export name version revision epoch categories maintainers platforms description long_description notes homepage license provides conflicts replaced_by installs_libs license_noconflict patchfiles
71
72default subport {[portmain::get_default_subport]}
73proc portmain::get_default_subport {} {
74    global name portpath
75    if {[info exists name]} {
76        return $name
77    }
78    return [file tail $portpath]
79}
80default subbuildpath {[portmain::get_subbuildpath]}
81proc portmain::get_subbuildpath {} {
82    global portpath portbuildpath subport
83    if {$subport ne ""} {
84        set subdir $subport
85    } else {
86        set subdir [file tail $portpath]
87    }
88    return [file normalize [file join $portbuildpath $subdir]]
89}
90default workpath {[getportworkpath_from_buildpath $subbuildpath]}
91default prefix /opt/local
92default applications_dir /Applications/MacPorts
93default frameworks_dir {${prefix}/Library/Frameworks}
94default destdir destroot
95default destpath {${workpath}/${destdir}}
96# destroot is provided as a clearer name for the "destpath" variable
97default destroot {${destpath}}
98default filesdir files
99default revision 0
100default epoch 0
101default license unknown
102default distname {${name}-${version}}
103default worksrcdir {$distname}
104default filespath {[file join $portpath [join $filesdir]]}
105default worksrcpath {[file join $workpath [join $worksrcdir]]}
106# empty list means all archs are supported
107default supported_archs {}
108default depends_skip_archcheck {}
109default add_users {}
110
111# Configure settings
112default install.user {${portutil::autoconf::install_user}}
113default install.group {${portutil::autoconf::install_group}}
114
115# Platform Settings
116default os.platform {$os_platform}
117default os.version {$os_version}
118default os.major {$os_major}
119default os.minor {$os_minor}
120default os.arch {$os_arch}
121default os.endian {$os_endian}
122
123set macosx_version_text {}
124if {[option os.platform] eq "darwin"} {
125    set macosx_version_text "(Mac OS X ${macosx_version}) "
126}
127ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
128
129default universal_variant {${use_configure}}
130
131# sub-platforms of darwin
132if {[option os.platform] eq "darwin"} {
133    if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
134        default os.subplatform macosx
135        # we're on Mac OS X and can therefore build universal
136        default os.universal_supported yes
137    } else {
138        default os.subplatform puredarwin
139        default os.universal_supported no
140    }
141} else {
142    default os.subplatform {}
143    default os.universal_supported no
144}
145
146default compiler.cpath {${prefix}/include}
147default compiler.library_path {${prefix}/lib}
148
149# start gsoc08-privileges
150
151# Record initial euid/egid
152set euid [geteuid]
153set egid [getegid]
154
155# if unable to write to workpath, implies running without either root privileges
156# or a shared directory owned by the group so use ~/.macports
157default altprefix {[file join $user_home .macports]}
158if { $euid != 0 && (([info exists workpath] && [file exists $workpath] && ![file writable $workpath]) || ([info exists portdbpath] && ![file writable [file join $portdbpath build]])) } {
159
160    # set global variable indicating to other functions to use ~/.macports as well
161    set usealtworkpath yes
162
163    default worksymlink {[file normalize [file join ${altprefix}${portpath} work]]}
164    default distpath {[file normalize [file join ${altprefix}${portdbpath} distfiles ${dist_subdir}]]}
165    set portbuildpath "${altprefix}${portbuildpath}"
166
167    ui_debug "Going to use alternate build prefix: $altprefix"
168    ui_debug "workpath = $workpath"
169} else {
170    set usealtworkpath no
171    default worksymlink {[file normalize [file join $portpath work]]}
172    default distpath {[file normalize [file join $portdbpath distfiles ${dist_subdir}]]}
173}
174
175# end gsoc08-privileges
176
177proc portmain::main {args} {
178    return 0
179}
Note: See TracBrowser for help on using the repository browser.