1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id$ |
---|
3 | # |
---|
4 | # Copyright (c) 2014 The MacPorts Project |
---|
5 | # All rights reserved. |
---|
6 | # |
---|
7 | # Redistribution and use in source and binary forms, with or without |
---|
8 | # modification, are permitted provided that the following conditions are |
---|
9 | # met: |
---|
10 | # |
---|
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 The MacPorts Project nor the names of its |
---|
17 | # contributors may be used to endorse or promote products derived from |
---|
18 | # this software without specific prior written permission. |
---|
19 | # |
---|
20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
---|
24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
---|
26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
---|
27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
---|
28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
---|
29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
---|
30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
31 | # |
---|
32 | # |
---|
33 | # This PortGroup adds dependencies and arguments for building with gobject |
---|
34 | # introspection. There is just one option to set: |
---|
35 | # |
---|
36 | # gobject_introspection: whether to use gobject introspection. The default |
---|
37 | # is no. Possible values are yes and no. |
---|
38 | # |
---|
39 | # It is imperative to either set this option *after* you set the port's |
---|
40 | # dependencies, not before, or alternately, ensure you always append to |
---|
41 | # dependencies rather than overwriting them. Otherwise you'll overwrite |
---|
42 | # the dependencies the portgroup sets. |
---|
43 | |
---|
44 | options gobject_introspection |
---|
45 | default gobject_introspection no |
---|
46 | option_proc gobject_introspection gobject_introspection._set |
---|
47 | |
---|
48 | proc gobject_introspection._set {option action args} { |
---|
49 | if {"set" ne ${action}} { |
---|
50 | return |
---|
51 | } |
---|
52 | |
---|
53 | if {${args}} { |
---|
54 | depends_lib-append port:gobject-introspection |
---|
55 | |
---|
56 | platform darwin 8 { |
---|
57 | depends_build-append port:gmake |
---|
58 | } |
---|
59 | } else { |
---|
60 | depends_lib-delete port:gobject-introspection |
---|
61 | |
---|
62 | platform darwin 8 { |
---|
63 | depends_build-delete port:gmake |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | pre-configure { |
---|
69 | if {${gobject_introspection}} { |
---|
70 | configure.args-append --enable-introspection |
---|
71 | } else { |
---|
72 | configure.args-append --disable-introspection |
---|
73 | } |
---|
74 | } |
---|
75 | |
---|
76 | pre-build { |
---|
77 | if {${gobject_introspection}} { |
---|
78 | # gobject-introspection uses g-ir-scanner, which uses $CC from env |
---|
79 | if {[info exists universal_archs_to_use]} { |
---|
80 | global merger_build_args |
---|
81 | foreach arch ${universal_archs_to_use} { |
---|
82 | lappend merger_build_args(${arch}) CC='${configure.cc} -arch ${arch}' |
---|
83 | } |
---|
84 | } else { |
---|
85 | build.args-append CC="${configure.cc} ${configure.cc_archflags}" |
---|
86 | } |
---|
87 | |
---|
88 | # The rules enabled by gobject-introspection require GNU make 3.81+ |
---|
89 | platform darwin 8 { |
---|
90 | build.cmd-replace [portbuild::build_getmaketype] ${prefix}/bin/gmake |
---|
91 | } |
---|
92 | } |
---|
93 | } |
---|