From owner-freebsd-ports@FreeBSD.ORG Tue Feb 6 00:11:41 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E3D5416A402 for ; Tue, 6 Feb 2007 00:11:31 +0000 (UTC) (envelope-from lofi@freebsd.org) Received: from mail-in-07.arcor-online.net (mail-in-07.arcor-online.net [151.189.21.47]) by mx1.freebsd.org (Postfix) with ESMTP id 0F13113C441 for ; Tue, 6 Feb 2007 00:11:30 +0000 (UTC) (envelope-from lofi@freebsd.org) Received: from mail-in-01-z2.arcor-online.net (mail-in-01-z2.arcor-online.net [151.189.8.13]) by mail-in-07.arcor-online.net (Postfix) with ESMTP id 468B824B07B; Mon, 5 Feb 2007 22:00:14 +0100 (CET) Received: from mail-in-08.arcor-online.net (mail-in-08.arcor-online.net [151.189.21.48]) by mail-in-01-z2.arcor-online.net (Postfix) with ESMTP id 2F7F1ED4DE; Mon, 5 Feb 2007 22:00:14 +0100 (CET) Received: from lofi.dyndns.org (dslb-084-061-156-118.pools.arcor-ip.net [84.61.156.118]) by mail-in-08.arcor-online.net (Postfix) with ESMTP id D7C49224DD2; Mon, 5 Feb 2007 22:00:13 +0100 (CET) Received: from kiste.my.domain (root@kiste.my.domain [192.168.8.2]) by lofi.dyndns.org (8.13.8/8.13.3) with ESMTP id l15L05a4024968 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Feb 2007 22:00:05 +0100 (CET) (envelope-from lofi@freebsd.org) Received: from kiste.my.domain (lofi@localhost [127.0.0.1]) by kiste.my.domain (8.13.6/8.13.4) with ESMTP id l15L04C6096994; Mon, 5 Feb 2007 22:00:04 +0100 (CET) (envelope-from lofi@freebsd.org) Received: from localhost (localhost [[UNIX: localhost]]) by kiste.my.domain (8.13.6/8.13.4/Submit) id l15L044Z096993; Mon, 5 Feb 2007 22:00:04 +0100 (CET) (envelope-from lofi@freebsd.org) X-Authentication-Warning: kiste.my.domain: lofi set sender to lofi@freebsd.org using -f From: Michael Nottebrock To: kde@freebsd.org, ports@freebsd.org Date: Mon, 5 Feb 2007 21:59:59 +0100 User-Agent: KMail/1.9.5 X-Face: g:jG2\O{-yqD1x?DG2lU1)(v%xffR"p8Nz(w/*)YEUO\Hn%mGi&-!+rq$&r64,=?utf-8?q?fuP=7E=3Bbw=5C=0A=09=5EQdX?=@v~HEAi?NaE8SU]}.oeYSjN84Fe{M(ahZ.(i+lxyP; pr)2[%mGbkY'RmM>=?utf-8?q?+mg3Y=24ip=0A=091?=@Z>[EUaE7tjJ=1DRs~:!uSd""d~:/Er3rpQA%ze|bp>S MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1320163.x9YgR5HM2H"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200702052200.04240.lofi@freebsd.org> X-Virus-Scanned: by amavisd-new Cc: Subject: A few notes about the Qt4 ports for porters X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Feb 2007 00:11:41 -0000 --nextPart1320163.x9YgR5HM2H Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This is a rather verbose mail. Skip towards the end for some quick explanations with hands-on examples. There are two import differences between the qt4 ports and qt33: Qt4 lives in ${LOCALBASE} instead of ${X11BASE} and qt4 is not a single monolithic port, but many individual ports and one (entirely optional) metaport (devel/qt4). The metaport is provided mostly for the benefit of developers and porters and should *not* be depended on by other ports. It will pull in all other qt4 component ports except for misc/qt4-qtdemo. Makefile Variables/Switches =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D To depend on qt4 or individual parts of qt4, porters need to specify USE_QT_VER=3D4 in their port Makefiles. Specifying nothing but this switch will trigger a dependency on the qt4 metaport. The switch enables an additional variable: QT_COMPONENTS QT_COMPONENTS can be used to list Qt4 tool and library dependencies in a specific and concise fashion. The complete list of possible values of QT_COMPONENTS can be found in ${PORTSDIR}/Mk/bsd.kde.mk in the _QT_COMPONENTS_ALL variable. The most important components for porters are: The libraries: corelib gui network opengl qt3support qtestlib sql xml All libraries themselves depend on corelib, so unless the application you are porting uses nothing but corelib, corelib doesn't need to be explicitly specified. You can determine which libraries the application depends on, by running ldd | grep Qt after a successful compilation. The tools: moc qmake rcc uic You will almost certainly need to depend on moc regardless what type of application you are porting. If the application in question uses a GUI, uic will be needed, too. Dependence on rcc can be determined by looking for *.rc or *.qrc files in the application's source code directories. Note that moc and uic are installed as "moc4" and "uic4" in order to not conflict with qt33. qmake is installed as "qmake-qt4" in order to not conflict with Qt3's qmake. Applications that use qmake as a buildsystem or query qmake for Qt's configuration will figure this out automatically, other buildsystems might require additional environment variables, configure switches or even patches in order to work. The plugins: iconengines imageformats You should specify imageformats if your application ships image files which are loaded and displayed within your application. You should specify iconengines if your application ships with SVG icons which are used in the application's GUI. If in doubt, specify both, or users might see a crippled user interface. Environment =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Specifying USE_QT_VER=3D4 in a port Makefile will set some useful environment variables to these default values: QT_PREFIX=3D ${LOCALBASE} MOC=3D ${QT_PREFIX}/bin/moc4 UIC=3D ${QT_PREFIX}/bin/uic4 QMAKE=3D ${QT_PREFIX}/bin/qmake-qt4 QMAKESPEC=3D ${QT_PREFIX}/share/qt4/mkspecs/freebsd-g++ QTCPPFLAGS (empty) QTCGFLIBS (empty) It will also influence ${CONFIGURE_ENV}: MOC=3D"${MOC}" UIC=3D"${UIC} CPPFLAGS=3D"${CPPFLAGS} ${QTCPPFLAGS}" LIBS=3D"${QTCFGLIBS}" QMAKE=3D"${QMAKE} QMAKESPEC=3D"${QMAKESPEC}" QTDIR=3D"${QT_PREFIX}" KDEDIR=3D"${KDE_PREFIX}" =2E.. and ${MAKE_ENV} QMAKESPEC=3D"${QMAKESPEC}" ${CONFIGURE_ARGS} are appended with: =2D-with-qt-includes=3D${QT_PREFIX}/include =2D-with-qt-libraries=3D${QT_PREFIX}/lib =2D-with-extra-libs=3D${LOCALBASE}/lib =2D-with-extra-includes=3D${LOCALBASE}/include The modification of CONFIGURE_ENV and CONFIGURE_ARGS can be suppressed by defining QT_NONSTANDARD in your port Makefile. Example =3D=3D=3D=3D=3D=3D=3D Note: *Do not use the actual qt4-* ports themselves as references*. They are quite special (read: full of bad hacks and generally ugly), since Qt doesn't really support being built component-by-component. The editors/texmaker port can be used as reference for a typical Qt4 application that uses Qt's own qmake build system. Let's look at the port Makefile: [...] USE_QT_VER=3D 4 QT_COMPONENTS=3D gui moc qmake rcc uic [...] USE_QT_VER=3D4 enables the QT_COMPONENTS variable. The value of QT_COMPONENTS, 'gui moc qmake rcc uic', triggers dependencies on the qt4-gui, qt4-moc, qmake4, qt4-rcc and qt4-uic ports. How to find out what components are needed by the application? In this case, the INSTALL document only contains the instructions "To compile and install Texmaker (Unix and MacosX): sudo sh BUILD.sh". Looking at BUILD.sh, we find the line: qmake -unix PREFIX=3D$PREFIX texmaker.pro Apparently this application uses qmake, so we need 'qmake' added to QT_COMPONENTS. As mentioned above, 'moc' is required by virtually every qt application. Texmaker uses a GUI and there are files with the .ui extension among the source code, thus we need 'uic'. There is also a .qrc file, which needs 'rcc' for processing. Examination of the binary with ldd yields: $ ldd /usr/local/bin/texmaker | grep Qt libQtGui.so.4 =3D> /usr/local/lib/libQtGui.so.4 (0x281c9000) libQtCore.so.4 =3D> /usr/local/lib/libQtCore.so.4 (0x28a01000) The application links against the Qt gui and core libraries. Since the core library is an implicit dependency of all other Qt4 libraries, it doesn't need to be specified. Our QT_COMPONENTS are now complete: gui moc qmake rcc uic What about the configure target? Qmake allows for much flexibility with regards to how it is run and what it is run on, which is why a generic configure target for qmake isn't provided by bsd.kde.mk. With the provided environment it is however quite easy to write your own: [...] HAS_CONFIGURE=3D yes do-configure: @cd ${WRKSRC} && ${SETENV} ${CONFIGURE_ENV} \ ${QMAKE} -unix PREFIX=3D${PREFIX} texmaker.pro [...] Note the similarity to the qmake line from the provided BUILD.sh script. The ${SETENV} ${CONFIGURE_ENV} ensures qmake will see the QMAKESPEC variable, without which it cannot work. Qmake generates standard Makefiles, so it is not necessary to write our own build or configure targets. Any other things to watch out for? Qt applications often are written to be cross-platform and often X11/Unix isn't the platform they are developed on, which in turn often leads to certain loose ends, like: =2D Missing additional includepaths. Many applications come with system tray icon support, but neglect to look for includes and/or libraries in the X11 directories. You can tell qmake to add directories to the include and library searchpaths via the commandline, for example: ${QMAKE} -unix PREFIX=3D${PREFIX} INCLUDEPATH+=3D${X11BASE}/include \ LIBS+=3D-L${X11BASE}/lib sillyapp.pro =2D Bogus installation paths. Sometimes data such as icons or .desktop files are by default installed into directories which aren't scanned by XDG-compatible applications. editors/texmaker is an example for this - look at patch-texmaker.pro in the files directory of that port for a template on how to remedy this directly in the Qmake project file. A final note: At the moment, bsd.kde.mk isn't pre/postmk-safe, which means you cannot use USE_QT_VER and QT_COMPONENTS after an .include . If your port requires this, please depend on the component you need the traditional way for now, for example: =2Einclude =2Eif defined(WITH_QT_SUPPORT) BUILD_DEPENDS+=3D moc4:${PORTSDIR}/devel/qt4-moc LIB_DEPENDS+=3D QtCore:${PORTSDIR}/devel/qt4-corelib =2Eendif =2Einclude =2D-=20 ,_, | Michael Nottebrock | lofi@freebsd.org (/^ ^\) | FreeBSD - The Power to Serve | http://www.freebsd.org \u/ | K Desktop Environment on FreeBSD | http://freebsd.kde.org --nextPart1320163.x9YgR5HM2H Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQBFx5rUXhc68WspdLARAkOZAJwJ+dckfSsOr5Lp9si2ikrA8tCWuACghKL6 TW+0V3/F2KA/t3eCiMIqtF4= =Nhfo -----END PGP SIGNATURE----- --nextPart1320163.x9YgR5HM2H--