Fixes this error:
gnuplot> plot [-5:5] sin(x)
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could
be initialized. Reinstalling the application may fix this problem.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Semi-automatic update generated by https://github.com/ryantm/nixpkgs-update tools.
This update was made based on information from https://repology.org/metapackage/gnuplot/versions.
These checks were done:
- built on NixOS
- ran ‘/nix/store/3kixi49gqbpjnkrgdavmzkbsg7aaw51p-gnuplot-5.2.3/bin/gnuplot -h’ got 0 exit code
- ran ‘/nix/store/3kixi49gqbpjnkrgdavmzkbsg7aaw51p-gnuplot-5.2.3/bin/gnuplot --help’ got 0 exit code
- ran ‘/nix/store/3kixi49gqbpjnkrgdavmzkbsg7aaw51p-gnuplot-5.2.3/bin/.gnuplot-wrapped -h’ got 0 exit code
- ran ‘/nix/store/3kixi49gqbpjnkrgdavmzkbsg7aaw51p-gnuplot-5.2.3/bin/.gnuplot-wrapped --help’ got 0 exit code
- found 5.2.3 with grep in /nix/store/3kixi49gqbpjnkrgdavmzkbsg7aaw51p-gnuplot-5.2.3
- directory tree listing: https://gist.github.com/c09c0907f914e36a3f7c086d4b978dbf
There is probably a way to have it work with substituteInPlace, but
using sed is a cheap solution to not having to figure out how to escape
"'$'" in Nix that works in both versions.
Issue #31179.
Fixes #33833.
Before executing the gnuplot executable the environment variable `GDFONTPATH`
is populated with a list of font directories, which is obtained from `fc-list`.
In that process we iterated over each line and called `dirname` on it, which
introduces a performance hit for loading and executing the external executable
`dirname` every time.
The new version avoids the loop.
The author of this patch measured a 42 fold performance improvement:
old version:
$ time ./gnuplot_old/bin/gnuplot -e ''
real 0m3.828s
user 0m0.392s
sys 0m0.465s
new version:
$ time ./gnuplot_new2/bin/gnuplot -e ''
real 0m0.091s
user 0m0.112s
sys 0m0.014s
The correctness of the value of `GDFONTPATH` was confirmed with the following
command and comparing its output between versions:
$ gnuplot -e 'print system("echo $GDFONTPATH")'
This variant uses the more Mac-friendly aqua driver, but it requires
that you separately install the AquaTerm package.
Note that AquaTerm is open source and could perhaps be later included
as a nix derivation. If that happens, it would be nice to remove the
gnuplot_aquaterm top-level attribute and just make it the default.
This patch adds a wrapper script around gnuplot that uses fontconfig's
fc-list(1) utility to determine the set of available fonts and makes that list
available to Gnuplot in the $GDFONTPATH variable.