Bump version to 0.36.9
[cygport.git] / cygclass / qt5.cygclass
blob30637b5cf362a8109d49dc751eadbc58e492ccc7
1 ################################################################################
3 # qt5.cygclass - functions for building Qt5-dependent packages
5 # Part of cygport - Cygwin packaging application
6 # Copyright (C) 2006-2020 Cygport authors
7 # Provided by the Cygwin project <https://cygwin.com/>
9 # cygport is free software: you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
14 # cygport is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with cygport.  If not, see <https://www.gnu.org/licenses/>.
22 ################################################################################
24 #****h* Cygclasses/qt5.cygclass
25 #  SYNOPSIS
26 #  inherit qt5
27 #  DESCRIPTION
28 #  Qt is a C++ cross-platform application framework for writing desktop GUI
29 #  applications.  Qt is the underlying toolkit used by the KDE desktop
30 #  environment.
32 #  This cygclass provides definitions and install functions which can be used
33 #  by all Qt5-based packages, regardless of the build system being used.
34 #  NOTES
35 #  * Packages based on the previous 3.x or 4.x versions of Qt must use
36 #    qt3.cygclass or qt4.cygclass, respectively.
37 #  INHERITED BY
38 #  qt5-qmake.cygclass
39 #****
41 #****d* qt5.cygclass/QT5_QTDIR
42 #  DESCRIPTION
43 #  Root directory for the Qt5 installation.
44 #****
45 #****d* qt5.cygclass/QT5_BINDIR
46 #  DESCRIPTION
47 #  Directory containing the Qt5 build tools.
48 #****
49 #****d* qt5.cygclass/QT5_INCLUDEDIR
50 #  DESCRIPTION
51 #  Directory containing the Qt5 library headers.
52 #****
53 #****d* qt5.cygclass/QT5_LIBDIR
54 #  DESCRIPTION
55 #  Directory containing the Qt5 link libraries.
56 #****
57 #****d* qt5.cygclass/QT5_PLUGINSDIR
58 #  DESCRIPTION
59 #  Installation path for Qt5 plugins.
60 #****
61 #****d* qt5.cygclass/QT5_IMPORTSDIR
62 #  DESCRIPTION
63 #  Installation path for Qt5 Quick 1 extensions.
64 #****
65 #****d* qt5.cygclass/QT5_QMLDIR
66 #  DESCRIPTION
67 #  Installation path for Qt5 Quick 2 extensions.
68 #****
69 #****d* qt5.cygclass/QT5_DATADIR
70 #  DESCRIPTION
71 #  Directory containing Qt5 documentation, and translation data.
72 #****
73 #****d* qt5.cygclass/QT5_MKSPECSDIR
74 #  DESCRIPTION
75 #  Installation path for Qt5 QMake specs files.
76 #****
77 #****d* qt5.cygclass/QT5_QMAKE
78 #  DESCRIPTION
79 #  Absolute path to the Qt5 project and Makefile generator
80 #****
81 #****d* qt5.cygclass/QT5_MOC
82 #  DESCRIPTION
83 #  Absolute path to the Qt5 Meta-Object Compiler
84 #****
85 #****d* qt5.cygclass/QT5_RCC
86 #  DESCRIPTION
87 #  Absolute path to the Qt5 resource compiler
88 #****
89 #****d* qt5.cygclass/QT5_UIC
90 #  DESCRIPTION
91 #  Absolute path to the Qt5 User Interface Compiler
92 #****
93 #****d* qt5.cygclass/QT5_LRELEASE
94 #  DESCRIPTION
95 #  Absolute path to the Qt5 Linguist translation compiler
96 #****
98 if inherited cross
99 then
100         QT5_QTDIR=${CROSS_PREFIX}
101         QT5_QMAKE=/usr/bin/${CROSS_HOST}-qmake-qt5
102 elif inherited toolchain
103 then
104         QT5_QTDIR=${TOOLCHAIN_PREFIX}
105         QT5_QMAKE=/usr/bin/${TOOLCHAIN_TARGET}-qmake-qt5
106 else
107         QT5_QTDIR=/usr/lib/qt5
108         QT5_QMAKE=/usr/bin/qmake-qt5
111 QT5_BINDIR=$(${QT5_QMAKE} -query QT_HOST_BINS)
112 QT5_INCLUDEDIR=$(${QT5_QMAKE} -query QT_INSTALL_HEADERS)
113 QT5_LIBDIR=$(${QT5_QMAKE} -query QT_INSTALL_LIBS)
114 QT5_PLUGINSDIR=$(${QT5_QMAKE} -query QT_INSTALL_PLUGINS)
115 QT5_IMPORTSDIR=$(${QT5_QMAKE} -query QT_INSTALL_IMPORTS)
116 QT5_QMLDIR=$(${QT5_QMAKE} -query QT_INSTALL_QML)
117 QT5_DATADIR=$(${QT5_QMAKE} -query QT_INSTALL_DATA)
118 QT5_MKSPECSDIR=$(${QT5_QMAKE} -query QT_HOST_DATA)/mkspecs
119 QT5_MOC=${QT5_BINDIR}/moc
120 QT5_RCC=${QT5_BINDIR}/rcc
121 QT5_UIC=${QT5_BINDIR}/uic
122 QT5_LRELEASE=${QT5_BINDIR}/lrelease
125 __qt5_qmakespec() {
126         local spec
128         # FIXME: -64 varieties, qws/*
129         case ${1} in
130         *-ibm-aix*)        spec="aix-g++" ;;
131         *-linux-android*)  spec="android-g++" ;;
132         *-*-cygwin*)       spec="cygwin-g++" ;;
133         *-*-darwin*)       spec="darwin-g++" ;;
134         *-*-freebsd*)      spec="freebsd-g++" ;;
135         *-*-hpux)          spec="hpux-g++" ;;
136         *-*-irix)          spec="irix-g++" ;;
137         *-*-linux*)        spec="linux-g++" ;;
138         *-*-lynxos*)       spec="lynxos-g++" ;;
139         *-*-netbsd*)       spec="netbsd-g++" ;;
140         *-*-openbsd*)      spec="openbsd-g++" ;;
141         *-*-sco*)          spec="sco-g++" ;;
142         *-*-solaris*)      spec="solaris-g++" ;;
143         *-*-osf*)          spec="tru64-g++" ;;
144         *-*-sysv4.2uw*)    spec="unixware-g++" ;;
145         *-*-mingw*)        spec="win32-g++" ;;
146         # must be last to avoid false positives from *-*-KERNEL-gnu
147         *-*-gnu*)          spec="hurd-g++" ;;
148         *)      error "Host ${CHOST} is not supported by Qt5" ;;
149         esac
151         echo -n ${spec}
154 QMAKESPEC=$(__qt5_qmakespec ${CBUILD})
155 if inherited toolchain
156 then
157         XQMAKESPEC=$(__qt5_qmakespec ${CTARGET})
158 elif cross_compiling
159 then
160         XQMAKESPEC=$(__qt5_qmakespec ${CHOST})
163 export PATH="${QT5_BINDIR}:${PATH}"
165 #****I* qt5.cygclass/doqt5inc
166 #  SYNOPSIS
167 #  doqt5inc HEADERS
168 #  DESCRIPTION
169 #  Installs headers into QT5_INCLUDEDIR under $D.
170 #****
171 doqt5inc() {
172         insinto ${QT5_INCLUDEDIR}
173         doins ${@}
176 #****I* qt5.cygclass/qt5pluginto
177 #  SYNOPSIS
178 #  qt5pluginto SUBDIRECTORY
179 #  DESCRIPTION
180 #  Sets the subdirectory of QT5_PLUGINDIR in which doqt5plugin should install.
181 #  Supported subdirectories include:
182 #  * designer: Qt Designer widgets
183 #  * imageformats: image format handlers
184 #  * platformthemes: GUI style engines
185 #  * sqldrivers: SQL datbase backends
186 #****
187 qt5pluginto() {
188         if [ -z "${1}" -o -n "${2}" ]
189         then
190                 error "qt5pluginto requires exactly one argument"
191         fi
193         __QT5_PLUGIN_SUBDIR=${1}
196 #****I* qt5.cygclass/doqt5plugin
197 #  SYNOPSIS
198 #  qt5pluginto SUBDIRECTORY
199 #  doqt5plugin PLUGINS
200 #  DESCRIPTION
201 #  Installs the given plugins into the subdirectory of QT5_PLUGINDIR passed
202 #  to the previous call to qt5pluginto.
203 #****
204 doqt5plugin() {
205         if ! defined __QT5_PLUGIN_SUBDIR
206         then
207                 error "qt5pluginto must be called before doqt5plugin"
208         fi
210         exeinto ${QT5_PLUGINSDIR}/${__QT5_PLUGIN_SUBDIR}
211         doexe ${@}
214 readonly -f __qt5_qmakespec doqt5inc qt5pluginto doqt5plugin