Mk/bsd.*.mk: Sync
[dports.git] / Mk / bsd.qt.mk
1 # $FreeBSD: ports/Mk/bsd.qt.mk,v 1.36 2013/02/03 21:42:39 svnexp Exp $
2 #
3 # Variables:
4 # QT_NONSTANDARD        - Suppress modification of configure and make environment.
5 # QT_DIST               - Package being built is part of the Qt distribution.
6 #
7 # Global switches (add this to /etc/make.conf):
8 # QT4_OPTIONS           - A list of options, can be CUPS, NAS and/or QGTKSTYLE.
9 #                               If set, Qt will be built with support for:
10 #                               - Common UNIX Printing System (CUPS);
11 #                               - Network Audio System (NAS);
12 #                               - Qt style that renders using GTK (QGTKSTYLE).
13
14 .if !defined(_POSTMKINCLUDED) && !defined(Qt_Pre_Include)
15 Qt_Include_MAINTAINER=  kde@FreeBSD.org
16 Qt_Pre_Include=         bsd.qt.mk
17
18 .if !defined(QT_NONSTANDARD)
19 CONFIGURE_ARGS+=--with-qt-includes=${QT_INCDIR} \
20                 --with-qt-libraries=${QT_LIBDIR} \
21                 --with-extra-libs=${LOCALBASE}/lib \
22                 --with-extra-includes=${LOCALBASE}/include
23 CONFIGURE_ENV+= MOC="${MOC}" UIC="${UIC}" LIBS="${QTCFGLIBS}" \
24                 QMAKE="${QMAKE}" QMAKESPEC="${QMAKESPEC}" QTDIR="${QT_PREFIX}"
25 CPPFLAGS+=      ${QTCPPFLAGS}
26 MAKE_ENV+=      QMAKESPEC="${QMAKESPEC}"
27 .endif # !defined(QT_NONSTANDARD)
28
29 .if defined(QT_DIST)
30 DISTINFO_FILE=  ${PORTSDIR}/devel/qt4/distinfo
31 MASTER_SITES=   ${MASTER_SITE_QT}
32 DISTNAME=       qt-everywhere-opensource-src-${QT4_VERSION}
33 DIST_SUBDIR=    KDE
34 #CONFLICTS+=    Currently there are no conflicts \o/
35
36 # Let configure handle its well known compilers defined in the mkspecs
37 # (i.e. `cc` and `c++` are not supported by configure tests).
38 CONFIGURE_ENV+= CC="" CXX=""
39
40 # Keep in sync with devel/qmake4/files/qconfig.cpp
41 CONFIGURE_ARGS+=-fast -platform ${QMAKESPEC} \
42                 -system-libjpeg -system-libpng \
43                 -system-libmng -system-libtiff -system-zlib \
44                 -opensource -confirm-license \
45                 -no-pch \
46                 -prefix ${PREFIX} \
47                 -bindir ${PREFIX}/bin \
48                 -libdir ${PREFIX}/${QT_LIBDIR_REL} \
49                 -docdir ${PREFIX}/share/doc/qt4 \
50                 -headerdir ${PREFIX}/${QT_INCDIR_REL} \
51                 -plugindir ${PREFIX}/${QT_PLUGINDIR_REL} \
52                 -importdir ${PREFIX}/${QT_LIBDIR_REL}/imports \
53                 -datadir ${PREFIX}/share/qt4 \
54                 -translationdir ${PREFIX}/share/qt4/translations \
55                 -sysconfdir ${PREFIX}/etc/xdg \
56                 -examplesdir ${PREFIX}/share/examples/qt4/examples \
57                 -demosdir ${PREFIX}/share/examples/qt4/demos \
58                 -phonon -no-phonon-backend
59
60 PLIST_SUB+=     SHLIB_VER=${QT4_VERSION:C/-.*//} \
61                 SHLIB_SHVER=${QT4_VERSION:R}
62
63 # SIMD support is detected on runtime, no need to disable on build.
64 #.if defined(PACKAGE_BUILDING)
65 #CONFIGURE_ARGS+=-no-mmx -no-3dnow -no-sse -no-sse2 -no-sse3 \
66 #               -no-ssse3 -no-sse4.1 -no-sse4.2
67 #.endif #defined(PACKAGE_BUILDING)
68
69 # .if defined(PORTNAME) && ${PORTNAME} != "xmlpatterns"
70 # CONFIGURE_ARGS+=-no-exceptions
71 # .endif
72
73 .if defined(WANT_QT_DEBUG) || defined(WITH_DEBUG)
74 CONFIGURE_ARGS+=-debug -separate-debug-info
75 PLIST_SUB+=     DEBUG=""
76 .else
77 CONFIGURE_ARGS+=-release -no-separate-debug-info
78 PLIST_SUB+=     DEBUG="@comment "
79 .endif
80
81 .if defined(WANT_QT_VERBOSE_CONFIGURE)
82 CONFIGURE_ARGS+=-verbose
83 .endif
84 .endif #defined(QT_DIST)
85
86 QT_INCDIR_REL=  include/qt4
87 QT_LIBDIR_REL=  lib/qt4
88 QT_PLUGINDIR_REL=       lib/qt4/plugins
89
90 PLIST_SUB+=     QT_INCDIR_REL=${QT_INCDIR_REL} \
91                 QT_LIBDIR_REL=${QT_LIBDIR_REL} \
92                 QT_PLUGINDIR_REL=${QT_PLUGINDIR_REL}
93
94 QT_PREFIX?=     ${LOCALBASE}
95 QT_INCDIR?=     ${QT_PREFIX}/${QT_INCDIR_REL}
96 QT_LIBDIR?=     ${QT_PREFIX}/${QT_LIBDIR_REL}
97 QT_PLUGINDIR?=  ${QT_PREFIX}/${QT_PLUGINDIR_REL}
98 MOC?=           ${QT_PREFIX}/bin/moc-qt4
99 UIC?=           ${QT_PREFIX}/bin/uic-qt4
100 RCC?=           ${QT_PREFIX}/bin/rcc
101 QMAKE?=         ${QT_PREFIX}/bin/qmake-qt4
102 QMAKEFLAGS+=    QMAKE_CC="${CC}" QMAKE_CXX="${CXX}" \
103                 QMAKE_LINK="${CXX}" QMAKE_LINK_SHLIB="${CXX}" \
104                 QMAKE_LINK_C="${CC}" QMAKE_LINK_C_SHLIB="${CC}" \
105                 QMAKE_CFLAGS="${CFLAGS}" QMAKE_CXXFLAGS="${CXXFLAGS}" \
106                 QMAKE_CFLAGS_THREAD="${PTHREAD_CFLAGS}" \
107                 QMAKE_LFLAGS_THREAD="${PTHREAD_LIBS}"
108
109 QTCPPFLAGS?=
110 QTCGFLIBS?=
111
112 .endif # !defined(_POSTMKINCLUDED) && !defined(Qt_Pre_Include)
113
114 #
115 # QT4 version
116 #
117 QT4_VERSION?=           4.8.4
118
119 _USE_QT4_ALL=   accessible assistant assistant-adp assistantclient \
120                         clucene codecs-cn codecs-jp codecs-kr codecs-tw corelib \
121                         dbus declarative demo designer doc \
122                         graphicssystems-opengl gui help help-tools \
123                         iconengines imageformats inputmethods \
124                         linguist l10n makeqpf moc multimedia network opengl \
125                         pixeltool porting phonon phonon-gst \
126                         qdbusviewer qmlviewer qdoc3 qmake qt3support qtconfig qtestlib \
127                         qvfb rcc script scripttools sql sql-ibase sql-mysql \
128                         sql-odbc sql-pgsql sql-sqlite2 sql-sqlite3 svg uic uic3 \
129                         webkit xml xmlpatterns xmlpatterns-tool
130
131 accessible_PORT=        accessibility/qt4-accessible
132 accessible_DEPENDS=     ${QT_PLUGINDIR}/accessible/libqtaccessiblewidgets.so
133
134 assistant_PORT=         devel/qt4-assistant
135 assistant_DEPENDS=      ${QT_PREFIX}/bin/assistant-qt4
136
137 assistant-adp_PORT=     devel/qt4-assistant-adp
138 assistant-adp_DEPENDS=  ${QT_PREFIX}/bin/assistant_adp
139
140 assistantclient_PORT=           devel/qt4-libqtassistantclient
141 assistantclient_DEPENDS=        ${QT_LIBDIR}/libQtAssistantClient.so
142
143 clucene_PORT=           textproc/qt4-clucene
144 clucene_DEPENDS=        ${QT_LIBDIR}/libQtCLucene.so
145
146 codecs-cn_PORT=         chinese/qt4-codecs-cn
147 codecs-cn_DEPENDS=      ${QT_PLUGINDIR}/codecs/libqcncodecs.so
148
149 codecs-jp_PORT=         japanese/qt4-codecs-jp
150 codecs-jp_DEPENDS=      ${QT_PLUGINDIR}/codecs/libqjpcodecs.so
151
152 codecs-kr_PORT=         korean/qt4-codecs-kr
153 codecs-kr_DEPENDS=      ${QT_PLUGINDIR}/codecs/libqkrcodecs.so
154
155 codecs-tw_PORT=         chinese/qt4-codecs-tw
156 codecs-tw_DEPENDS=      ${QT_PLUGINDIR}/codecs/libqtwcodecs.so
157
158 corelib_PORT=           devel/qt4-corelib
159 corelib_DEPENDS=        ${QT_LIBDIR}/libQtCore.so
160
161 dbus_PORT=      devel/dbus-qt4
162 dbus_DEPENDS=   ${QT_LIBDIR}/libQtDBus.so
163
164 declarative_PORT=       devel/qt4-declarative
165 declarative_DEPENDS=    ${QT_LIBDIR}/libQtDeclarative.so
166
167 demo_PORT=      misc/qt4-qtdemo
168 demo_DEPENDS=   ${QT_PREFIX}/bin/qtdemo
169
170 designer_PORT=          devel/qt4-designer
171 designer_DEPENDS=       ${QT_PREFIX}/bin/designer-qt4
172
173 doc_PORT=       misc/qt4-doc
174 doc_DEPENDS=    qt4-doc>=4
175
176 graphicssystems-opengl_PORT=    x11/qt4-graphicssystems-opengl
177 graphicssystems-opengl_DEPENDS= ${QT_PLUGINDIR}/graphicssystems/libqglgraphicssystem.so
178
179 gui_PORT=       x11-toolkits/qt4-gui
180 gui_DEPENDS=    ${QT_LIBDIR}/libQtGui.so
181
182 help_PORT=      devel/qt4-help
183 help_DEPENDS=   ${QT_LIBDIR}/libQtHelp.so
184
185 help-tools_PORT=        devel/qt4-help-tools
186 help-tools_DEPENDS=     ${QT_PREFIX}/bin/qhelpgenerator
187
188 iconengines_PORT=       graphics/qt4-iconengines
189 iconengines_DEPENDS=    ${QT_PLUGINDIR}/iconengines/libqsvgicon.so
190
191 imageformats_PORT=      graphics/qt4-imageformats
192 imageformats_DEPENDS=   ${QT_PLUGINDIR}/imageformats/libqjpeg.so
193
194 inputmethods_PORT=      x11/qt4-inputmethods
195 inputmethods_DEPENDS=   ${QT_PLUGINDIR}/inputmethods/libqimsw-multi.so
196
197 linguist_PORT=          devel/qt4-linguist
198 linguist_DEPENDS=       ${QT_PREFIX}/bin/linguist-qt4
199
200 l10n_PORT=      misc/qt4-l10n
201 l10n_DEPENDS=   qt4-l10n>=4
202
203 makeqpf_PORT=           devel/qt4-makeqpf
204 makeqpf_DEPENDS=        ${QT_PREFIX}/bin/makeqpf-qt4
205
206 moc_PORT=       devel/qt4-moc
207 moc_DEPENDS=    ${MOC}
208
209 multimedia_PORT=        multimedia/qt4-multimedia
210 multimedia_DEPENDS=     ${QT_LIBDIR}/libQtMultimedia.so
211
212 network_PORT=           net/qt4-network
213 network_DEPENDS=        ${QT_LIBDIR}/libQtNetwork.so
214
215 opengl_PORT=    x11/qt4-opengl
216 opengl_DEPENDS= ${QT_LIBDIR}/libQtOpenGL.so
217
218 pixeltool_PORT=         graphics/qt4-pixeltool
219 pixeltool_DEPENDS=      ${QT_PREFIX}/bin/pixeltool
220
221 .if !defined(WITH_QT_PHONON)
222 phonon_PORT=    multimedia/phonon
223 .else
224 phonon_PORT=    multimedia/qt4-phonon
225 .endif
226 phonon_DEPENDS= ${QT_LIBDIR}/libphonon.so
227
228 .if !defined(WITH_QT_PHONON)
229 phonon-gst_PORT=        multimedia/phonon-gstreamer
230 .else
231 phonon-gst_PORT=        multimedia/qt4-phonon-gst
232 .endif
233 phonon-gst_DEPENDS=     ${QT_PLUGINDIR}/phonon_backend/libphonon_gstreamer.so
234
235 porting_PORT=           devel/qt4-porting
236 porting_DEPENDS=        ${QT_PREFIX}/bin/qt3to4
237
238 qdbusviewer_PORT=       devel/qt4-qdbusviewer
239 qdbusviewer_DEPENDS=    ${QT_PREFIX}/bin/qdbusviewer
240
241 qmlviewer_PORT=         devel/qt4-qmlviewer
242 qmlviewer_DEPENDS=      ${QT_PREFIX}/bin/qmlviewer
243
244 qdoc3_PORT=     devel/qt4-qdoc3
245 qdoc3_DEPENDS=  ${QT_PREFIX}/bin/qdoc3
246
247 qmake_PORT=     devel/qmake4
248 qmake_DEPENDS=  ${QMAKE}
249
250 qt3support_PORT=        devel/qt4-qt3support
251 qt3support_DEPENDS=     ${QT_LIBDIR}/libQt3Support.so
252
253 qtconfig_PORT=          misc/qt4-qtconfig
254 qtconfig_DEPENDS=       ${QT_PREFIX}/bin/qtconfig-qt4
255
256 qtestlib_PORT=          devel/qt4-qtestlib
257 qtestlib_DEPENDS=       ${QT_LIBDIR}/libQtTest.so
258
259 qvfb_PORT=      devel/qt4-qvfb
260 qvfb_DEPENDS=   ${QT_PREFIX}/bin/qvfb-qt4
261
262 rcc_PORT=               devel/qt4-rcc
263 rcc_DEPENDS=            ${RCC}
264
265 script_PORT=            devel/qt4-script
266 script_DEPENDS=         ${QT_LIBDIR}/libQtScript.so
267
268 scripttools_PORT=       devel/qt4-scripttools
269 scripttools_DEPENDS=    ${QT_LIBDIR}/libQtScriptTools.so
270
271 sql_PORT=       databases/qt4-sql
272 sql_DEPENDS=    ${QT_LIBDIR}/libQtSql.so
273
274 sql-ibase_PORT=         databases/qt4-ibase-plugin
275 sql-ibase_DEPENDS=      ${QT_PLUGINDIR}/sqldrivers/libqsqlibase.so
276
277 sql-mysql_PORT=         databases/qt4-mysql-plugin
278 sql-mysql_DEPENDS=      ${QT_PLUGINDIR}/sqldrivers/libqsqlmysql.so
279
280 sql-odbc_PORT=          databases/qt4-odbc-plugin
281 sql-odbc_DEPENDS=       ${QT_PLUGINDIR}/sqldrivers/libqsqlodbc.so
282
283 sql-pgsql_PORT=         databases/qt4-pgsql-plugin
284 sql-pgsql_DEPENDS=      ${QT_PLUGINDIR}/sqldrivers/libqsqlpsql.so
285
286 sql-sqlite2_PORT=       databases/qt4-sqlite-plugin
287 sql-sqlite2_DEPENDS=    ${QT_PLUGINDIR}/sqldrivers/libqsqlite2.so
288
289 sql-sqlite3_PORT=       databases/qt4-sqlite3-plugin
290 sql-sqlite3_DEPENDS=    ${QT_PLUGINDIR}/sqldrivers/libqsqlite.so
291
292 svg_PORT=       graphics/qt4-svg
293 svg_DEPENDS=    ${QT_LIBDIR}/libQtSvg.so
294
295 uic_PORT=       devel/qt4-uic
296 uic_DEPENDS=    ${UIC}
297
298 uic3_PORT=      devel/qt4-uic3
299 uic3_DEPENDS=   ${QT_PREFIX}/bin/uic3
300
301 webkit_PORT=    www/qt4-webkit
302 webkit_DEPENDS= ${QT_LIBDIR}/libQtWebKit.so
303
304 xml_PORT=       textproc/qt4-xml
305 xml_DEPENDS=    ${QT_LIBDIR}/libQtXml.so
306
307 xmlpatterns_PORT=       textproc/qt4-xmlpatterns
308 xmlpatterns_DEPENDS=    ${QT_LIBDIR}/libQtXmlPatterns.so
309
310 xmlpatterns-tool_PORT=          textproc/qt4-xmlpatterns-tool
311 xmlpatterns-tool_DEPENDS=       ${QT_PREFIX}/bin/xmlpatterns
312
313 .if defined(_POSTMKINCLUDED) && !defined(Qt_Post_Include)
314 Qt_Post_Include= bsd.qt.mk
315
316 #
317 # Translate `c++` to its real name and select the appropriate mkspec.
318 #
319 QMAKE_BASE_COMPILER=    g++
320 .if ${CXX} == "c++"
321 # Why CXX instead of CXX:T? Because if you're setting the full path of
322 # `c++` you probably want to define QMAKESPEC by hand too.
323 QMAKE_COMPILER= ${QMAKE_BASE_COMPILER}
324 .elif ${CXX:T} == "clang++"
325 QMAKE_COMPILER= clang
326 .elif ${CXX:C/c\+\+/g++/:T} == "llvm-g++"
327 QMAKE_COMPILER= llvm
328 .elif ${CXX:T} == "icpc"
329 QMAKE_COMPILER= icc
330 .else
331 # Handle all the other cases (mainly g++*).
332 QMAKE_COMPILER= ${CXX:C/c\+\+/g++/:T}
333 .endif
334 .if exists(${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_COMPILER})
335 QMAKESPEC?=     ${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_COMPILER}
336 .else
337 # If something went wrong, default to the base configuration.
338 QMAKESPEC?=     ${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_BASE_COMPILER}
339 .endif
340
341 .for component in ${_USE_QT4_ALL}
342 ${component}_BUILD_DEPENDS?=    ${${component}_DEPENDS}:${PORTSDIR}/${${component}_PORT}
343 ${component}_RUN_DEPENDS?=      ${${component}_DEPENDS}:${PORTSDIR}/${${component}_PORT}
344
345 ${component}_build_BUILD_DEPENDS?=      ${${component}_BUILD_DEPENDS}
346 ${component}_run_RUN_DEPENDS?=          ${${component}_RUN_DEPENDS}
347
348 _USE_QT4_ALL_SUFFIXED+= ${component} ${component}_build ${component}_run
349 .endfor
350
351 .if defined(USE_QT4)
352 . for component in ${USE_QT4:O:u}
353 .  if ${_USE_QT4_ALL_SUFFIXED:M${component}}!= ""
354 BUILD_DEPENDS+= ${${component}_BUILD_DEPENDS}
355 RUN_DEPENDS+=   ${${component}_RUN_DEPENDS}
356 .  else
357 IGNORE= can't be installed: unknown USE_QT4 component '${component}'
358 .  endif
359 . endfor
360 .endif
361
362 .endif