source: trunk/dports/_resources/port1.0/group/zope-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: 5.8 KB
Line 
1# et:ts=4
2# zope-1.0.tcl
3#
4# $Id: zope-1.0.tcl 63197 2010-01-29 08:03:35Z jmr@macports.org $
5#
6# Group file for 'zope' group.
7#
8# Copyright (c) 2004 Robert Shaw <rshaw@opendarwin.org>
9# Copyright (c) 2002 Apple Computer, Inc.
10# All rights reserved.
11#
12# Redistribution and use in source and binary forms, with or without
13# modification, are permitted provided that the following conditions are
14# met:
15#
16# 1. Redistributions of source code must retain the above copyright
17#    notice, this list of conditions and the following disclaimer.
18# 2. Redistributions in binary form must reproduce the above copyright
19#    notice, this list of conditions and the following disclaimer in the
20#    documentation and/or other materials provided with the distribution.
21# 3. Neither the name of Apple Computer, Inc. nor the names of its
22#    contributors may be used to endorse or promote products derived from
23#    this software without specific prior written permission.
24#
25# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36#
37
38# Set some variables.
39set python.bin  ${prefix}/bin/python2.3
40set python.lib  ${prefix}/lib/python2.3
41
42set zope.home           ${prefix}/libexec/Zope
43set zope.softhome       ${zope.home}/lib/python
44set zope.prodhome       ${zope.softhome}/Products
45set zope.insthome       ${prefix}/www/Zope
46set zope.exthome        ${zope.insthome}/Extensions
47
48set zope.user   zope
49set zope.group  www
50
51# Zope group options
52options zope.need_subdir
53default zope.need_subdir yes
54option_proc zope.need_subdir zope.fix_extract_dir
55
56# Zope group default for extract.dir
57default extract.dir {${worksrcpath}}
58
59# define this empty initially, it is set by zope.setup arguments
60set zope.product ""
61set zope.products {}
62set zope.extensions {}
63
64# Zope group setup procedure
65proc zope.setup {product vers {products {}} {extensions {}}} {
66        global workpath worksrcpath
67        global python.bin python.lib
68        global zope.home zope.softhome zope.prodhome zope.insthome zope.exthome
69        global zope.user zope.group
70        global zope.product zope.products zope.extensions zope.need_subdir
71
72        # define zope.product & zope.products & zope.extensions
73        set zope.product ${product}
74        if {[llength $products] > 0} {
75                set zope.products ${products}
76                zope.need_subdir no
77        } else {
78                set zope.products "${product}"
79        }
80        if {[llength $extensions] > 0} {
81                if {[llength $products] == 0} {
82                        set zope.products {}
83                }
84                set zope.extensions ${extensions}
85        }
86
87        name                    zope-[string tolower ${zope.product}]
88        version                 ${vers}
89        categories              www zope python
90
91        distname                ${zope.product}-${vers}
92        dist_subdir             zope
93
94        depends_lib             path:${zope.home}/bin/compilezpy.py:zope
95
96        platform freebsd {
97                extract.post_args       | gtar -xf -
98        }
99
100        pre-extract {
101                if {[tbool zope.need_subdir]} {
102                        ui_debug "mkdir: ${worksrcpath}"
103                        file mkdir ${worksrcpath}
104                }
105        }
106
107        post-patch {
108                foreach item [glob ${worksrcpath}/*] {
109                        if {[file isdirectory $item]} {
110                                set product [file tail $item]
111                                if {[lsearch -exact ${zope.products} $product] < 0} {
112                                        ui_debug "rmdir: $product: $item"
113                                        file delete -force $item
114                                }
115                        }
116                }
117                system "find ${worksrcpath} -name '*.py\[co\]' | xargs rm"
118                system "find ${worksrcpath} -type d -name CVS | xargs rm -rf"
119                system "find ${worksrcpath} -name '.#*' | xargs rm"
120        }
121
122        use_configure   no
123
124        pre-build {
125                file copy -force ${zope.home}/bin/compilezpy.py ${workpath}
126                reinplace "s|^.*sys.stdout|#&|" ${workpath}/compilezpy.py
127                system "find ${worksrcpath} -name '*.py\[co\]' | xargs rm"
128        }
129        build {
130                # Precompile all product files
131                system "cd ${worksrcpath} && ${python.bin} ${workpath}/compilezpy.py"
132        }
133
134        destroot {
135                # Warn user if not running as root
136                if {$env(USER) != "root"} {
137                        ui_msg "-----------------------------------------------------------"
138                        ui_msg "Note that you are not running as root, so files installed"
139                        ui_msg "by this port will not end up with proper ownership and"
140                        ui_msg "likely not work correctly with Zope."
141                        ui_msg "-----------------------------------------------------------"
142                }
143                cd ${worksrcpath}
144
145                # Install product(s)
146                if {[llength ${zope.products}] > 0} {
147                        xinstall -d -m 0755 ${destroot}${zope.prodhome}
148                        foreach item ${zope.products} {
149                                set cmd "cp -R ${item} ${destroot}${zope.prodhome}/${item}"
150                                ui_info ${cmd}; system ${cmd}
151                        }
152                }
153
154                # Install extension(s)
155                if {[llength ${zope.extensions}] > 0} {
156                        xinstall -d -m 0755 ${destroot}${zope.exthome}
157                        foreach item ${zope.extensions} {
158                                set cmd "cp -R ${item} ${destroot}${zope.exthome}/${item}"
159                                ui_info ${cmd}; system ${cmd}
160                        }
161                }
162
163                # Fix owner and group on installed data
164                if {$env(USER) == "root"} {
165                        if {[llength ${zope.products}] > 0} {
166                                set cmd "chown -R ${zope.user} ${destroot}${zope.home}"
167                                ui_info ${cmd}; system ${cmd}
168                                set cmd "chgrp -R ${zope.group} ${destroot}${zope.home}"
169                                ui_info ${cmd}; system ${cmd}
170                        }
171                        if {[llength ${zope.extensions}] > 0} {
172                                set cmd "chown -R ${zope.user} ${destroot}${zope.insthome}"
173                                ui_info ${cmd}; system ${cmd}
174                                set cmd "chgrp -R ${zope.group} ${destroot}${zope.insthome}"
175                                ui_info ${cmd}; system ${cmd}
176                        }
177                }
178        }
179}
180
181# Zope group option procedures
182proc zope.fix_extract_dir {option action args} {
183        global workpath worksrcpath
184        if {[string equal ${action} "set"]} {
185                if {[tbool args]} {
186                        extract.dir ${worksrcpath}
187                } else {
188                        extract.dir ${workpath}
189                }
190        }
191}
192
Note: See TracBrowser for help on using the repository browser.