[KDE/Mac] Thoughts on standard directories in Qt5 - QStandardPaths
iandw.au at gmail.com
Sun Dec 14 22:32:48 UTC 2014
Hi David and KDE-Mac guys,
Replying to David's points re Mac and XDG specifically below…
On 12/12/2014, at 11:35 AM, Marko Käning wrote:
> Hi all, this is what David wrote about the use of XDG env vars on OSX back then in July:
> Begin forwarded message:
>> From: David Faure <faure at kde.org>
>> Subject: Re: KF5 Update Meeting Minutes 2014-w28
>> Date: 10 Jul 2014 11:57:23 GMT+2
>> To: kde-frameworks-devel at kde.org
>> Cc: Marko Käning <mk-lists at email.de>
>> On Thursday 10 July 2014 07:41:31 Marko Käning wrote:
>>> Most support I need re QStandardPaths and I would be stealing some Unix code
>>> from QStandardPaths::writableLocation() to be found in
>>> qstandardpaths_unix.cpp where XDG is being used to determine the
>>> environment of the system the Qt5 program runs on, using qgetenv() like
>>> e.g. this:
>>> QString xdgCacheHome = QFile::decodeName(qgetenv("XDG_CACHE_HOME"));
>>> Since the CI system - of course - makes use of these XDG environment
>>> variables during the test of every framework and application installed, it
>>> would be great if all these environment vars would be given to the CI
>>> system by a patched qt5 as well. I am working on it and will post a RR once
>>> I’ve got something working.
>> Wrong approach. XDG is a freedesktop thing which doesn't apply to Mac.
Philosophically, yes, but in MacPorts and Homebrew people are trying to provide
FOSS to a wider audience. To succeed in this, they must, to some extent, work
*around* the way Apple and OS X do things… :-)
>> This should be fixed the other way around:
>> 1) finding out how Mac OS lets people configure the location for their files,
OS X uses standardised locations, as described in the documentation for
QStandardPaths (QSP). There seems to be no easy way to "configure" these.
>> or if this isn't configurable, coming up with QT_* environment variables.
A further problem is that, being a Unix-like system, OS X has many Unix-like
and even FOSS-like items in /usr and /usr/local, such as low-level libraries,
utilities and include files. Many of these have the same names as equivalent
FOSS items, but with older versions in many cases or even with mods by Apple.
For this reason, MacPorts segregates all the FOSS software it builds and installs
into /opt/local/... There are some words about that here:
So, if we did have some other environment variable names, e.g. QT_* not XDG_*,
they should probably be something like MP_*. However, environment variables
are a threatened species on many versions of OS X supported by MacPorts and
are extinct (i.e. ignored) on the most recent versions. "Extinct" means there is no
Apple-approved way to introduce an environment variable into an app started by
the GUI facilities on the desktop in recent versions of OS X.
OTOH it is still possible to use environment variables on the command line in
OS X. We would *want* to use them for running CI, downstream testing and
downstream development of mods and bug fixes, as René Bertin and I have
been doing for KDE 4 up till now. Marko Käning is the one trying to get KF5
software to run on OS X and CI. René and I do not have it.
If we use env vars for non-end-user purposes, it may be best to keep calling
them XDG_*, to avoid confusion. In this case, on OS X, XDG_ would represent
the same build, installation and runtime principles as it does in Linux, i.e. files
installed by category in several read-only and writeable locations. It is just that
the default XDG paths would have to be different (i.e. NOT /usr or /usr/local).
By contrast, Apple OS X has quite different build, installation and runtime principles.
It tends to put all read-only files, monolithically in one directory area or at most two.
For example, the directory /Applications/iTunes.app/Contents/Resources (styled
<APPDIR>/../Resources in QSP doco) contains a large mix of image files, icon files,
translations into several languages, etc. etc. I doubt if either the MacPorts or the KDE
community would want to emulate this.
The exact prefix for installing Qt5 and KF5 files in MacPorts is not yet decided, but
the XDG default for DataLocation in QSP might be something like /opt/local or
/opt/local/qt5 (to avoid conflict with Qt 4 and KDE 4 files already installed).
>> 2) patching QStandardPaths to use these
>> 3) setting these vars in the CI scripts
More information about the kde-mac