svn commit: r404694 - in head: Mk Mk/Uses devel/qmake5 devel/qmake5/files
Raphael Kubo da Costa
rakuco at FreeBSD.org
Mon Dec 28 18:51:43 UTC 2015
Author: rakuco
Date: Mon Dec 28 18:51:41 2015
New Revision: 404694
URL: https://svnweb.freebsd.org/changeset/ports/404694
Log:
Make sure ${WRKSRC}/lib is passed before /usr/local/lib when linking.
This is another shot at fixing the linkage problems that have plagued our
users particularly when upgrading from Qt 5.x to 5.(x+1). Quick recap: in
Qt5, qmake will by default pass QMAKE_LIBDIR to the linker before other
directories such as ${WRKSRC}/lib, which is where the port's libraries are
built. When a user is upgrading Qt, we can end up with the following linker
line:
c++ -o SomeBinary -lfoo1 -L/usr/local/lib -L${WRKSRC}/lib -lfoo2 -lfoo3
If libfoo2.so is being built by the port and an older version is currently
installed on the system, /usr/local/lib/libfoo2.so will be picked up instead
of the newly-built ${WRKSRC}/lib/libfoo2.so. At best things just work, at
worst SomeBinary needs some new symbol that is not present in the old
libfoo2.so and linking fails. Case in point: bug 198720.
The previous approach, adopted when fixing bug 194088, was to stop setting
QMAKE_{INC,LIB}DIR in the FreeBSD mkspecs and set the CPATH and LIBRARY_PATH
environment variables in Uses/qmake.mk. This way we just did not pass
-L/usr/local/lib to the linker at all and things mostly worked. However,
people using Qt to build their own software without the ports tree were out
of luck, as they would then need need to deal with passing
/usr/local/{include,lib} to the compiler/linker themselves (bug 195105). Not
only that, but if a dependency mentioned /usr/local/lib we would still have
problems anyway (in bug 198720, the GStreamer pkg-config files contain
-L/usr/local/lib, for example).
We now solve the issue by setting the QMAKE_LIBDIR_FLAGS variable in
.qmake.cache to ${WRKSRC}/lib instead. qmake appends the value of
QMAKE_LIBDIR to QMAKE_LIBDIR_FLAGS, so we are always sure -L${WRKSRC}/lib
will come before -L/usr/local/lib in the linker options. Moreover, qmake is
smart enough to automatically call sed(1) and remove references to
${WRKSRC}/lib from .prl and .pc files when installing them.
PR: 194088
PR: 195105
PR: 198720
MFH: 2015Q4
Modified:
head/Mk/Uses/qmake.mk
head/Mk/bsd.qt.mk
head/devel/qmake5/Makefile
head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf
Modified: head/Mk/Uses/qmake.mk
==============================================================================
--- head/Mk/Uses/qmake.mk Mon Dec 28 18:21:17 2015 (r404693)
+++ head/Mk/Uses/qmake.mk Mon Dec 28 18:51:41 2015 (r404694)
@@ -49,19 +49,6 @@ IGNORE= Incorrect 'USES+= qmake' usage:
USE_QT${_QT_VERSION:R:R}+= qmake_build
.endif
-.if ${_QT_VERSION:M5*}
-# We deliberately do not pass -I${LOCALBASE}/include and -L${LOCALBASE}/lib
-# in the FreeBSD mkspecs because in Qt5 they are always added before the
-# paths in ${WRKSRC}. In other words, if one is upgrading an existing
-# installation the old headers and libraries will always be picked up.
-# Those directories to be passed though, they just need to be passed last.
-# See QTBUG-40825 and ports/194088 for more information.
-CONFIGURE_ENV+= CPATH=${LOCALBASE}/include \
- LIBRARY_PATH=${LOCALBASE}/lib
-MAKE_ENV+= CPATH=${LOCALBASE}/include \
- LIBRARY_PATH=${LOCALBASE}/lib
-.endif # ${_QT_VERSION:M5*}
-
# QMAKESPEC belongs to bsd.qt.mk.
QMAKE_ENV?= ${CONFIGURE_ENV}
QMAKE_ARGS+= -spec ${QMAKESPEC} \
Modified: head/Mk/bsd.qt.mk
==============================================================================
--- head/Mk/bsd.qt.mk Mon Dec 28 18:21:17 2015 (r404693)
+++ head/Mk/bsd.qt.mk Mon Dec 28 18:51:41 2015 (r404694)
@@ -604,15 +604,24 @@ post-configure: qmake-configure
. endif
. endif # ${QT_DIST} == "base"
+pre-configure: qt5-pre-configure
+qt5-pre-configure:
# Qt 5.3.2 introduced a check in mkspecs/features/create_cmake.prf that
# requires tests/auto/cmake to be present, otherwise the configure stage will
# fail.
# Since we cannot extract tests/auto/cmake/ and exclude tests/ at the same
# time, we have to disable the check in a cache file (the only way to get this
# value through to the configure script in qtbase).
-pre-configure: qt5-pre-configure
-qt5-pre-configure:
${ECHO_CMD} 'CMAKE_MODULE_TESTS = -' > ${WRKSRC}/.qmake.cache
+# We piggyback on QMAKE_LIBDIR_FLAGS to make sure -L${WRKSRC}/lib is passed to
+# the linker before -L/usr/local/lib. By default, the opposite happens, which
+# is a problem when a Qt port is being upgraded, since an existing library
+# would end up being picked up instead of those built in ${WRKSRC}/lib. Since
+# qmake appends the value of QMAKE_LIBDIR to QMAKE_LIBDIR_FLAGS, we can use the
+# latter to get the linker path order right. qmake is smart enough to strip
+# occurrences of ${WRKSRC}/lib from .pc and .prl files when installing them.
+# See QTBUG-40825 and ports bugs 194088, 195105 and 198720.
+ ${ECHO_CMD} 'QMAKE_LIBDIR_FLAGS = -L${WRKSRC}/lib' >> ${WRKSRC}/.qmake.cache
pre-install: qt-pre-install
qt-pre-install:
Modified: head/devel/qmake5/Makefile
==============================================================================
--- head/devel/qmake5/Makefile Mon Dec 28 18:21:17 2015 (r404693)
+++ head/devel/qmake5/Makefile Mon Dec 28 18:51:41 2015 (r404694)
@@ -2,7 +2,7 @@
PORTNAME= qmake
DISTVERSION= ${QT5_VERSION}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
PKGNAMEPREFIX= qt5-
Modified: head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf
==============================================================================
--- head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf Mon Dec 28 18:21:17 2015 (r404693)
+++ head/devel/qmake5/files/patch-mkspecs__common__freebsd.conf Mon Dec 28 18:51:41 2015 (r404694)
@@ -1,6 +1,6 @@
--- ./mkspecs/common/freebsd.conf.orig 2013-12-05 17:36:29.064198097 +0000
+++ ./mkspecs/common/freebsd.conf 2013-12-05 17:38:34.413200492 +0000
-@@ -0,0 +1,32 @@
+@@ -0,0 +1,36 @@
+#
+# qmake configuration for FreeBSD
+#
@@ -12,6 +12,10 @@
+
+QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
+
++# Addon software goes into /usr/local on the BSDs, by default we will look there
++QMAKE_INCDIR = /usr/local/include
++QMAKE_LIBDIR = /usr/local/lib
++
+QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
+QMAKE_LFLAGS_THREAD = -pthread
+
More information about the svn-ports-head
mailing list