Ticket #48562: Portfile

File Portfile, 7.9 KB (added by ghweber@…, 9 years ago)
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# $Id: Portfile 135888 2015-05-06 14:38:46Z petr@macports.org $
3
4PortSystem          1.0
5
6name                qwt
7categories          graphics science
8# actually a little more permissive than the standard LGPL, but the
9# distinction doesn't matter to us.
10license             LGPL-2.1
11maintainers         michaelld openmaintainer
12homepage            http://qwt.sourceforge.net
13
14master_sites        sourceforge:qwt
15use_bzip2           yes
16use_parallel_build  no
17
18platforms           darwin
19
20if {${subport} eq ${name}} {
21
22    version         5.1.2
23    distname        qwt-${version}
24    revision        2
25    conflicts       qwt52 qwt60 qwt61 qwt-devel
26    checksums       sha1 2fc04b78c438635a78e41a22fea6f9e016f7ca17 \
27                    rmd160 a5a94aa3870a631f9605e6370c4d04fb1c79347e
28    patchfiles      patch-qwtconfig.pri.51.diff
29    livecheck.url   http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss
30    livecheck.regex \\/qwt\\/(5\\.1\\.\\d+)\\/
31
32}
33
34subport qwt52 {
35
36    version         5.2.3
37    distname        qwt-${version}
38    conflicts       qwt qwt60 qwt61 qwt-devel
39    checksums       sha1    ff81595a1641a8b431f98d6091bb134bc94e0003 \
40                    rmd160  9b2128ad2b53a65678f9ea57d34cdc73a3674d21
41    patchfiles      patch-qwtconfig.pri.52.diff
42    livecheck.url   http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss
43    livecheck.regex \\/qwt\\/(5\\.2\\.\\d+)\\/
44
45}
46
47subport qwt60 {
48
49    version         6.0.2
50    distname        qwt-${version}
51    conflicts       qwt qwt52 qwt61 qwt-devel
52    checksums       sha1    cbdd00b29521987c9e7bc6aa51092f0474b9428d \
53                    rmd160  c9d31f40b6001f09c59dbf4c0628ddd860474821
54    patchfiles      patch-qwtconfig.pri.60.diff \
55                    patch-qwtbuild.pri.60.diff \
56                    patch-qwtfunctions.pri.60.diff \
57                    patch-designer_designer.pro.60.diff
58    livecheck.url   http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss
59    livecheck.regex \\/qwt\\/(6\\.0\\.\\d+)\\/
60
61}
62
63subport qwt61 {
64
65    version         6.1.2
66    distname        qwt-6.1.2
67    conflicts       qwt qwt52 qwt60 qwt-devel
68    checksums       sha1    6af82b6ee4132f779d1c8c2db872f01463b0d61c \
69                    rmd160  6c8ba1b974aae55f5a0614d345d59af8fb77f21a
70    patchfiles      patch-qwtconfig.pri.61.diff \
71                    patch-qwtbuild.pri.61.diff \
72                    patch-designer_designer.pro.61.diff
73    livecheck.url   http://sourceforge.net/api/file/index/project-id/13693/mtime/desc/rss
74    livecheck.regex \\/(6\\.1\\.\\d-rc\\d)\\/
75
76}
77
78subport qwt-devel {
79
80    version         6.1.0-rc3
81    revision        1
82    distfiles
83    distname
84    conflicts       qwt qwt52 qwt60 qwt61
85    replaced_by     qwt61
86    livecheck.url   none
87
88pre-configure {
89    ui_error "Please do not install this subport since it has been replaced by 'qwt61'."
90    return -code error
91}
92
93}
94
95
96# get qwt's version numbers
97
98global qwt_major, qwt_minor, qwt_patch
99set qwt_vers [split ${version} "."]
100set qwt_major [lindex ${qwt_vers} 0]
101set qwt_minor [lindex ${qwt_vers} 1]
102set qwt_patch [lindex ${qwt_vers} 2]
103set qwt_maj_min ${qwt_major}.${qwt_minor}
104
105description         QWT: Qt Widgets for Technical Applications, \
106    Version ${qwt_maj_min}
107
108long_description ${description}\nThe Qwt library contains GUI \
109    Components and utility classes which are primarily useful for \
110    programs with a technical background. Beside a 2D plot widget it \
111    provides scales, sliders, dials, compasses, thermometers, wheels \
112    and knobs to control or display values, arrays, or ranges of type \
113    double. QWT version ${qwt_maj_min} contains source incompatible \
114    changes versus other versions of QWT.
115
116post-patch {
117
118    # setup for debug, if selected
119
120    if {[variant_isset debug]} {
121        if {${qwt_major} == 5} {
122            reinplace "/CONFIG/s@release@debug_and_release build_all@" \
123                ${worksrcpath}/qwtconfig.pri
124        } else {
125            reinplace "/CONFIG/s@release@debug_and_release build_all@" \
126                ${worksrcpath}/qwtbuild.pri
127        }
128    }
129
130    # set arch type(s)
131
132    if {${qwt_major} == 5} {
133        reinplace "s/@ARCHES@/${qt_arch_types}/" \
134            ${worksrcpath}/qwtconfig.pri
135    } else {
136        reinplace "s/@ARCHES@/${qt_arch_types}/" \
137            ${worksrcpath}/qwtbuild.pri
138    }
139
140    # setup for examples, if selected
141
142    if {![variant_isset examples]} {
143        reinplace "s@QwtExamples@@" \
144            ${worksrcpath}/qwtconfig.pri
145    }
146}
147
148if {${qwt_major} < 6} {
149
150    # QWT version 5 can work with Qt3 or Qt4
151
152    variant qt3 conflicts qt4 description {Use qt3-mac} {}
153
154    variant qt4 conflicts qt3 description {Use qt4-mac} {}
155
156    # move setting of 'qt_qmake_cmd' outside variants, since 'if'
157    # statements are processed in-order while variants are processed after
158    # everything else.
159
160    set qt_qmake_cmd ""
161
162    if {[variant_isset qt3]} {
163
164        depends_lib-append  port:qt3-mac
165        set qt_qmake_cmd    ${prefix}/libexec/qt3-mac/bin/qmake
166
167    } else {
168
169        # when variant 'qt3' is not set, use qt4 whether by default or via
170        # the user's variant choice
171
172        if {![variant_isset qt4]} {
173            default_variants    +qt4
174        }
175        PortGroup           qt4 1.0
176
177    }
178} else {
179
180    # QWT 6+ uses Qt4+ only
181    PortGroup qt4 1.0
182
183}
184
185configure.cmd       ${qt_qmake_cmd}
186configure.pre_args  INSTALLBASE="${prefix}"
187
188# qmake does not handle these flags flags
189configure.universal_args-delete --disable-dependency-tracking
190configure.args-delete           --disable-dependency-tracking
191
192# allow ccache, if specified by the user
193pre-build {
194    if {[tbool configure.ccache]} {
195        build.post_args "CCACHE=ccache"
196    }
197}
198
199post-destroot {
200
201    # if qwt is installed as a framework,
202    # link in as libraries and headers too
203
204    if {[file exists ${destroot}${qt_frameworks_dir}/qwt.framework/qwt]} {
205
206        global qwt_major, qwt_minor, qwt_patch
207        foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
208                             -name "*.framework" | \
209                             sed -e "s@${destroot}@@g"] {
210
211            set tf_full [strsed ${fixfile} {s@\\.framework@@}]
212            set tf [strsed ${tf_full} {g@.*\/@@}]
213
214            # link headers into ${qt_includes_dir}, removing
215            # directories if they are already there first
216
217            set inc_file ${destroot}${qt_includes_dir}/${tf}
218            if {[file exists ${inc_file}]} {
219                file delete -force ${inc_file}
220            }
221            ln -s ${tf_full}.framework/Headers ${inc_file}
222
223            # link libraries into ${qt_libs_dir}
224
225            set libs_dir ${destroot}${qt_libs_dir}
226
227            ln -s ${tf_full}.framework/${tf} \
228                ${libs_dir}/lib${tf}.dylib
229            ln -s ${tf_full}.framework/${tf} \
230                ${libs_dir}/lib${tf}.${qwt_major}.dylib
231            ln -s ${tf_full}.framework/${tf} \
232                ${libs_dir}/lib${tf}.${qwt_major}.${qwt_minor}.dylib
233            ln -s ${tf_full}.framework/${tf} \
234                ${libs_dir}/lib${tf}.${qwt_major}.${qwt_minor}.${qwt_patch}.dylib
235
236            if {[variant_isset debug]} {
237
238                # link debug libraries into ${qt_libs_dir}
239
240                ln -s ${tf_full}.framework/${tf}_debug \
241                    ${libs_dir}/lib${tf}_debug.dylib
242                ln -s ${tf_full}.framework/${tf}_debug \
243                    ${libs_dir}/lib${tf}_debug.${qwt_major}.dylib
244                ln -s ${tf_full}.framework/${tf}_debug \
245                    ${libs_dir}/lib${tf}_debug.${qwt_major}.${qwt_minor}.dylib
246                ln -s ${tf_full}.framework/${tf}_debug \
247                    ${libs_dir}/lib${tf}_debug.${qwt_major}.${qwt_minor}.${qwt_patch}.dylib
248
249            }
250        }
251    }
252}
253
254variant debug description "Build release and debug versions" {}
255
256variant examples description "Build examples" {}