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