1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id: Portfile Wed Nov 26, 12:10:38 UTC 2014 rjvbertin@gmail.com $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup github 1.0 |
---|
6 | |
---|
7 | # fetch.type git |
---|
8 | # git.url git://github.com/qtproject/qtchooser |
---|
9 | # git.branch ae5eeef85c9a818bfa6a3e03511e3935e9abe01f |
---|
10 | |
---|
11 | github.setup qtproject qtchooser ae5eeef85c9a818bfa6a3e03511e3935e9abe01f |
---|
12 | name qtchooser |
---|
13 | version 39-13-gae5eeef |
---|
14 | |
---|
15 | checksums rmd160 cbcd4ef48f0f0924f2892d2f1de25cdccd4cbaac \ |
---|
16 | sha256 3898bba7ec75c361642eb3838cb66a3cd0613fb2aaad447065e91012ebd45ad5 |
---|
17 | |
---|
18 | categories devel qt4 qt5 |
---|
19 | |
---|
20 | description QTChooser allows to chose at runtime between multiple Qt versions installed in parallel |
---|
21 | |
---|
22 | long_description ${description} |
---|
23 | |
---|
24 | platforms darwin |
---|
25 | license LGPL-2+ |
---|
26 | maintainers gmail.com:rjvbertin |
---|
27 | |
---|
28 | homepage https://github.com/qtproject/qtchooser |
---|
29 | |
---|
30 | conflicts qt_select |
---|
31 | |
---|
32 | pre-extract { |
---|
33 | if {![file exists ${prefix}/libexec/qt4/bin/qmake] \ |
---|
34 | && ![file exists ${prefix}/libexec/qt5/bin/qmake] \ |
---|
35 | && ![file exists ${prefix}/libexec/qt5-mac/bin/qmake]} { |
---|
36 | return -code error "\n\nERROR:\n\ |
---|
37 | This port requires that qt4-mac and/or qt5-mac (or qt5-kde) be installed in concurrent mode." |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | patch.pre_args -Np1 |
---|
42 | if {${os.platform} eq "darwin"} { |
---|
43 | patchfiles-append patch-for-macports.diff |
---|
44 | } else { |
---|
45 | patchfiles-append patch-for-macports-linux.diff |
---|
46 | } |
---|
47 | |
---|
48 | configure { |
---|
49 | reinplace "s|prefix = @PREFIX@|prefix = ${prefix}|g" ${worksrcpath}/Makefile ${worksrcpath}/src/qtchooser/Makefile |
---|
50 | # correct the hardcoded path to the xdg "root" directory |
---|
51 | reinplace "s|\"@PREFIX@/etc/xdg\"|\"${prefix}/etc/xdg\"|g" ${worksrcpath}/src/qtchooser/main.cpp |
---|
52 | } |
---|
53 | |
---|
54 | build.args-append \ |
---|
55 | CC="${configure.cc}" \ |
---|
56 | CXX="${configure.cxx}" \ |
---|
57 | QTCHOOSER_GLOBAL_DIR="${prefix}/share:${prefix}/lib:${prefix}/lib/qt-default" \ |
---|
58 | CXXFLAGS="${configure.cflags}" |
---|
59 | |
---|
60 | variant qt4default conflicts qt5default description {make Qt4 the default Qt version} { |
---|
61 | } |
---|
62 | variant qt5default conflicts qt4default description {make Qt5 the default Qt version} { |
---|
63 | } |
---|
64 | if {![variant_isset qt5default] && ![variant_isset qt4default]} { |
---|
65 | default_variants +qt4default |
---|
66 | } |
---|
67 | |
---|
68 | destroot.keepdirs-append ${destroot}/${prefix}/lib/qt-default/qtchooser-mp |
---|
69 | post-destroot { |
---|
70 | xinstall -m 755 -d ${destroot}/${prefix}/etc/xdg/qtchooser-mp |
---|
71 | xinstall -m 755 -d ${destroot}/${prefix}/lib/qt-default/qtchooser-mp |
---|
72 | # we leave creating the actual conf files to the post-activate phase so |
---|
73 | # they will be adapted to what the user has installed at that moment. |
---|
74 | # Here, we only create the default.conf symlink. |
---|
75 | if {[variant_isset qt4default]} { |
---|
76 | ln -s qt4.conf ${destroot}/${prefix}/etc/xdg/qtchooser-mp/default.conf |
---|
77 | } elseif {[variant_isset qt5default]} { |
---|
78 | ln -s qt5.conf ${destroot}/${prefix}/etc/xdg/qtchooser-mp/default.conf |
---|
79 | } |
---|
80 | } |
---|
81 | |
---|
82 | post-activate { |
---|
83 | PortGroup qt4 1.0 |
---|
84 | system "echo ${qt_bins_dir} > ${prefix}/etc/xdg/qtchooser-mp/qt4.conf" |
---|
85 | system "echo ${qt_libs_dir} >> ${prefix}/etc/xdg/qtchooser-mp/qt4.conf" |
---|
86 | if {[info exists qt_qmake_cmd] && [file exists ${qt_qmake_cmd}]} { |
---|
87 | # don't care about the error, just inform the user on success |
---|
88 | if {![catch {system "${prefix}/bin/qtchooser-mp -install -f qt4-mac ${qt_qmake_cmd}"} err]} { |
---|
89 | ui_msg "Created an additional qt4-mac environment" |
---|
90 | } |
---|
91 | } |
---|
92 | PortGroup qt5 1.0 |
---|
93 | system "echo ${qt_bins_dir} > ${prefix}/etc/xdg/qtchooser-mp/qt5.conf" |
---|
94 | system "echo ${qt_libs_dir} >> ${prefix}/etc/xdg/qtchooser-mp/qt5.conf" |
---|
95 | if {[info exists qt_qmake_cmd] && [file exists ${qt_qmake_cmd}]} { |
---|
96 | if {[variant_exists qt5kde]} { |
---|
97 | set QT5MP "qt5-kde" |
---|
98 | } else { |
---|
99 | set QT5MP "qt5-mac" |
---|
100 | } |
---|
101 | if {![catch {system "${prefix}/bin/qtchooser-mp -install -f ${QT5MP} ${qt_qmake_cmd}"} err]} { |
---|
102 | ui_msg "Created an additional ${QT5MP} environment" |
---|
103 | } |
---|
104 | } |
---|
105 | ui_msg "\nKnown Qt installations that can be accessed via qtchooser-mp's -qt=<name> argument:" |
---|
106 | system "${prefix}/bin/qtchooser-mp -list-versions" |
---|
107 | } |
---|
108 | |
---|
109 | notes-append "You can now use `sudo qtchooser-mp -install <name> <path-to-qmake>` to create a profile \ |
---|
110 | allowing you to access that Qt installation via e.g. `qmake -qt=<name>` ." |
---|