Ticket #49109: qca.2.diff

File qca.2.diff, 10.7 KB (added by RJVB (René Bertin), 9 years ago)

This diff makes qca compatible with concurrent qt4-mac, upgrades it to the current version (which requires making qca-ossl a subport) and also introduces a qca-qt5 subport

  • devel/qca/Portfile

    old new  
    22# $Id: Portfile 128101 2014-11-13 09:19:56Z ryandesign@macports.org $
    33
    44PortSystem          1.0
    5 PortGroup           qt4 1.0
    65
    76name                qca
    8 version             2.0.3
    9 revision            1
    10 set branch          [join [lrange [split ${version} .] 0 1] .]
     7version             2.1.0
     8
     9# Qt version handling logic
     10global Qt_Major
     11subport ${name}-qt5 {}
     12if {[string match "${name}-qt5*" ${subport}]} {
     13    PortGroup       qt5 1.0
     14    set Qt_Major    5
     15} else {
     16    PortGroup       qt4 1.0
     17    set Qt_Major    4
     18}
     19PortGroup           cmake 1.0
     20cmake.out_of_source yes
     21
     22set branch          [join [lrange [split ${version} .] 0 0] .]
    1123categories          devel crypto security
    12 maintainers         michaelld openmaintainer
     24maintainers         michaelld gmail.com:rjvbertin openmaintainer
    1325license             LGPL-2.1
    1426description         Qt Cryptographic Architecture
    1527long_description \
     
    2032platforms            darwin
    2133
    2234homepage             http://delta.affinix.com/qca/
    23 master_sites         http://delta.affinix.com/download/qca/${branch}/
    24 use_bzip2            yes
    25 
    26 checksums            md5     fc15bd4da22b8096c51fcfe52d2fa309 \
    27                      sha1    9c868b05b81dce172c41b813de4de68554154c60 \
    28                      rmd160  333cfdce91fedfaec09c205528de52d7b569c521
    29 
    30 # (1) correct pkgconfig file for framework install, if selected.
    31 # (2) allow for 'debug' and 'framework' options at the same time.
    32 #     This change is needed to allow for +debug [+framework] --
    33 #     disallow just debug framework via no variants for it.
    34 # (3) allow simple replacement for universal arch arguments, if that
    35 #     variant is requested.
    36 patchfiles           patch-configure.diff
     35master_sites         http://delta.affinix.com/download/qca/${branch}.0/
     36#use_bzip2            yes
    3737
    38 # fix C++ inheritance for a specific class to make clang happy
    39 patchfiles-append    patch-src_botantools_botan_botan_secmem.h.diff
     38checksums           md5     c2b00c732036244701bae4853a2101cf \
     39                    sha1    2b582b3ccc7e6098cd14d6f52a829ae1539e9cc8 \
     40                    rmd160  30358bbd182cfeb9eaa696b5b39fa9e6d1f99b4c
     41
     42depends_lib-append  port:botan \
     43                    port:libgcrypt \
     44                    port:nss
    4045
    4146# remove unnecessary Carbon #include, which fails on 10.8
    42 patchfiles-append    patch-src_qac_systemstore_mac.cpp.diff
     47patchfiles-append   patch-src_qac_systemstore_mac.cpp.diff
    4348
    44 post-patch {
    45     # set arch type(s)
    46     reinplace "s|@ARCHES@|${qt_arch_types}|g" \
    47         ${worksrcpath}/configure
    48 
    49     # since Qt now uses the correct install_name for libraries,
    50     # remove that from QCA's library
    51     reinplace "/QMAKE_LFLAGS_SONAME/d" \
    52         ${worksrcpath}/src/src.pro
    53 }
    54 
    55 # set QCA to install into the QT4 directory
    56 configure.pre_args   --prefix=${qt_dir}
    57 
    58 # defaults: release only, no-framework, specific build_arch.
    59 # use variants to change everything except framework
    60 configure.args        --verbose         \
    61                       --qtdir=${qt_dir} \
    62                       --release         \
    63                       --no-framework
    64 
    65 # QCA's configure does not handle this flag,
    66 # but does not generate an error either.
    67 configure.universal_args-delete --disable-dependency-tracking
    68 configure.args-delete  --disable-dependency-tracking
     49patchfiles-append   patch-qca-ossl.diff
     50
     51# 1) it seems that configure.pre_args --prefix=${qt_dir} has the desired effect, but
     52# I don't know to what extent that uses an undocumented cmake feature, so use
     53# the exhaustive list of install variables.
     54# 2) the QCA plugins have been rolled into the main source tarball and are built by default
     55# when their dependencies are available. Allow this for all plugins that were not already
     56# available through an individual port.
     57configure.args          -DCMAKE_INSTALL_PREFIX:PATH=${qt_dir} \
     58                        -DQCA_PLUGINS_INSTALL_DIR:PATH=${qt_plugins_dir} \
     59                        -DQCA_LIBRARY_INSTALL_DIR:PATH=${qt_libs_dir} \
     60                        -DQCA_BINARY_INSTALL_DIR:PATH=${qt_bins_dir} \
     61                        -DQCA_FEATURE_INSTALL_DIR:PATH=${qt_mkspecs_dir}/features \
     62                        -DQCA_INCLUDE_INSTALL_DIR:PATH=${qt_includes_dir} \
     63                        -DQCA_PRIVATE_INCLUDE_INSTALL_DIR:PATH=${qt_includes_dir} \
     64                        -DQCA_DOC_INSTALL_DIR:PATH=${qt_docs_dir} \
     65                        -DQCA_MAN_INSTALL_DIR:PATH=${prefix}/share/man \
     66                        -DPKGCONFIG_INSTALL_PREFIX:PATH=${qt_pkg_config_dir} \
     67                        -DOSX_FRAMEWORK:BOOL=OFF \
     68                        -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
     69
     70if {${Qt_Major} eq "4"} {
     71    configure.args-append \
     72                        -DQT4_BUILD:BOOL=ON
     73    if {${qt_dir} ne ${prefix}} {
     74       # temporary transitional variant to accompany qt4-mac's transitional subport:
     75       variant transitional description \
     76            {temporary variant that allows to install Qt4 and QCA "concurrently" without having to rebuild all dependents} {}
     77       if {[file exists ${prefix}/lib/libQtCore.4.dylib]} {
     78            default_variants  +transitional
     79       }
     80    }
     81} elseif {${Qt_Major} eq "5"} {
     82    configure.args-append \
     83                        -DQCA_SUFFIX:STRING="qt5"
     84}
    6985
    7086# allow ccache, if specified by the user
    7187pre-build {
     
    7591}
    7692
    7793post-destroot {
    78     # alias to destroot QCA top-level directory
    79     set destroot_qt ${destroot}${qt_dir}
     94    if {${subport} eq ${name} || ${subport} eq "${subport}-qt5"} {
     95        # install docs
     96        xinstall -d -m 755 ${destroot}${prefix}/share/doc/${subport}
     97        xinstall -m 644 -W ${worksrcpath} COPYING README TODO \
     98            ${destroot}${prefix}/share/doc/${subport}
     99    }
    80100
    81     # install docs
    82     xinstall -d -m 755 ${destroot_qt}/share/doc/${name}
    83     xinstall -m 644 -W ${worksrcpath} COPYING README TODO \
    84         ${destroot_qt}/share/doc/${name}
    85 
    86     # install cmake file (taken from port 'kdelibs4'). To use this
    87     # file, include '-DCMAKE_MODULE_PATH=...' in configure.args during
    88     # the initial 'configure' stage (which uses CMake), to the full
    89     # path of where the CMake files are installed.
    90     xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}
    91     xinstall -m 644 -W ${filespath} FindQCA2.cmake \
    92         ${destroot}${qt_cmake_module_dir}
     101    if {${subport} eq "${name}"} {
     102        # install cmake file (taken from port 'kdelibs4'). To use this
     103        # file, include '-DCMAKE_MODULE_PATH=...' in configure.args during
     104        # the initial 'configure' stage (which uses CMake), to the full
     105        # path of where the CMake files are installed.
     106        # note that QCA 2.1+ also installs .cmake files in ${qt_libs_dir}/cmake/Qca; I don't
     107        # currently know what to do with those so I'm leaving them there.
     108        xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}
     109        xinstall -m 644 -W ${filespath} FindQCA2.cmake \
     110            ${destroot}${qt_cmake_module_dir}
     111
     112        # check if Qt4 was installed in concurrent mode; should become unconditional
     113        # once Qt4 can only install that way.
     114        if {${qt_dir} ne ${prefix}} {
     115            # temporary
     116            if {[variant_isset transitional]} {
     117                ln -s ${qt_libs_dir}/libqca.2.dylib ${destroot}${prefix}/lib
     118            }
     119            # move the pkgconfig file to its designated location
     120            #move ${destroot}${qt_libs_dir}/pkgconfig/qca2.pc ${destroot}/${qt_pkg_config_dir}
     121        }
     122    }
    93123}
    94124
     125# NB: it doesn't seem possible to build this way with the new cmake-based approach
    95126variant debug description \
    96127{Build both release and debug library} {
    97     configure.args-delete --release
    98     configure.args-append --debug-and-release
     128    ui_msg "this variant is obsolete"
     129    PortGroup   obsolete 1.0
    99130}
    100131
     132# avoid installing the examples into Qt's binary tree
    101133variant examples description \
    102134{Include examples in install} {
    103135    post-destroot {
    104         xinstall -d -m 755 ${destroot}${qt_dir}/share/examples/${name}
     136        xinstall -d -m 755 ${destroot}${prefix}/share/${subport}/examples/
    105137        eval file copy [glob ${worksrcpath}/examples/*] \
    106             ${destroot}${qt_dir}/share/examples/${name}
     138            ${destroot}${prefix}/share/${subport}/examples/
    107139    }
    108140}
    109141
    110 platform darwin 8 {
    111     # might not be necessary
    112     if {[variant_exists universal] && [variant_isset universal]} {
    113         configure.args-append --mac-sdk=${developer_dir}/SDKs/MacOSX10.4u.sdk
     142# NB: I haven't yet tested universal variants; those may require the muniversal portgroup
     143# variant universal {
     144#     # Add the universal flag understood by qmake
     145#     configure.universal_args-append --universal
     146# }
     147
     148### The ossl, cyrus-sasl and gnupg plugins that used to be standalone ports.
     149### It makes more sense IMHO to implement them as subports. The other plugins
     150### are built together with the main port. I'd have done the same thing for the
     151### plugins below, but that would have meant changing all dependents and could
     152### have licensing implications.
     153# Qt4 receives no suffix:
     154set qt.versions     {"" "-qt5"}
     155foreach qv ${qt.versions} {
     156    subport ${name}${qv}-ossl {
     157        license                 LGPL-2.1+
     158        depends_lib-append      port:${name}${qv} port:openssl
     159        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
     160        configure.args-append   -DBUILD_PLUGINS:STRING="ossl"
     161        build.dir               ${workpath}/build/plugins/qca-ossl
     162    }
     163    subport ${name}${qv}-cyrus-sasl {
     164        license                 LGPL-2.1+
     165        depends_lib-append      port:${name}${qv} port:cyrus-sasl2
     166        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
     167        configure.args-append   -DBUILD_PLUGINS:STRING="cyrus-sasl"
     168        build.dir               ${workpath}/build/plugins/qca-cyrus-sasl
     169    }
     170    subport ${name}${qv}-gnupg {
     171        license                 LGPL-2.1+
     172        depends_lib-append      port:${name}${qv}
     173        configure.args-delete   -DBUILD_PLUGINS:STRING="botan\;gcrypt\;logger\;nss\;softstore"
     174        configure.args-append   -DBUILD_PLUGINS:STRING="gnupg"
     175        build.dir               ${workpath}/build/plugins/qca-gnupg
    114176    }
    115 }
    116 
    117 variant universal {
    118     # Add the universal flag understood by qmake
    119     configure.universal_args-append --universal
    120177}
    121178
    122179livecheck.type  regex
    123 livecheck.url   ${homepage}
    124 livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
     180livecheck.url   ${master_sites}
     181livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)"