Ticket #12027: gnustep-1.0.tcl

File gnustep-1.0.tcl, 7.5 KB (added by yves@…, 17 years ago)

New gnustep portgroup

Line 
1# et:ts=4
2# gnustep.tcl
3#
4# $Id: gnustep-1.0.tcl 22014 2007-02-14 10:23:55Z pipping@macports.org $
5#
6# Copyright (c) 2006 Yves de Champlain <yves@opendarwin.org>,
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 are
11# met:
12#
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. Neither the name of Apple Computer, Inc. nor the names of its
19#    contributors may be used to endorse or promote products derived from
20#    this software without specific prior written permission.
21#
22# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33#
34
35#
36# Group code for GNUstep ports.
37#
38
39#
40# Overview of gnustep 1.0 PortGroup :
41#
42
43#
44# default categories            gnustep
45# default homepage              http://www.gnustep.org/
46# default master_sites          gnustep:core
47#
48# array set gnustep.post_flags  Apple CC two-level namespaces requires all
49#                               symbols to be resolved at link time,
50#                               so most of the patches are just that.
51#                               Setting the gnustep.post_flags array makes this
52#                               simple beyond common understanding !
53#                               ex:
54#                               platform darwin {
55#                                   array set gnustep.post_flags {
56#                                       BundleSubDir  "-lfoo -lbar"
57#                                   }
58#                               }
59#
60#
61# proc set_gnustep_make         Sets GNUSTEP_MAKEFILES
62#                               according to the FilesystemLayout
63#
64# proc set_gnustep_env          Sets DYLD_LIBRARY_PATH and PATH
65#                               for the gnustep FilesystemLayout
66#
67#
68# default gnustep.cc            CC=gcc-dp-4.2
69#
70# default use_configure         no
71# default configure.env         Sets the environment for the gnustep FilesystemLayout
72# configure.pre_args-append     ${gnustep.cc} [set_gnustep_make]"
73#
74# default build.env             {[set_gnustep_env]}
75# default build.type            gnu
76# build.pre_args-append         "messages=yes [set_gnustep_make]"
77#
78# default destroot.env          {[set_gnustep_env]}
79# destroot.pre_args-append      "messages=yes [set_gnustep_make] [set_gnustep_domain]"
80#
81# variant with_docs             Most GNUstep programs providing documentation
82#                               follow the same pattern
83#
84
85#
86# GNUstep utilities
87#
88
89#
90# Adds SHARED_LD_POSTFLAGS for Darwin's linker
91#
92# Sets GNUSTEP_INSTALLATION_DOMAIN for ports using the
93# deprecated GNUSTEP_SYSTEM_ROOT variable
94#
95
96array set gnustep.post_flags {}
97
98post-patch {
99    foreach {src_subdir post_libs} [array get gnustep.post_flags] {
100        set fl [ open ${worksrcpath}/$src_subdir/GNUmakefile.preamble a ]
101        puts $fl "\nSHARED_LD_POSTFLAGS += $post_libs"
102        close $fl
103    }
104    foreach gmf [glob -nocomplain -directory ${worksrcpath} GNUmakefile*] {
105        reinplace \
106            "s|GNUSTEP_INSTALLATION_DIR = \$\(GNUSTEP_SYSTEM_ROOT\)|GNUSTEP_INSTALLATION_DOMAIN=SYSTEM|g" \
107                $gmf
108    }
109}
110
111#
112# Returns true (1) if current file layout is gnustep
113# Returns false (0) otherwise
114#
115
116proc gnustep_layout {} {
117    global prefix
118   
119    if {[file exists ${prefix}/GNUstep/System/Library/Makefiles]} {
120        return 1
121    }
122    return 0
123}
124
125#
126# Sets GNUSTEP_SYSTEM_LIBRARY according to the FilesystemLayout
127#
128
129proc set_system_library {} {
130    global prefix
131   
132    if {[gnustep_layout]} {
133        return "${prefix}/GNUstep/System/Library"
134    }
135    return "${prefix}/lib/GNUstep"
136}
137
138#
139# Sets GNUSTEP_LOCAL_LIBRARY according to the FilesystemLayout
140#
141
142proc set_local_library {} {
143    global prefix
144   
145    if {[gnustep_layout]} {
146        return "${prefix}/GNUstep/Local/Library"
147    }
148    return "${prefix}/lib/GNUstep"
149}
150
151#
152# Sets GNUSTEP_MAKEFILES according to the FilesystemLayout
153#
154
155proc set_gnustep_make {} {
156    global prefix
157   
158    if {[gnustep_layout]} {
159        return "GNUSTEP_MAKEFILES=${prefix}/GNUstep/System/Library/Makefiles"
160    }
161    return "GNUSTEP_MAKEFILES=${prefix}/share/GNUstep/Makefiles"
162}
163
164#
165# Sets DYLD_LIBRARY_PATH and PATH for the gnustep FilesystemLayout
166#
167
168proc set_gnustep_env {} {
169    global env prefix
170   
171    if {[gnustep_layout]} {
172        return "\
173            DYLD_LIBRARY_PATH=${prefix}/GNUstep/Local/Library/Libraries:${prefix}/GNUstep/System/Library/Libraries \
174            PATH=${prefix}/GNUstep/Local/Tools:${prefix}/GNUstep/System/Tools:$env(PATH) \
175        "
176    }
177    return
178}
179
180#
181# Options this group provides :
182#
183
184options gnustep.cc
185default gnustep.cc          CC=gcc-mp-4.2
186
187options system_library
188options local_library
189default system_library      [set_system_library]
190default local_library       [set_local_library]
191
192#
193# Default values for this group :
194#
195
196default categories          gnustep
197default homepage            http://www.gnustep.org/
198
199default master_sites        gnustep:core
200default depends_build       port:gnustep-make
201default depends_lib         port:gnustep-back
202
203default use_configure       no
204default configure.env       {[set_gnustep_env]}
205configure.pre_args-append   "${gnustep.cc} [set_gnustep_make]"
206
207default build.env           {[set_gnustep_env]}
208default build.type          gnu
209build.pre_args-append       "messages=yes [set_gnustep_make]"
210
211default destroot.env        {[set_gnustep_env]}
212destroot.pre_args-append    "messages=yes [set_gnustep_make]"
213
214#
215# To build and install documentation provided by the port
216#
217
218variant with_docs {
219    depends_build-append    bin:latex2html:latex2html \
220                            bin:texi2pdf:texinfo \
221                            bin:texi2html:texi2html \
222                            bin:pdftex:teTeX \
223                            port:gnustep-base
224
225    post-destroot {
226       
227        if {[file exists ${worksrcpath}/Documentation/GNUmakefile]} {
228           
229            ui_msg "--->  Making Documentation for ${name}"
230           
231            cd ${worksrcpath}/Documentation
232            system "${destroot.env} ${destroot.cmd} \
233                    ${destroot.pre_args} ${destroot.destdir}"
234           
235            set info_dir \
236                ${destroot}${prefix}/GNUstep/System/Library/Documentation/info
237            if {[file exists ${info_dir}/manual.info]} {
238                set manual_name [regsub {gnustep-} ${name} ""]
239                file rename ${info_dir}/manual.info \
240                    ${info_dir}/${manual_name}-manual.info
241            }
242        } else {
243            ui_msg "--->  No Documentation for ${name}"
244        }
245    }   
246}
247
248