Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jun 2010 15:22:20 +0200
From:      Alberto Villa <avilla@freebsd.org>
To:        freebsd-ports@freebsd.org
Cc:        kde-freebsd@kde.org, Doug Barton <dougb@freebsd.org>, Andriy Gapon <avg@icyb.net.ua>, Rob Farmer <rfarmer@predatorlabs.net>
Subject:   Re: [kde-freebsd] qt4-moc link failure
Message-ID:  <201006161522.32995.avilla@freebsd.org>
In-Reply-To: <201006161103.00558.avilla@freebsd.org>
References:  <4C128F14.9060605@FreeBSD.org> <4C153A2E.4020100@FreeBSD.org> <201006161103.00558.avilla@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart2228990.YN7Adi3qFo
Content-Type: multipart/mixed;
  boundary="Boundary-01=_NANGM3wnCDDFSYl"
Content-Transfer-Encoding: 7bit


--Boundary-01=_NANGM3wnCDDFSYl
Content-Type: Text/Plain;
  charset="iso-8859-15"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Wednesday 16 June 2010 11:02:38 Alberto Villa wrote:
> ok, i think i'll fix this, also thanks to a contribution from clang folks
> unfortunately, it really means adding more qmake.conf's, but after=20
all
> there aren't so many compilers
>=20
> and, of course, it will respect CC

here's (attached) what i've made so far: please , have a look
i'm not able to test it at the moment because i am at the university=20
(which means that i could have written all sort of stupid things)... will=20
do some tests later. meanwhile, if you have suggestions or=20
complaints, send them (pay attention: the patch was made against qt=20
4.7 in area 51... after the tests prove successful, i'll backport it to qt=
=20
4.6 (it requires just a couple of modifications))

i've added support for all the c++ compilers i've found in the ports:=20
gcc(34|42|43|44|45|46), icc, llvm and clang. pcc is not a c++ compiler=20
as far as i know. if something (even if exotic) is still missing, let me=20
know. chances are you won't be able to build qt with them (in qt 4.7=20
there is at least one test which requires gcc or icc... i've already sent=20
my complaints to qt developers, and i'll soon patch it), but at least=20
you'll be able to try

to make things even more tasty, bsd.qt.mk is able to understand if=20
`c++` is actually g++ or clang++. yes, clang people, i'm talking to=20
you :)
=2D-=20
Alberto Villa, FreeBSD committer <avilla@FreeBSD.org>
http://people.FreeBSD.org/~avilla

Tact in audacity is knowing how far you can go without going too far.
		-- Jean Cocteau

--Boundary-01=_NANGM3wnCDDFSYl
Content-Type: text/x-patch;
  charset="UTF-8";
  name="qt-cc.diff"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="qt-cc.diff"

Index: devel/qmake4/pkg-plist
=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=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- devel/qmake4/pkg-plist	(revision 6305)
+++ devel/qmake4/pkg-plist	(working copy)
@@ -9,6 +9,7 @@
 share/qt4/mkspecs/aix-xlc/qplatformdefs.h
 share/qt4/mkspecs/common/aix/qplatformdefs.h
 share/qt4/mkspecs/common/armcc.conf
+share/qt4/mkspecs/common/clang.conf
 share/qt4/mkspecs/common/c89/qplatformdefs.h
 share/qt4/mkspecs/common/g++.conf
 share/qt4/mkspecs/common/linux.conf
@@ -141,14 +142,26 @@
 share/qt4/mkspecs/features/win32/thread_off.prf
 share/qt4/mkspecs/features/win32/windows.prf
 share/qt4/mkspecs/features/yacc.prf
+share/qt4/mkspecs/freebsd-clang/qmake.conf
+share/qt4/mkspecs/freebsd-clang/qplatformdefs.h
 share/qt4/mkspecs/freebsd-g++/qmake.conf
 share/qt4/mkspecs/freebsd-g++/qplatformdefs.h
 share/qt4/mkspecs/freebsd-g++34/qmake.conf
 share/qt4/mkspecs/freebsd-g++34/qplatformdefs.h
=2Dshare/qt4/mkspecs/freebsd-g++40/qmake.conf
=2Dshare/qt4/mkspecs/freebsd-g++40/qplatformdefs.h
+share/qt4/mkspecs/freebsd-g++42/qmake.conf
+share/qt4/mkspecs/freebsd-g++42/qplatformdefs.h
+share/qt4/mkspecs/freebsd-g++43/qmake.conf
+share/qt4/mkspecs/freebsd-g++43/qplatformdefs.h
+share/qt4/mkspecs/freebsd-g++44/qmake.conf
+share/qt4/mkspecs/freebsd-g++44/qplatformdefs.h
+share/qt4/mkspecs/freebsd-g++45/qmake.conf
+share/qt4/mkspecs/freebsd-g++45/qplatformdefs.h
+share/qt4/mkspecs/freebsd-g++46/qmake.conf
+share/qt4/mkspecs/freebsd-g++46/qplatformdefs.h
 share/qt4/mkspecs/freebsd-icc/qmake.conf
 share/qt4/mkspecs/freebsd-icc/qplatformdefs.h
+share/qt4/mkspecs/freebsd-llvm/qmake.conf
+share/qt4/mkspecs/freebsd-llvm/qplatformdefs.h
 share/qt4/mkspecs/hpux-acc-64/qmake.conf
 share/qt4/mkspecs/hpux-acc-64/qplatformdefs.h
 share/qt4/mkspecs/hpux-acc-o64/qmake.conf
@@ -533,10 +546,16 @@
 @dirrm share/qt4/mkspecs/hpux-acc-o64
 @dirrm share/qt4/mkspecs/hpux-acc-64
 @dirrm share/qt4/mkspecs/hpux-acc
+@dirrm share/qt4/mkspecs/freebsd-llvm
 @dirrm share/qt4/mkspecs/freebsd-icc
=2D@dirrm share/qt4/mkspecs/freebsd-g++40
+@dirrm share/qt4/mkspecs/freebsd-g++46
+@dirrm share/qt4/mkspecs/freebsd-g++45
+@dirrm share/qt4/mkspecs/freebsd-g++44
+@dirrm share/qt4/mkspecs/freebsd-g++43
+@dirrm share/qt4/mkspecs/freebsd-g++42
 @dirrm share/qt4/mkspecs/freebsd-g++34
 @dirrm share/qt4/mkspecs/freebsd-g++
+@dirrm share/qt4/mkspecs/freebsd-clang
 @dirrm share/qt4/mkspecs/features/win32
 @dirrm share/qt4/mkspecs/features/unix
 @dirrm share/qt4/mkspecs/features/symbian
Index: devel/qmake4/Makefile
=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=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- devel/qmake4/Makefile	(revision 6305)
+++ devel/qmake4/Makefile	(working copy)
@@ -49,11 +49,24 @@
 		-e 's|-pthread|${PTHREAD_LIBS}|' \
 		-e 's|uic|uic-qt4|' \
 		-e 's|moc|moc-qt4|' \
=2D		${WRKSRC}/../mkspecs/freebsd-g++/qmake.conf \
=2D		${WRKSRC}/../mkspecs/freebsd-g++34/qmake.conf \
=2D		${WRKSRC}/../mkspecs/freebsd-g++40/qmake.conf \
=2D		${WRKSRC}/../mkspecs/freebsd-icc/qmake.conf
+		${WRKSRC}/../mkspecs/freebsd-*/qmake.conf
 	@${REINPLACE_CMD} -e 's|@QMAKE_QTOBJS@||g' ${WRKSRC}/Makefile.unix
+	# Add mkspecs for all the available compilers.
+	@${CP} -a ${WRKSRC}/../mkspecs/freebsd-g++ ${WRKSRC}/../mkspecs/freebsd-c=
lang
+	@${CP} -a ${WRKSRC}/../mkspecs/freebsd-g++ ${WRKSRC}/../mkspecs/freebsd-l=
lvm
+.for c in clang llvm
+	@${REINPLACE_CMD} -e 's|g++|${c}|g' \
+		${WRKSRC}/../mkspecs/freebsd-${c}/qmake.conf
+.endfor
+	@${CP} ${WRKSRC}/../mkspecs/common/g++.conf ${WRKSRC}/../mkspecs/common/c=
lang.conf
+	@${REINPLACE_CMD} -e 's|gcc|clang|g' -e 's|g++|clang++|g' \
+		${WRKSRC}/../mkspecs/common/clang.conf
+.for v in 42 43 44 45 46
+		@${CP} -a ${WRKSRC}/../mkspecs/freebsd-g++40 ${WRKSRC}/../mkspecs/freebs=
d-g++${v}
+		@${REINPLACE_CMD} -e 's|40|${v}|g' \
+			${WRKSRC}/../mkspecs/freebsd-g++${v}
+.endfor
+	@${RM} -r ${WRKSRC}/../mkspecs/freebsd-g++40
=20
 do-configure:
 	${SED} -e 's|/usr/local|${PREFIX}|g' \
@@ -75,6 +88,6 @@
 .endif
=20
 post-install:
=2D	${LN} -sf ${PREFIX}/share/qt4/mkspecs/freebsd-g++ ${PREFIX}/share/qt4/m=
kspecs/default
+	${LN} -sf ${PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_BASE_COMPILER} ${PR=
EFIX}/share/qt4/mkspecs/default
=20
 .include <bsd.port.post.mk>
Index: Mk/bsd.qt.mk
=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=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=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- Mk/bsd.qt.mk	(revision 6305)
+++ Mk/bsd.qt.mk	(working copy)
@@ -37,8 +37,8 @@
 DIST_SUBDIR=3D	KDE
 #CONFLICTS+=3D	Currently there are no conflicts \o/
=20
=2D# The configure tests don't support cc and c++ as the names for gcc and
=2D# g++, so just retrieve them from the mkspec.
+# Let configure handle its well known compilers defined in the mkspecs
+# (i.e. `cc` and `c++` are not supported by configure tests).
 CONFIGURE_ENV+=3D	CC=3D"" CXX=3D""
=20
 CONFIGURE_ARGS+=3D-fast -platform ${QMAKESPEC} \
@@ -99,13 +99,40 @@
 UIC?=3D		${QT_PREFIX}/bin/uic-qt4
 RCC?=3D		${QT_PREFIX}/bin/rcc
 QMAKE?=3D		${QT_PREFIX}/bin/qmake-qt4
=2DQMAKESPEC?=3D	${QT_PREFIX}/share/qt4/mkspecs/freebsd-g++
=2DQMAKEFLAGS+=3D	QMAKE_CC=3D"${CC}" QMAKE_CXX=3D"${CXX}" QMAKE_LINK_SHLIB=
=3D"${CXX}" \
=2D		QMAKE_LINK=3D"${CXX}" QMAKE_CFLAGS=3D"${CFLAGS}" \
=2D		QMAKE_CXXFLAGS=3D"${CXXFLAGS}" \
+QMAKEFLAGS+=3D	QMAKE_CC=3D"${CC}" QMAKE_CXX=3D"${CXX}" \
+		QMAKE_LINK=3D"${CXX}" QMAKE_LINK_SHLIB=3D"${CXX}" \
+		QMAKE_LINK_C=3D"${CC}" QMAKE_LINK_C_SHLIB=3D"${CC}" \
+		QMAKE_CFLAGS=3D"${CFLAGS}" QMAKE_CXXFLAGS=3D"${CXXFLAGS}" \
 		QMAKE_CFLAGS_THREAD=3D"${PTHREAD_CFLAGS}" \
 		QMAKE_LFLAGS_THREAD=3D"${PTHREAD_LIBS}"
=20
+#
+# Translate `c++` to its real name and select the appropriate mkspec.
+#
+QMAKE_BASE_COMPILER!=3D	cc --version | head -1 | sed -E 's/.+\(([^)]+)\).+=
/\1/' | cut -d " " -f 1
+.if ${QMAKE_BASE_COMPILER:L} =3D=3D "gcc"
+QMAKE_BASE_COMPILER=3D	g++
+.endif
+.if ${CXX} =3D=3D "c++"
+# Why CXX instead of CXX:T? Because if you're setting the full path of
+# `c++` you probably want to define QMAKESPEC by hand too.
+QMAKE_COMPILER=3D	${QMAKE_BASE_COMPILER}
+.elif ${CXX:T} =3D=3D "clang++"
+QMAKE_COMPILER=3D	clang
+.elif ${CXX:C/c++/g++/:T} =3D=3D "llvm-g++"
+QMAKE_COMPILER=3D	llvm
+.elif ${CXX:T} =3D=3D "icpc"
+QMAKE_COMPILER=3D	icc
+.else
+# Handle all the other cases (mainly g++*).
+QMAKE_COMPILER=3D	${CXX:C/c++/g++/:T}
+.endif
+QMAKESPEC?=3D	${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_COMPILER}
+.if !exists(${QMAKESPEC})
+# If something went wrong, default to the base configuration.
+QMAKESPEC?=3D	${QT_PREFIX}/share/qt4/mkspecs/freebsd-${QMAKE_BASE_COMPILER}
+.endif
+
 .if ${OSVERSION} < 700042 && ${ARCH} =3D=3D "amd64"
 QTCPPFLAGS?=3D	-fno-gcse
 .else

--Boundary-01=_NANGM3wnCDDFSYl--

--nextPart2228990.YN7Adi3qFo
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (FreeBSD)

iJwEAAECAAYFAkwY0BYACgkQ3xiC6kQ1CovdagQAlZFg5mCxWsegpsBGpY06ZBYJ
nP4GzhfSUo/EnRnnMHc/sfqkRjtpxYRIn8Zfw+7VCXDC0vFl0OVLEGzWnIIzxxr8
u2KjvQ4pcpSlYnBAW1XzUeNhEOx6ruQP2pFWbGIlasdwB5quh+TklaT+YeYvep3D
3sryEwUJm0mRJXzNAt8=
=/dIr
-----END PGP SIGNATURE-----

--nextPart2228990.YN7Adi3qFo--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201006161522.32995.avilla>