tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
libreoffice: fix -qt build
Peter Hoeg
3 years ago
d75e54f7
61e657a2
+289
-101
1 changed file
expand all
collapse all
unified
split
pkgs
applications
office
libreoffice
default.nix
+289
-101
pkgs/applications/office/libreoffice/default.nix
···
1
-
{ stdenv, fetchurl, lib, pam, python3, libxslt, perl, ArchiveZip, box2d, gettext
2
-
, IOCompress, zlib, libjpeg, expat, freetype, libwpd
3
-
, libxml2, db, curl, fontconfig, libsndfile, neon
4
-
, bison, flex, zip, unzip, gtk3, libmspack, getopt, file, cairo, which
5
-
, icu, boost, jdk, ant, cups, xorg, fontforge, jre_minimal
6
-
, openssl, gperf, cppunit, poppler, util-linux
7
-
, librsvg, libGLU, libGL, bsh, CoinMP, libwps, libabw, libmysqlclient
8
-
, autoconf, automake, openldap, bash, hunspell, librdf_redland, nss, nspr
9
-
, libwpg, dbus-glib, clucene_core, libcdr, lcms
10
-
, unixODBC, mdds, sane-backends, mythes, libexttextcat, libvisio
11
-
, fontsConf, pkg-config, bluez5, libtool, carlito
12
-
, libatomic_ops, graphite2, harfbuzz, libodfgen, libzmf
13
-
, librevenge, libe-book, libmwaw, glm, gst_all_1
14
-
, gdb, commonsLogging, librdf_rasqal, wrapGAppsHook
15
-
, gnome, glib, ncurses, libepoxy, gpgme, abseil-cpp
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
16
, langs ? [ "ca" "cs" "da" "de" "en-GB" "en-US" "eo" "es" "fr" "hu" "it" "ja" "nl" "pl" "pt" "pt-BR" "ro" "ru" "sl" "uk" "zh-CN" ]
17
, withHelp ? true
18
-
, kdeIntegration ? false, mkDerivation ? null, qtbase ? null, qtx11extras ? null
19
-
, ki18n ? null, kconfig ? null, kcoreaddons ? null, kio ? null, kwindowsystem ? null
0
0
0
0
0
0
0
20
, wrapQtAppsHook ? null
21
, variant ? "fresh"
0
22
} @ args:
23
24
assert builtins.elem variant [ "fresh" "still" ];
25
26
let
0
0
0
0
0
0
27
jre' = jre_minimal.override {
28
modules = [ "java.base" "java.desktop" "java.logging" ];
29
};
···
34
35
inherit (primary-src) major minor subdir version;
36
37
-
langsSpaces = lib.concatStringsSep " " langs;
38
39
mkDrv = if kdeIntegration then mkDerivation else stdenv.mkDerivation;
40
41
srcs = {
42
third_party =
43
-
map (x : ((fetchurl {inherit (x) url sha256 name;}) // {inherit (x) md5name md5;}))
44
-
(importVariant "download.nix" ++ [
45
-
(rec {
46
-
name = "unowinreg.dll";
47
-
url = "https://dev-www.libreoffice.org/extern/${md5name}";
48
-
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
49
-
md5 = "185d60944ea767075d27247c3162b3bc";
50
-
md5name = "${md5}-${name}";
51
-
})
52
-
]);
53
54
translations = primary-src.translations;
55
help = primary-src.help;
56
};
57
-
in (mkDrv rec {
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
58
pname = "libreoffice";
59
inherit version;
60
···
71
72
postUnpack = ''
73
mkdir -v $sourceRoot/${tarballPath}
74
-
'' + (lib.flip lib.concatMapStrings srcs.third_party (f: ''
75
-
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.md5name}
76
-
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.name}
77
-
''))
78
+ ''
79
ln -sv ${srcs.help} $sourceRoot/${tarballPath}/${srcs.help.name}
80
ln -svf ${srcs.translations} $sourceRoot/${tarballPath}/${srcs.translations.name}
···
97
98
### QT/KDE
99
#
100
-
# We have to resort to the ugly patching of configure.ac as it assumes that
101
-
# the first directory that contains headers and libraries during the check
102
-
# contains all the relevant headers/libs which doesn't work with both as they
103
-
# are in multiple directories due to each having their own derivation.
104
-
postPatch = let
105
-
inc = e: path:
106
-
"${lib.getDev e}/include/KF5/${path}";
107
-
libs = list:
108
-
lib.concatMapStringsSep " " (e: "-L${lib.getLib e}/lib") list;
109
-
in ''
0
0
0
0
110
substituteInPlace shell/source/unix/exec/shellexec.cxx \
111
--replace /usr/bin/xdg-open ${if kdeIntegration then "kde-open5" else "xdg-open"}
112
···
119
substituteInPlace configure.ac --replace \
120
'GPGMEPP_CFLAGS=-I/usr/include/gpgme++' \
121
'GPGMEPP_CFLAGS=-I${gpgme.dev}/include/gpgme++'
122
-
'' + lib.optionalString kdeIntegration ''
123
-
substituteInPlace configure.ac \
124
-
--replace kcoreaddons_version.h KCoreAddons/kcoreaddons_version.h \
125
-
--replace '$QT5INC' ${qtbase.dev}/include \
126
-
--replace '$QT5LIB' ${qtbase.out}/lib \
127
-
--replace '-I$qt5_incdir ' '-I${qtx11extras.dev}/include '\
128
-
--replace '-L$qt5_libdir ' '${libs [ qtbase qtx11extras ]} ' \
129
-
--replace '$KF5INC' ${kcoreaddons.dev}/include \
130
-
--replace '$KF5LIB' ${kcoreaddons.out}/lib \
131
-
--replace '$kf5_incdir/KCore' ${inc kcoreaddons "KCore"} \
132
-
--replace '$kf5_incdir/KI18n' ${inc ki18n "KI18n"} \
133
-
--replace '$kf5_incdir/KConfig' ${inc kconfig "KConfig"} \
134
-
--replace '$kf5_incdir/KWindow' ${inc kwindowsystem "KWindow"} \
135
-
--replace '$kf5_incdir/KIO' ${inc kio "KIO"} \
136
-
--replace '-L$kf5_libdir ' '${libs [ kconfig kcoreaddons ki18n kio kwindowsystem ]} '
137
'';
138
139
dontUseCmakeConfigure = true;
···
239
''
240
# This to avoid using /lib:/usr/lib at linking
241
+ ''
242
-
sed -i '/gb_LinkTarget_LDFLAGS/{ n; /rpath-link/d;}' solenv/gbuild/platform/unxgcc.mk
243
244
-
find -name "*.cmd" -exec sed -i s,/lib:/usr/lib,, {} \;
245
'';
246
247
makeFlags = [ "SHELL=${bash}/bin/bash" ];
248
249
enableParallelBuilding = true;
250
251
-
buildPhase = ''
252
-
make build-nocheck
253
-
'';
254
255
doCheck = true;
256
···
278
279
mkdir -p $dev
280
cp -r include $dev
281
-
'' + lib.optionalString kdeIntegration ''
282
-
for prog in $out/bin/*
283
-
do
284
-
wrapQtApp $prog
285
-
done
286
'';
287
288
dontWrapQtApps = true;
289
290
configureFlags = [
291
(if withHelp then "" else "--without-help")
292
-
"--with-boost=${boost.dev}"
293
-
"--with-boost-libdir=${boost.out}/lib"
294
"--with-beanshell-jar=${bsh}"
295
"--with-vendor=NixOS"
296
"--disable-report-builder"
···
299
"--enable-dbus"
300
"--enable-release-build"
301
"--enable-epm"
302
-
"--with-ant-home=${ant}/lib/ant"
303
"--with-system-cairo"
304
"--with-system-libs"
305
"--with-system-headers"
···
347
# https://github.com/NixOS/nixpkgs/commit/5c5362427a3fa9aefccfca9e531492a8735d4e6f
348
"--without-system-orcus"
349
"--without-system-xmlsec"
350
-
] ++ lib.optionals kdeIntegration [
351
"--enable-kf5"
352
"--enable-qt5"
353
"--enable-gtk3-kde5"
354
];
355
356
-
checkPhase = ''
357
-
make unitcheck
358
-
make slowcheck
359
-
'';
360
361
nativeBuildInputs = [
362
-
gdb fontforge autoconf automake bison pkg-config libtool jdk
363
-
] ++ lib.optional (!kdeIntegration) wrapGAppsHook
364
-
++ lib.optional kdeIntegration wrapQtAppsHook;
0
0
0
0
0
0
0
365
366
-
buildInputs = with xorg;
367
-
[ ant ArchiveZip boost box2d cairo clucene_core
368
-
IOCompress cppunit cups curl db dbus-glib expat file flex fontconfig
369
-
freetype getopt gperf gtk3
370
-
hunspell icu jre' lcms libcdr libexttextcat unixODBC libjpeg
371
-
libmspack librdf_redland librsvg libsndfile libvisio libwpd libwpg libX11
372
-
libXaw libXext libXi libXinerama libxml2 libxslt libXtst
373
-
libXdmcp libpthreadstubs libGLU libGL mythes
374
-
glib libmysqlclient
375
-
neon nspr nss openldap openssl pam perl pkg-config poppler
376
-
python3 sane-backends unzip which zip zlib
377
-
mdds bluez5 libwps libabw libzmf
378
-
libxshmfence libatomic_ops graphite2 harfbuzz gpgme util-linux
379
-
librevenge libe-book libmwaw glm ncurses libepoxy
380
-
libodfgen CoinMP librdf_rasqal gnome.adwaita-icon-theme gettext abseil-cpp
381
-
]
382
-
++ (with gst_all_1; [
383
-
gstreamer
384
-
gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly
385
-
gst-libav
386
-
])
387
-
++ lib.optional kdeIntegration [ qtbase qtx11extras kcoreaddons kio ];
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
388
389
passthru = {
390
inherit srcs;
···
1
+
{ stdenv
2
+
, fetchurl
3
+
, lib
4
+
, pam
5
+
, python3
6
+
, libxslt
7
+
, perl
8
+
, ArchiveZip
9
+
, box2d
10
+
, gettext
11
+
, IOCompress
12
+
, zlib
13
+
, libjpeg
14
+
, expat
15
+
, freetype
16
+
, libwpd
17
+
, libxml2
18
+
, db
19
+
, curl
20
+
, fontconfig
21
+
, libsndfile
22
+
, neon
23
+
, bison
24
+
, flex
25
+
, zip
26
+
, unzip
27
+
, gtk3
28
+
, libmspack
29
+
, getopt
30
+
, file
31
+
, cairo
32
+
, which
33
+
, icu
34
+
, boost
35
+
, jdk
36
+
, ant
37
+
, cups
38
+
, xorg
39
+
, fontforge
40
+
, jre_minimal
41
+
, openssl
42
+
, gperf
43
+
, cppunit
44
+
, poppler
45
+
, util-linux
46
+
, librsvg
47
+
, libGLU
48
+
, libGL
49
+
, bsh
50
+
, CoinMP
51
+
, libwps
52
+
, libabw
53
+
, libmysqlclient
54
+
, autoconf
55
+
, automake
56
+
, openldap
57
+
, bash
58
+
, hunspell
59
+
, librdf_redland
60
+
, nss
61
+
, nspr
62
+
, libwpg
63
+
, dbus-glib
64
+
, clucene_core
65
+
, libcdr
66
+
, lcms
67
+
, unixODBC
68
+
, mdds
69
+
, sane-backends
70
+
, mythes
71
+
, libexttextcat
72
+
, libvisio
73
+
, fontsConf
74
+
, pkg-config
75
+
, bluez5
76
+
, libtool
77
+
, carlito
78
+
, libatomic_ops
79
+
, graphite2
80
+
, harfbuzz
81
+
, libodfgen
82
+
, libzmf
83
+
, librevenge
84
+
, libe-book
85
+
, libmwaw
86
+
, glm
87
+
, gst_all_1
88
+
, gdb
89
+
, commonsLogging
90
+
, librdf_rasqal
91
+
, wrapGAppsHook
92
+
, gnome
93
+
, glib
94
+
, ncurses
95
+
, libepoxy
96
+
, gpgme
97
+
, abseil-cpp
98
, langs ? [ "ca" "cs" "da" "de" "en-GB" "en-US" "eo" "es" "fr" "hu" "it" "ja" "nl" "pl" "pt" "pt-BR" "ro" "ru" "sl" "uk" "zh-CN" ]
99
, withHelp ? true
100
+
, kdeIntegration ? false
101
+
, mkDerivation ? null
102
+
, qtbase ? null
103
+
, qtx11extras ? null
104
+
, ki18n ? null
105
+
, kconfig ? null
106
+
, kcoreaddons ? null
107
+
, kio ? null
108
+
, kwindowsystem ? null
109
, wrapQtAppsHook ? null
110
, variant ? "fresh"
111
+
, symlinkJoin
112
} @ args:
113
114
assert builtins.elem variant [ "fresh" "still" ];
115
116
let
117
+
inherit (lib)
118
+
flatten flip
119
+
concatMapStrings concatMapStringsSep concatStringsSep
120
+
getDev getLib
121
+
optional optionals optionalString;
122
+
123
jre' = jre_minimal.override {
124
modules = [ "java.base" "java.desktop" "java.logging" ];
125
};
···
130
131
inherit (primary-src) major minor subdir version;
132
133
+
langsSpaces = concatStringsSep " " langs;
134
135
mkDrv = if kdeIntegration then mkDerivation else stdenv.mkDerivation;
136
137
srcs = {
138
third_party =
139
+
map (x: ((fetchurl { inherit (x) url sha256 name; }) // { inherit (x) md5name md5; }))
140
+
(importVariant "download.nix" ++ [
141
+
(rec {
142
+
name = "unowinreg.dll";
143
+
url = "https://dev-www.libreoffice.org/extern/${md5name}";
144
+
sha256 = "1infwvv1p6i21scywrldsxs22f62x85mns4iq8h6vr6vlx3fdzga";
145
+
md5 = "185d60944ea767075d27247c3162b3bc";
146
+
md5name = "${md5}-${name}";
147
+
})
148
+
]);
149
150
translations = primary-src.translations;
151
help = primary-src.help;
152
};
153
+
154
+
# See `postPatch` for details
155
+
kdeDeps = symlinkJoin {
156
+
name = "libreoffice-kde-dependencies-${version}";
157
+
paths = flatten (map (e: [ (getDev e) (getLib e) ]) [
158
+
qtbase
159
+
qtx11extras
160
+
kconfig
161
+
kcoreaddons
162
+
ki18n
163
+
kio
164
+
kwindowsystem
165
+
]);
166
+
};
167
+
168
+
in
169
+
(mkDrv rec {
170
pname = "libreoffice";
171
inherit version;
172
···
183
184
postUnpack = ''
185
mkdir -v $sourceRoot/${tarballPath}
186
+
'' + (flip concatMapStrings srcs.third_party (f: ''
187
+
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.md5name}
188
+
ln -sfv ${f} $sourceRoot/${tarballPath}/${f.name}
189
+
''))
190
+ ''
191
ln -sv ${srcs.help} $sourceRoot/${tarballPath}/${srcs.help.name}
192
ln -svf ${srcs.translations} $sourceRoot/${tarballPath}/${srcs.translations.name}
···
209
210
### QT/KDE
211
#
212
+
# configure.ac assumes that the first directory that contains headers and
213
+
# libraries during its checks contains *all* the relevant headers/libs which
214
+
# obviously doesn't work for us, so we have 2 options:
215
+
#
216
+
# 1. patch configure.ac in order to specify the direct paths to various Qt/KDE
217
+
# dependencies which is ugly and brittle, or
218
+
#
219
+
# 2. use symlinkJoin to pull in the relevant dependencies and just patch in
220
+
# that path which is *also* ugly, but far less likely to break
221
+
#
222
+
# The 2nd option is not very Nix'y, but I'll take robust over nice any day.
223
+
# Additionally, it's much easier to fix if LO breaks on the next upgrade (just
224
+
# add the missing dependencies to it).
225
+
postPatch = ''
226
substituteInPlace shell/source/unix/exec/shellexec.cxx \
227
--replace /usr/bin/xdg-open ${if kdeIntegration then "kde-open5" else "xdg-open"}
228
···
235
substituteInPlace configure.ac --replace \
236
'GPGMEPP_CFLAGS=-I/usr/include/gpgme++' \
237
'GPGMEPP_CFLAGS=-I${gpgme.dev}/include/gpgme++'
238
+
'' + optionalString kdeIntegration ''
239
+
substituteInPlace configure.ac \
240
+
--replace '$QT5INC ' '$QT5INC ${kdeDeps}/include ' \
241
+
--replace '$QT5LIB ' '$QT5LIB ${kdeDeps}/lib ' \
242
+
--replace '$KF5INC ' '$KF5INC ${kdeDeps}/include ${kdeDeps}/include/KF5 '\
243
+
--replace '$KF5LIB ' '$KF5LIB ${kdeDeps}/lib '
0
0
0
0
0
0
0
0
0
244
'';
245
246
dontUseCmakeConfigure = true;
···
346
''
347
# This to avoid using /lib:/usr/lib at linking
348
+ ''
349
+
sed -i '/gb_LinkTarget_LDFLAGS/{ n; /rpath-link/d;}' solenv/gbuild/platform/unxgcc.mk
350
351
+
find -name "*.cmd" -exec sed -i s,/lib:/usr/lib,, {} \;
352
'';
353
354
makeFlags = [ "SHELL=${bash}/bin/bash" ];
355
356
enableParallelBuilding = true;
357
358
+
buildTargets = [ "build-nocheck" ];
0
0
359
360
doCheck = true;
361
···
383
384
mkdir -p $dev
385
cp -r include $dev
386
+
'' + optionalString kdeIntegration ''
387
+
for prog in $out/bin/*; do
388
+
wrapQtApp $prog
389
+
done
0
390
'';
391
392
dontWrapQtApps = true;
393
394
configureFlags = [
395
(if withHelp then "" else "--without-help")
396
+
"--with-boost=${getDev boost}"
397
+
"--with-boost-libdir=${getLib boost}/lib"
398
"--with-beanshell-jar=${bsh}"
399
"--with-vendor=NixOS"
400
"--disable-report-builder"
···
403
"--enable-dbus"
404
"--enable-release-build"
405
"--enable-epm"
406
+
"--with-ant-home=${getLib ant}/lib/ant"
407
"--with-system-cairo"
408
"--with-system-libs"
409
"--with-system-headers"
···
451
# https://github.com/NixOS/nixpkgs/commit/5c5362427a3fa9aefccfca9e531492a8735d4e6f
452
"--without-system-orcus"
453
"--without-system-xmlsec"
454
+
] ++ optionals kdeIntegration [
455
"--enable-kf5"
456
"--enable-qt5"
457
"--enable-gtk3-kde5"
458
];
459
460
+
checkTarget = concatStringsSep " " [
461
+
"unitcheck"
462
+
"slowcheck"
463
+
];
464
465
nativeBuildInputs = [
466
+
autoconf
467
+
automake
468
+
bison
469
+
fontforge
470
+
gdb
471
+
jdk
472
+
libtool
473
+
pkg-config
474
+
]
475
+
++ [ (if kdeIntegration then wrapQtAppsHook else wrapGAppsHook) ];
476
477
+
buildInputs = with xorg; [
478
+
ArchiveZip
479
+
CoinMP
480
+
IOCompress
481
+
abseil-cpp
482
+
ant
483
+
bluez5
484
+
boost
485
+
box2d
486
+
cairo
487
+
clucene_core
488
+
cppunit
489
+
cups
490
+
curl
491
+
db
492
+
dbus-glib
493
+
expat
494
+
file
495
+
flex
496
+
fontconfig
497
+
freetype
498
+
getopt
499
+
gettext
500
+
glib
501
+
glm
502
+
gnome.adwaita-icon-theme
503
+
gperf
504
+
gpgme
505
+
graphite2
506
+
gtk3
507
+
harfbuzz
508
+
hunspell
509
+
icu
510
+
jre'
511
+
lcms
512
+
libGL
513
+
libGLU
514
+
libX11
515
+
libXaw
516
+
libXdmcp
517
+
libXext
518
+
libXi
519
+
libXinerama
520
+
libXtst
521
+
libabw
522
+
libatomic_ops
523
+
libcdr
524
+
libe-book
525
+
libepoxy
526
+
libexttextcat
527
+
libjpeg
528
+
libmspack
529
+
libmwaw
530
+
libmysqlclient
531
+
libodfgen
532
+
libpthreadstubs
533
+
librdf_rasqal
534
+
librdf_redland
535
+
librevenge
536
+
librsvg
537
+
libsndfile
538
+
libvisio
539
+
libwpd
540
+
libwpg
541
+
libwps
542
+
libxml2
543
+
libxshmfence
544
+
libxslt
545
+
libzmf
546
+
mdds
547
+
mythes
548
+
ncurses
549
+
neon
550
+
nspr
551
+
nss
552
+
openldap
553
+
openssl
554
+
pam
555
+
perl
556
+
pkg-config
557
+
poppler
558
+
python3
559
+
sane-backends
560
+
unixODBC
561
+
unzip
562
+
util-linux
563
+
which
564
+
zip
565
+
zlib
566
+
]
567
+
++ (with gst_all_1; [
568
+
gst-libav
569
+
gst-plugins-bad
570
+
gst-plugins-base
571
+
gst-plugins-good
572
+
gst-plugins-ugly
573
+
gstreamer
574
+
])
575
+
++ optionals kdeIntegration [ qtbase qtx11extras kcoreaddons kio ];
576
577
passthru = {
578
inherit srcs;