Qt4 as both framework and library
Michael Dickens
michaelld at macports.org
Fri Sep 21 13:01:08 PDT 2012
On Sep 21, 2012, at 1:47 PM, MK-MacPorts at techno.ms wrote:
> please fill me in - since I'm not an expert of MacOSX-specific development - I have a question:
> What is the reason for this Framework stuff? Why did you move from lib to Library/Frameworks?
> This ticket shows the trouble I ran into due to the move to frameworks: https://trac.macports.org/ticket/36272
Hi Marko - The primary issue was that some projects / ports -require-
Qt4 to be installed as frameworks, but the Qt install system (via QMake)
allows for just a single location for ports to install anything
(QT_INSTALL_LIBS:${prefix}/lib/ ). Folks had requested that frameworks
be in the standard MacPorts' framework area:
${prefix}/Library/Frameworks/. I can change the install area
(QT_INSTALL_LIBS) to ${prefix}/Library/Frameworks/, but then -some- (not
all) dependent ports will also try to install themselves there no matter
if library or framework. Not a suitable solution; QT_INSTALL_LIBS needs
to be ${prefix}/lib/.
So, I created a new internal QMake variable, QT_INSTALL_FRAMEWORKS,
which points to where frameworks should be installed; this allows
libraries to still be installed into QT_INSTALL_LIBS=${prefix}/lib/, no
matter if for Qt or some dependent port. This worked well for some
ports, which either use QMake or PKGCONFIG to locate Qt stuff -- which
is mostly those using GNU autotools. But, ports using CMake failed
because CMake uses scripts to locate Qt by looking in QT_INSTALL_LIBS
for libraries or frameworks. Further, most ports provide their own
FindQt4.cmake script which would have to get detected, and either
removed or patched in order to those ports to be able to find the new
frameworks directory. So, although all the above work is great, it
leaves out some 1/2 of known ports which rely on CMake! Not good.
So, since CMake is looking for either libraries or frameworks in
QT_INSTALL_LIBS, I decided to create links with the correct library
names in QT_INSTALL_LIBS. After this change, in my testing, all of the
ports that directly depend on Qt4 were able to find either the
frameworks or the libraries. And, for ports that were linked into
libraries, the upgrade seems to work correctly (to rev-upgrade) since
the library files still exist and point to a valid library even though
they themselves are just symlinks.
So, long story to get to the reasons of the change; I hope that all
makes sense. I will take a look at your ticket's issue & see what I can
figure out. - MLD
More information about the macports-dev
mailing list