Ticket #50500: Portfile

File Portfile, 7.1 KB (added by RJVB (René Bertin), 8 years ago)
Line 
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: Portfile 128101 2014-11-13 09:19:56Z ryandesign@macports.org $
3
4PortSystem          1.0
5
6name                qca
7
8# Qt version handling logic
9global Qt_Major
10subport ${name}-qt5 {}
11if {[string match "${name}-qt5*" ${subport}]} {
12    version         2.1.0.3
13    PortGroup       qt5 1.0
14    set Qt_Major    5
15    master_sites    http://download.kde.org/stable/qca-qt5/${version}/src
16    checksums       rmd160  cc4040d013170ca5f21fbcefd0607daa8191d333 \
17                    sha256  ab0170696a8ff87588d38a72d36d0b4b42db9080c991d1a40ceb3f8311d289f9
18    use_xz          yes
19    distname        "qca-qt5-${version}"
20    livecheck.regex "qca-qt5-(\\d+(?:\\.\\d+)*)"
21} else {
22    version         2.1.0
23    set branch      [join [lrange [split ${version} .] 0 0] .]
24    PortGroup       qt4 1.0
25    set Qt_Major    4
26    master_sites    http://delta.affinix.com/download/qca/${branch}.0/
27    checksums       md5     c2b00c732036244701bae4853a2101cf \
28                    sha1    2b582b3ccc7e6098cd14d6f52a829ae1539e9cc8 \
29                    rmd160  30358bbd182cfeb9eaa696b5b39fa9e6d1f99b4c
30    livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)"
31}
32PortGroup           cmake 1.0
33cmake.out_of_source yes
34
35categories          devel crypto security
36maintainers         michaelld gmail.com:rjvbertin openmaintainer
37license             LGPL-2.1
38description         Qt Cryptographic Architecture
39long_description \
40    Qt Cryptographic Architecture provides an easy API for the following \
41    features: SSL/TLS, X509, SASL, RSA, Hashing (SHA1, MD5), Ciphers \
42    (BlowFish, 3DES, AES).  Functionality is supplied via plugins.
43
44platforms           darwin
45
46homepage            http://delta.affinix.com/qca/
47
48depends_lib-append  port:botan \
49                    port:libgcrypt \
50                    port:nss
51
52# remove unnecessary Carbon #include, which fails on 10.8
53patchfiles-append   patch-src_qac_systemstore_mac.cpp.diff
54
55patchfiles-append   patch-qca-ossl.diff
56
57# 1) it seems that configure.pre_args --prefix=${qt_dir} has the desired effect, but
58# I don't know to what extent that uses an undocumented cmake feature, so use
59# the exhaustive list of install variables.
60# 2) the QCA plugins have been rolled into the main source tarball and are built by default
61# when their dependencies are available. Allow this for all plugins that were not already
62# available through an individual port; no reason to impose new dependencies on our dependents.
63configure.args          -DCMAKE_INSTALL_PREFIX:PATH=${qt_dir} \
64                        -DQCA_PLUGINS_INSTALL_DIR:PATH=${qt_plugins_dir} \
65                        -DQCA_LIBRARY_INSTALL_DIR:PATH=${qt_libs_dir} \
66                        -DQCA_BINARY_INSTALL_DIR:PATH=${qt_bins_dir} \
67                        -DQCA_FEATURE_INSTALL_DIR:PATH=${qt_mkspecs_dir}/features \
68                        -DQCA_INCLUDE_INSTALL_DIR:PATH=${qt_includes_dir} \
69                        -DQCA_PRIVATE_INCLUDE_INSTALL_DIR:PATH=${qt_includes_dir} \
70                        -DQCA_DOC_INSTALL_DIR:PATH=${qt_docs_dir} \
71                        -DQCA_MAN_INSTALL_DIR:PATH=${prefix}/share/man \
72                        -DPKGCONFIG_INSTALL_PREFIX:PATH=${qt_pkg_config_dir} \
73                        -DOSX_FRAMEWORK:BOOL=OFF \
74                        -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
75
76if {${Qt_Major} eq "4"} {
77    configure.args-append \
78                        -DQT4_BUILD:BOOL=ON
79} elseif {${Qt_Major} eq "5"} {
80    patchfiles-append   patch-qca210-qt550.diff
81    configure.args-append \
82                        -DQCA_SUFFIX:STRING="qt5"
83}
84
85# allow ccache, if specified by the user
86pre-build {
87    if {[tbool configure.ccache]} {
88        build.post_args "CCACHE=ccache"
89    }
90}
91
92post-destroot {
93    if {${subport} eq ${name} || ${subport} eq "${subport}-qt5"} {
94        # install docs
95        xinstall -d -m 755 ${destroot}${prefix}/share/doc/${subport}
96        xinstall -m 644 -W ${worksrcpath} COPYING README TODO \
97            ${destroot}${prefix}/share/doc/${subport}
98    }
99
100    if {${subport} eq "${name}"} {
101        # install cmake file (taken from port 'kdelibs4'). To use this
102        # file, include '-DCMAKE_MODULE_PATH=...' in configure.args during
103        # the initial 'configure' stage (which uses CMake), to the full
104        # path of where the CMake files are installed.
105        # note that QCA 2.1+ also installs .cmake files in ${qt_libs_dir}/cmake/Qca; I don't
106        # see a reason to move those so I'm leaving them there.
107        xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}
108        xinstall -m 644 -W ${filespath} FindQCA2.cmake \
109            ${destroot}${qt_cmake_module_dir}
110
111    }
112}
113
114# NB: it doesn't seem possible to build this way with the new cmake-based approach
115variant debug description \
116{Build both release and debug library} {
117    ui_msg "this variant is obsolete; use configure.optflags=\"-g\""
118    PortGroup   obsolete 1.0
119}
120
121# avoid installing the examples into Qt's binary tree
122variant examples description \
123{Include examples in install} {
124    post-destroot {
125        xinstall -d -m 755 ${destroot}${prefix}/share/${subport}/examples/
126        eval file copy [glob ${worksrcpath}/examples/*] \
127            ${destroot}${prefix}/share/${subport}/examples/
128    }
129}
130
131# NB: I haven't yet tested universal variants; those may require the muniversal portgroup
132# variant universal {
133#     # Add the universal flag understood by qmake
134#     configure.universal_args-append --universal
135# }
136
137### The ossl, cyrus-sasl and gnupg plugins that used to be standalone ports.
138### It makes more sense IMHO to implement them as subports. The other plugins
139### are built together with the main port; I don't see a reason to introduce
140### new subports for components that used to be built along with the main ports,
141### only to impose new dependencies on the ports that require qca.
142# Qt4 receives no suffix:
143set qt.versions     {"" "-qt5"}
144foreach qv ${qt.versions} {
145    subport ${name}${qv}-ossl {
146        license                 LGPL-2.1+
147        depends_lib-append      port:${name}${qv} port:openssl
148        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
149        configure.args-append   -DBUILD_PLUGINS:STRING="ossl"
150        build.dir               ${workpath}/build/plugins/qca-ossl
151    }
152    subport ${name}${qv}-cyrus-sasl {
153        license                 LGPL-2.1+
154        depends_lib-append      port:${name}${qv} port:cyrus-sasl2
155        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
156        configure.args-append   -DBUILD_PLUGINS:STRING="cyrus-sasl"
157        build.dir               ${workpath}/build/plugins/qca-cyrus-sasl
158    }
159    subport ${name}${qv}-gnupg {
160        license                 LGPL-2.1+
161        depends_lib-append      port:${name}${qv}
162        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
163        configure.args-append   -DBUILD_PLUGINS:STRING="gnupg"
164        build.dir               ${workpath}/build/plugins/qca-gnupg
165    }
166}
167
168livecheck.type  regex
169livecheck.url   ${master_sites}