Ticket #8139: gnustep-1.0.7.tcl

File gnustep-1.0.7.tcl, 6.9 KB (added by yves@…, 18 years ago)

gnustep-1.0.tcl

Line 
1# et:ts=4
2# gnustep.tcl
3#
4# $Id: gnustep-1.0.tcl,v 1.2 2006/07/26 01:21:55 yves Exp $
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# Group code for GNUstep ports.
36
37#
38# Overview of gnustep 1.0 PortGroup
39#
40# default categories            gnustep
41# default homepage              http://www.gnustep.org/
42# default master_sites          gnustep:core
43#
44# array set gnustep.post_flags  Apple CC two-level namespaces requires all
45#                               symbols to be resolved at link time,
46#                               so most of the patches are just that.
47#                               Setting the gnustep.post_flags array makes this
48#                               simple beyond common understanding !
49#                               ex:
50#                               platform darwin {
51#                                   array set gnustep.post_flags {
52#                                       BundleSubDir  "-lfoo -lbar"
53#                                   }
54#                               }
55#                               
56# default use_configure         no
57# default configure.args        CC-gcc-dp-4.1
58#
59# default build.type            gnu
60# default build.args            messages=yes
61#
62# default gnustep.domain        System
63# default destroot.args         messages=yes
64# default destroot.destdir      GNUSTEP_INSTALLATION_DIR=${destroot}${prefix}/GNUstep/$gnustep.domain
65# variant with_docs             GNUstep programs providing documentation should
66#                               all follow the same pattern
67#
68
69
70# Options this group provides :
71
72options gnustep.domain
73default gnustep.domain      ""
74
75# Default values for this group :
76
77default categories                      gnustep
78default homepage            http://www.gnustep.org/
79
80default master_sites        gnustep:core
81default depends_build       port:gnustep-make
82default depends_lib         port:gnustep-back
83
84default use_configure           no
85default configure.args      CC=gcc-dp-4.1
86
87default build.type          gnu
88default build.args          messages=yes
89
90default destroot.args       messages=yes
91
92
93# for Darwin's linker
94
95array set gnustep.post_flags {}
96post-patch {
97    foreach {src_subdir post_libs} [array get gnustep.post_flags] {
98        set fl [ open ${worksrcpath}/$src_subdir/GNUmakefile.preamble a ]
99        puts $fl "\nSHARED_LD_POSTFLAGS += $post_libs"
100        close $fl
101    }
102}
103
104# try to guess installation directory if not specified in the Portfile
105# defaults to Local
106
107proc set_gnustep_domain {} {
108    global gnustep.domain worksrcpath
109   
110    if {${gnustep.domain} == ""} {
111        set gnustep.domain Local
112        ui_debug "No gnustep.domain provided"
113        if {[file exists $worksrcpath/GNUmakefile]} {
114            set root_makefile "GNUmakefile"
115        } elseif {[file exists $worksrcpath/GNUmakefile.in]} {
116            set root_makefile "GNUmakefile.in"
117        } else {
118            ui_debug "no GNUmakefile ? ... hum !"
119            return 1
120        }
121        ui_debug "Checking installation directory in $worksrcpath/$root_makefile"
122        set fl [open "| grep \"^GNUSTEP_INSTALLATION_DIR = \" $worksrcpath/$root_makefile"]
123        set data [read $fl]
124        if {! [catch {close $fl} err] && [regexp SYSTEM $data]} {
125            ui_debug "Data read : $data"
126            set gnustep.domain System
127        } else {
128            ui_debug "$err"
129        }
130    }
131    ui_debug "Using ${gnustep.domain}"
132}
133
134
135# GNUstep stages commands
136
137configure {
138    if { ${use_configure} == "yes" } {
139        cd ${worksrcpath}
140        ui_debug "./configure ${configure.pre_args} ${configure.args}"
141        system "\
142            . ${prefix}/GNUstep/System/Library/Makefiles/GNUstep.sh \
143            && \
144            ./configure ${configure.pre_args} ${configure.args}"
145    }
146}
147   
148build {
149    cd ${worksrcpath}
150    ui_debug "${build.cmd} ${build.target} ${build.args}"
151    system "\
152        . ${prefix}/GNUstep/System/Library/Makefiles/GNUstep.sh \
153        && \
154        ${build.cmd} ${build.target} ${build.args}"
155}
156
157destroot {
158    set_gnustep_domain
159    set destroot.destdir \
160        GNUSTEP_INSTALLATION_DIR=${destroot}${prefix}/GNUstep/${gnustep.domain}
161    cd ${worksrcpath}
162    ui_debug "${destroot.cmd} ${destroot.target} \
163            ${destroot.args} ${destroot.destdir}"
164    system "\
165        . ${prefix}/GNUstep/System/Library/Makefiles/GNUstep.sh \
166        && \
167        ${destroot.cmd} ${destroot.target} \
168            ${destroot.args} ${destroot.destdir}"
169}
170
171# To build and install documentation provided by the port
172
173variant with_docs {
174    depends_build-append \
175        bin:texi2pdf:texinfo \
176        bin:texi2html:texi2html \
177        bin:pdftex:teTeX \
178        port:gnustep-base
179    post-destroot {
180        if {[file exists ${worksrcpath}/Documentation/GNUmakefile]} {
181            ui_msg "--->  Making Documentation for ${name}"
182            cd ${worksrcpath}/Documentation
183            system "\
184                . ${prefix}/GNUstep/System/Library/Makefiles/GNUstep.sh \
185                && \
186                ${destroot.cmd} ${destroot.target} \
187                    ${destroot.args} ${destroot.destdir}"
188            set info_dir \
189                ${destroot}${prefix}/GNUstep/System/Library/Documentation/info
190            if {[file exists ${info_dir}/manual.info]} {
191                set manual_name [regsub {gnustep-} ${name} ""]
192                file rename ${info_dir}/manual.info \
193                    ${info_dir}/${manual_name}-manual.info
194            }
195        } else {
196            ui_msg "--->  No Documentation for ${name}"
197        }
198    }   
199}
200
201