Ticket #47883: Portfile

File Portfile, 6.3 KB (added by RJVB (René Bertin), 9 years ago)
Line 
1# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
2# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 4;
3# $Id: Portfile 133968 2015-03-16 09:49:19Z petr@macports.org $
4
5PortSystem          1.0
6PortGroup           cmake 1.0
7cmake.out_of_source yes
8
9name                GammaRay
10version             2.2.50
11
12description         a Qt poking-around tool.
13long_description    GammaRay is a tool to poke around in a Qt-application and also to manipulate the application to some extent.
14
15homepage            http://www.kdab.com/kdab-products/gammaray/
16categories          devel
17platforms           darwin
18license             {GPL-2 GPL-3}
19maintainers         gmail.com:rjvbertin openmaintainer
20universal_variant   no
21installs_libs       no
22
23if {${subport} ne ${name}} {
24    fetch.type          git
25    git.branch          9e4d6de641b9cb293bbe932c8bfc0480ea05dbbb
26    if {[file exists ${filespath}/${name}-git/.git]} {
27        git.url         file://${filespath}/${name}-git
28    } else {
29        PortGroup       github 1.0
30        github.setup    KDAB GammaRay ${git.branch}
31    }
32}
33
34depends_build-append    port:git port:doxygen
35depends_lib-append      port:graphviz \
36                        port:openssl \
37                        port:perl5
38
39variant kde description {build KDE support (currently only KDE4)} {}
40
41configure.args-append   -DCMAKE_DISABLE_FIND_PACKAGE_VTK=true
42
43subport ${name}-qt4 {
44    description-append      Includes the Qt4 probe
45    long_description-append This port includes the Qt4 probe
46    PortGroup               qt4 1.0
47    conflicts               ${name}-qt4
48    configure.args-append   -DGAMMARAY_ENFORCE_QT4_BUILD=true
49    depends_lib-append      port:automoc port:phonon
50    if {[variant_isset kde]} {
51        depends_lib-append  port:kdelibs4
52    }
53}
54
55subport ${name}-qt5 {
56    description-append      Includes the Qt5 probe
57    long_description-append This port includes the Qt5 probe
58    PortGroup               qt5 1.0
59    conflicts               ${name}-qt5
60    # this can optionally depend also on https://github.com/KDAB/KDStateMachineEditor
61    if {[variant_isset kde]} {
62        notes-append "KDE support with Qt5 requires KF5 which is not yet available on OS X"
63    }
64}
65
66# GammaRay doesn't support building multiple Qt probes in a single go, so we can
67# only provide a "probe" subport that can build either the Qt4 or the Qt5 subport.
68subport ${name}-probe {
69    description                 The Qt4/Qt5 probe for ${name}-qt5/${name}-qt4
70    long_description-append     This port builds either the Qt4 for ${name}-qt5 or the Qt5 probe for ${name}-qt4.
71
72    configure.args-append       -DGAMMARAY_PROBE_ONLY_BUILD=true
73
74    variant qt4 conflicts qt5 description {build the Qt4 probe for ${name}-qt5} {
75        PortGroup               qt4 1.0
76        conflicts               ${name}-qt4
77        depends_run-append      port:${name}-qt5
78        depends_lib-append      port:automoc port:phonon
79        if {[variant_isset kde]} {
80            depends_lib-append  port:kdelibs4
81        }
82        configure.args-append   -DGAMMARAY_ENFORCE_QT4_BUILD=true
83    }
84
85    variant qt5 conflicts qt4 description {build the Qt5 probe for ${name}-qt4} {
86        PortGroup               qt5 1.0
87        conflicts               ${name}-qt5
88        depends_lib-append      port:${name}-qt4
89        if {[variant_isset kde]} {
90            notes-append "KDE support with Qt5 requires KF5 which is not yet available on OS X"
91        }
92    }
93
94    pre-fetch {
95        if {![variant_isset qt4] && ![variant_isset qt5]} {
96             return -code error "\n\nERROR:\n\
97        You must select either the qt4 or the qt5 variant\n"
98        }
99    }
100}
101
102patchfiles-append           patch-prefer-lldb.diff
103
104if {![variant_isset kde]} {
105    patchfiles-append       patch-no-KDE.diff
106}
107
108if {${subport} eq "${name}-qt4"} {
109    # this space intentionally left empty - for now
110} elseif {${subport} eq "${name}-qt5"} {
111    # this space intentionally left empty - for now
112} else {
113    if {${subport} eq ${name}} {
114        # default version to install is the Qt5 version because it (supposedly) works so much better.
115        depends_lib             port:${name}-qt5
116        description-append      Installs ${depends_lib}
117        long_description-append This is a stub port that will install ${depends_lib}
118    } elseif {${subport} eq "${name}-probe"} {
119        depends_lib
120    }
121    if {![variant_isset qt4] && ![variant_isset qt5]} {
122        supported_archs         noarch
123        archive_sites
124        distfiles
125        patchfiles
126        depends_fetch
127        depends_build
128        use_configure           no
129        fetch                   {}
130        build                   {}
131        destroot                {
132            xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
133            system "gzip -9v < [exec port logfile ${name}] > ${destroot}${prefix}/share/doc/${name}/install.log.gz"
134        }
135    }
136}
137
138post-destroot {
139    if {${subport} ne ${name}} {
140        xinstall -m 755 -d ${destroot}/${qt_apps_dir}
141        xinstall -m 755 -d ${destroot}/${qt_mkspecs_dir}/modules
142        if {${subport} eq "${name}-probe"} {
143            delete ${destroot}/${prefix}/GammaRay.app/Contents/Resources
144            delete ${destroot}/${prefix}/mkspecs
145        } else {
146            move ${destroot}/${prefix}/GammaRay.app/Contents/Resources/cmake ${destroot}${prefix}/share
147            move ${destroot}/${prefix}/GammaRay.app/Contents/Resources/include/gammaray ${destroot}${prefix}/include
148            delete ${destroot}/${prefix}/GammaRay.app/Contents/Resources/include
149            delete ${destroot}/${prefix}/GammaRay.app/Contents/Resources/man
150            foreach pri [glob  ${destroot}/${prefix}/mkspecs/modules/*] {
151                move ${pri} ${destroot}/${qt_mkspecs_dir}/modules
152            }
153        }
154        foreach pri [glob  ${destroot}/${prefix}/GammaRay.app/Contents/Frameworks/*.dylib] {
155            move ${pri} ${destroot}${prefix}/lib
156        }
157    #     move ${destroot}/${prefix}/GammaRay.app/Contents/MacOS/gammaray ${destroot}${prefix}/bin
158        delete ${destroot}/${prefix}/GammaRay.app/Contents/MacOS/gammaray
159        move ${destroot}/${prefix}/GammaRay.app ${destroot}/${qt_apps_dir}
160    }
161}