Newer
Older
# Set for local builds only
%global disable_toolsets 0
%ifarch i686
# no debug package for the i686 because oom on i686 with debuginfos
%global debug_package %{nil}
%endif
%{lua:
function dist_to_rhel_minor(str, start)
match = string.match(str, ".module%+el8.%d+")
if match then
return string.sub(match, 13)
end
match = string.match(str, ".el8_%d+")
if match then
return string.sub(match, 6)
end
match = string.match(str, ".el8")
if match then
return 5
end
return -1
end}
%global rhel_minor_version %{lua:print(dist_to_rhel_minor(rpm.expand("%dist")))}
%global system_nss 1
%global bundle_nss 0
%if 0%{?rhel} == 8
%if %{rhel_minor_version} < 2
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
%global bundle_nss 1
%endif
%endif
%if 0%{?rhel} == 6
%global system_nss 0
%endif
%define use_bundled_ffi 0
%define use_bundled_python_2 1
%define use_bundled_python_3 1
%if 0%{?rhel} == 8
%define use_bundled_python_2 1
%define use_bundled_python_3 0
%endif
%if 0%{?rhel} == 7
%define use_bundled_python_2 0
%define use_bundled_python_3 0
%endif
%if 0%{?flatpak:1}
%define use_bundled_python_2 1
%endif
# we need python2 because of icu data gen
%define use_bundled_python_2 1
# Don't use system hunspell for now
%global system_hunspell 0
%if 0%{?rhel} == 8
%global use_llvmts 0
%else
%global use_llvmts 1
%endif
%if 0%{?rhel} > 6
%global system_ffi 1
%else
%global system_ffi 0
%endif
%if 0%{?rhel} < 8
%global use_dts 1
%endif
%global use_rustts 1
%global dts_version 8
%if 0%{?rhel} == 6
%global dts_version 8
%endif
%global rust_version 1.41
%global rust_toolset_version 1.41
%global llvm_version 7.0
%if 0%{?rhel} == 8
%global llvm_version 6.0
%endif
%if 0%{?disable_toolsets}
%global use_rustts 0
%global use_dts 0
%global use_llvmts 0
%endif
# Use system cairo?
%global system_cairo 0
# Use system libvpx?
%global system_libvpx 0
# Use system libicu?
%global system_libicu 0
# Big endian platforms
%ifarch ppc64 s390x
# Javascript Intl API is not supported on big endian platforms right now:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1322212
%global big_endian 1
%endif
# Hardened build?
%global hardened_build 1
%global system_jpeg 1
%ifarch %{ix86} x86_64
%global run_tests 0
%else
%global run_tests 0
%endif
# Build as a debug package?
%global debug_build 0
%define thunderbird_app_id \{3550f703-e582-4d05-9a08-453d09bdfdc6\}
# Minimal required versions
%global cairo_version 1.13.1
%global freetype_version 2.1.9
%if %{?system_libvpx}
%global libvpx_version 1.4.0
%endif
%if 0%{?system_nss}
%global nspr_version 4.25
# NSS/NSPR quite often ends in build override, so as requirement the version
# we're building against could bring us some broken dependencies from time to time.
#%%global nspr_build_version %%(pkg-config --silence-errors --modversion nspr 2>/dev/null || echo 65536)
%global nspr_build_version %{nspr_version}
%global nss_version 3.53.1
#%%global nss_build_version %%(pkg-config --silence-errors --modversion nss 2>/dev/null || echo 65536)
%global nss_build_version %{nss_version}
%endif
%define bundled_python_version_2 2.7.13
%define bundled_python_version_3 3.6.8
%define use_bundled_openssl 0
%define use_bundled_nodejs 0
%define use_bundled_yasm 0
%if 0%{?rhel} == 8
%if %{rhel_minor_version} <= 2
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
%define use_bundled_nodejs 1
%endif
%endif
%if 0%{?rhel} == 7
%define use_bundled_nodejs 1
%define use_bundled_yasm 1
%endif
%if 0%{?rhel} == 6
%define use_bundled_nodejs 1
%define use_bundled_openssl 1
%define use_bundled_yasm 1
%define bundle_gtk3 1
# In-tree libffi is able to build on following platforms, we have to bundle it for the rest
%ifnarch x86_64 i686 aarch64
%define use_bundled_ffi 1
%endif
%endif
# GTK3 bundling
%define avoid_bundled_rebuild 0
%define gtk3_nvr 3.22.26-1
%define gtk3_install_path %{mozappdir}/bundled
# We could use %%include, but in %%files, %%post and other sections, but in these
# sections it could lead to syntax errors about unclosed %%if. Work around it by
# using the following macro
%define include_file() %{expand:%(cat '%1')}
%global mozappdir %{_libdir}/%{name}
%global mozappdirdev %{_libdir}/%{name}-devel-%{version}
%global langpackdir %{mozappdir}/distribution/extensions
%global tarballdir %{name}-%{version}
%global mozappfeatures %{mozappdir}/features/*.xpi
#global pre_tag alpha
%global official_branding 1
%global build_langpacks 1
Summary: Mozilla Thunderbird mail/newsgroup client
Name: thunderbird
Version: 78.14.0
Release: 1%{?dist}
URL: http://www.mozilla.org/projects/thunderbird/
License: MPLv1.1 or GPLv2+ or LGPLv2+
Group: Applications/Internet
%if 0%{?rhel} == 7
ExcludeArch: s390 ppc
%endif
%if 0%{?rhel} == 6
ExclusiveArch: i686 x86_64 ppc64 s390x
%endif
# From ftp://archive.mozilla.org/pub/thunderbird/releases/%%{version}%%{?ext_version}/source
Source0: https://archive.mozilla.org/pub/thunderbird/releases/%{version}%{?pre_version}/source/thunderbird-%{version}%{?pre_version}.source.tar.xz
%if %{build_langpacks}
Source1: thunderbird-langpacks-%{version}%{?ext_version}-20210902.tar.xz
# Locales for lightning
%endif
Source2: cbindgen-vendor-0.14.3.tar.xz
Source3: get-calendar-langpacks.sh
Source10: thunderbird-mozconfig
Source20: thunderbird.desktop
Source21: thunderbird.sh.in
Source24: mozilla-api-key
Source27: google-api-key
Source28: node-stdout-nonblocking-wrapper
Source102: find-external-requires
Source200: gtk3-private-%{gtk3_nvr}.el6.src.rpm
Source201: gtk3-private-%{gtk3_nvr}-post.inc
Source202: gtk3-private-%{gtk3_nvr}-postun.inc
Source203: gtk3-private-%{gtk3_nvr}-posttrans.inc
Source204: gtk3-private-%{gtk3_nvr}-files.inc
Source205: gtk3-private-%{gtk3_nvr}-setup-flags-env.inc
Source206: gtk3-private-%{gtk3_nvr}-requires-provides-filter.inc
Source301: yasm-1.2.0-3.el5.src.rpm
Source303: libffi-3.0.13-18.el7_3.src.rpm
Source304: nodejs-10.21.0-5.fc32.src.rpm
Source305: openssl-1.0.2k-19.6.bundle.el7_7.src.rpm
Source601: thunderbird-redhat-default-prefs.js.rhel6
Source701: thunderbird-rocky-default-prefs.js
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
## Firefox patches
Source403: nss-3.53.1-3.fc32.src.rpm
Source401: nss-setup-flags-env.inc
Source402: nspr-4.25.0-1.el8_0.src.rpm
#Python
%if 0%{?use_bundled_python_2}
Source100: https://www.python.org/ftp/python/%{bundled_python_version_2}/Python-%{bundled_python_version_2}.tar.xz
%endif
%if 0%{?use_bundled_python_3}
Source101: https://www.python.org/ftp/python/%{bundled_python_version_3}/Python-%{bundled_python_version_3}.tar.xz
%endif
# Build patches
Patch1000: python-2.7.patch
# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1699374
Patch1001: build-ppc64le-inline.patch
Patch1002: python-2.7-gcc8-fix.patch
Patch1003: python-missing-utimensat.patch
Patch1004: build-icu-make.patch
# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1699374
Patch4: build-mozconfig-fix.patch
Patch6: build-nss-version.patch
Patch7: firefox-debugedits-error.patch
# Fedora/RHEL specific patches
Patch215: firefox-enable-addons.patch
Patch219: rhbz-1173156.patch
Patch224: mozilla-1170092.patch
#ARM run-time patch
Patch231: firefox-pipewire.patch
Patch232: firefox-rhel6-hugepage.patch
Patch233: firefox-rhel6-nss-tls1.3.patch
Patch234: rhbz-1821418.patch
Patch235: firefox-pipewire-0-3.patch
Patch236: fedora-shebang-build.patch
Patch237: disable-openpgp-in-thunderbird.patch
# Upstream patches
Patch402: mozilla-1196777.patch
Patch501: python-encode.patch
Patch503: mozilla-s390-context.patch
Patch505: mozilla-bmo1005535.patch
Patch506: mozilla-bmo1504834-part1.patch
Patch507: mozilla-bmo1504834-part2.patch
Patch508: mozilla-bmo1504834-part3.patch
Patch509: mozilla-bmo1504834-part4.patch
Patch510: mozilla-bmo1554971.patch
Patch511: mozilla-bmo1602730.patch
Patch512: mozilla-bmo849632.patch
Patch513: mozilla-bmo998749.patch
Patch514: mozilla-s390x-skia-gradient.patch
Patch515: mozilla-bmo1626236.patch
Patch516: D87019-thin-vec-big-endian.diff
# CentOS patches
%if 0%{?rocky}
Patch10000: Bug-1238661---fix-mozillaSignalTrampoline-to-work-.patch
Patch10001: Bug-1526653---fix_user_vfp_armv7.patch
%endif
# RHEL6 patches
Patch600: rhel6-dbusver.patch
Patch601: rhel6-kernel.patch
Patch602: rhel6-mach-fail.patch
Patch603: rhel6-zconst.patch
Patch604: rhel6-auxvh.patch
Patch605: rhel6-abiv2-mozbz1642174.patch
Patch606: rhel6-auxv.patch
Patch607: rhel6-at-no-automount.patch
Patch608: rhel6-clock_gettime.patch
%if %{?system_nss}
%if !0%{?bundle_nss}
BuildRequires: pkgconfig(nspr) >= %{nspr_version}
BuildRequires: pkgconfig(nss) >= %{nss_version}
BuildRequires: nss-static >= %{nss_version}
%endif
%endif
%if %{?system_cairo}
BuildRequires: pkgconfig(cairo) >= %{cairo_version}
%endif
BuildRequires: pkgconfig(libpng)
BuildRequires: xz
BuildRequires: libXt-devel
BuildRequires: mesa-libGL-devel
Requires: liberation-fonts-common
Requires: liberation-sans-fonts
%if %{?system_jpeg}
BuildRequires: libjpeg-devel
%endif
BuildRequires: zip
BuildRequires: bzip2-devel
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(libIDL-2.0)
BuildRequires: pkgconfig(gtk+-2.0)
BuildRequires: krb5-devel
BuildRequires: pkgconfig(pango)
BuildRequires: pkgconfig(freetype2) >= %{freetype_version}
BuildRequires: pkgconfig(xt)
BuildRequires: pkgconfig(xrender)
%if %{?system_hunspell}
BuildRequires: hunspell-devel
%endif
BuildRequires: pkgconfig(libstartup-notification-1.0)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(dri)
BuildRequires: pkgconfig(libcurl)
BuildRequires: dbus-glib-devel
%if %{?system_libvpx}
BuildRequires: libvpx-devel >= %{libvpx_version}
%endif
BuildRequires: autoconf213
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(gconf-2.0)
%if 0%{?use_dts}
BuildRequires: devtoolset-%{dts_version}-gcc-c++
BuildRequires: devtoolset-%{dts_version}-gcc
BuildRequires: devtoolset-%{dts_version}-binutils
BuildRequires: devtoolset-%{dts_version}-libatomic-devel
%if 0%{?use_llvmts}
BuildRequires: llvm-toolset-%{llvm_version}
BuildRequires: llvm-toolset-%{llvm_version}-llvm-devel
%endif
%endif
BuildRequires: scl-utils
BuildRequires: findutils
%if 0%{?rhel} == 8
BuildRequires: cargo
BuildRequires: rust >= %{rust_version}
BuildRequires: llvm >= %{llvm_version}
BuildRequires: llvm-devel >= %{llvm_version}
BuildRequires: clang >= %{llvm_version}
BuildRequires: clang-devel >= %{llvm_version}
BuildRequires: rustfmt >= %{rust_version}
BuildRequires: python3
BuildRequires: nodejs >= 10.21
%else
%if 0%{?use_rustts}
BuildRequires: rust-toolset-%{rust_toolset_version}
%endif
%if 0%{?rhel} == 7
#BuildRequires: rh-nodejs12
%endif
%if 0%{?use_llvmts}
BuildRequires: llvm-toolset-%{llvm_version}
BuildRequires: llvm-toolset-%{llvm_version}-llvm-devel
%endif
%endif
%if ! 0%{?use_bundled_yasm}
BuildRequires: yasm
%endif
%if 0%{?use_bundled_python_2}
# Needed for Python in RHEL6
BuildRequires: openssl-devel
%endif
%if 0%{?rhel} == 8
%if %{rhel_minor_version} >= 3
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
BuildRequires: pkgconfig(libpipewire-0.3)
%else
BuildRequires: pipewire-devel
%endif
%endif
%if 0%{?bundle_gtk3}
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: cups-devel
BuildRequires: dbus-devel
BuildRequires: desktop-file-utils
BuildRequires: expat-devel
BuildRequires: fontpackages-devel
BuildRequires: gamin-devel
BuildRequires: gettext-devel
BuildRequires: git
BuildRequires: intltool
BuildRequires: jasper-devel
BuildRequires: libepoxy-devel
BuildRequires: libcroco-devel
BuildRequires: libffi-devel
BuildRequires: libpng-devel
BuildRequires: libtiff-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: libX11-devel
BuildRequires: libXcomposite-devel
BuildRequires: libXcursor-devel
BuildRequires: libXinerama-devel
BuildRequires: libXevie-devel
BuildRequires: libXrandr-devel
BuildRequires: libXrender-devel
BuildRequires: libXtst-devel
BuildRequires: mesa-libGL-devel
BuildRequires: mesa-libEGL-devel
BuildRequires: pixman-devel
BuildRequires: rest-devel
BuildRequires: readline-devel
# TODO: We miss that dependency in our bundled gtk3 package.
# As a hotfix we put it here and fix gtk3 in next release.
Requires: mesa-libEGL%{?_isa}
Requires: libcroco%{?_isa}
Requires: mesa-libGL%{?_isa}
Requires: bzip2-libs%{?_isa}
Requires: libXtst%{?_isa}
%else
BuildRequires: gtk3-devel
BuildRequires: glib2-devel
%endif
# Bundled nss/nspr requirement
%if 0%{?bundle_nss}
BuildRequires: nss-softokn
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
BuildRequires: pkgconfig
BuildRequires: gawk
BuildRequires: psmisc
%if 0%{?rhel} == 6
BuildRequires: perl
%else
BuildRequires: perl-interpreter
%endif
BuildRequires: gcc-c++
BuildRequires: xmlto
%endif
Requires: mozilla-filesystem
Requires: p11-kit-trust
%if %{?system_nss}
%if !0%{?bundle_nss}
Requires: nspr >= %{nspr_build_version}
Requires: nss >= %{nss_build_version}
%endif
%endif
BuildRequires: desktop-file-utils
BuildRequires: system-bookmarks
Requires: redhat-indexhtml
#for the python2
BuildRequires: pkgconfig(sqlite3)
%if %{?run_tests}
BuildRequires: xorg-x11-server-Xvfb
%endif
%if %{?system_ffi}
%if !%{use_bundled_ffi}0
BuildRequires: pkgconfig(libffi)
%endif
%endif
%if %{?use_bundled_nodejs}
%if !0%{?use_bundled_python_3}
BuildRequires: python3-devel
%endif
BuildRequires: zlib-devel
#BuildRequires: brotli-devel
#BuildRequires: gcc >= 4.9.4
#BuildRequires: gcc-c++ >= 4.9.4
BuildRequires: chrpath
BuildRequires: libatomic
BuildRequires: openssl-devel
%endif
%if 0%{?big_endian}
%if 0%{?flatpak}
BuildRequires: icu
%endif
%endif
Obsoletes: thunderbird-lightning
# ==================================================================================
# Override internal dependency generator to avoid showing libraries provided by this package
# in dependencies:
#AutoProv: 0
#%%define _use_internal_dependency_generator 0
#%%define __find_requires %%{SOURCE101}
%description
Mozilla Thunderbird is a standalone mail and newsgroup client.
%prep
echo "Build environment"
echo "dist %{?dist}"
echo "RHEL 8 minor version: %{rhel_minor_version}"
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
echo "use_bundled_ffi %{?use_bundled_ffi}"
echo "use_bundled_python_2 %{?use_bundled_python_2}"
echo "use_bundled_python_3 %{?use_bundled_python_3}"
echo "bundle_nss %{?bundle_nss}"
echo "system_nss %{?system_nss}"
echo "use_rustts %{?use_rustts}"
echo "use_bundled_nodejs %{?use_bundled_nodejs}"
echo "use_bundled_openssl %{?use_bundled_openssl}"
echo "use_bundled_yasm %{?use_bundled_yasm}"
%if 0%{?use_bundled_python_2}
%setup -q -T -c -n python2 -a 100
%patch1000 -p0 -b .build
%patch1002 -p0 -b .gcc8
%endif
%if 0%{?use_bundled_python_3}
%setup -q -T -c -n python3 -a 101
%if 0%{?rhel} == 6
%patch1003 -p0 -b .missing-utimensat.patch
%endif
%endif
%setup -q -n %{tarballdir}
# Firefox patches
%patch7 -p1 -b .debugedits-error
%ifarch %{ix86} %{arm} ppc
# binary check fails OOM on 32bit arches
%endif
%patch4 -p1 -b .build-mozconfig-fix
#%patch6 -p1 -b .nss-version
# Fedora patches
%patch215 -p1 -b .addons
%patch219 -p1 -b .rhbz-1173156
%patch224 -p1 -b .1170092
%if 0%{?rhel} == 8
%if %{rhel_minor_version} >= 3
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# fixing /usr/include in the patch for the flatpak build
%if 0%{?flatpak}
sed -ie 's|/usr/include|/app/include|' %_sourcedir/firefox-pipewire-0-3.patch
%endif
%patch235 -p1 -b .pipewire-0-3
%else
%patch231 -p1 -b .pipewire
%endif
%endif
%patch236 -p1 -b .fedora-shebang-build
%patch237 -p1 -b .disable-openpgp-in-thunderbird
%if 0%{?rhel} == 6
%patch232 -p1 -b .hugepage
%patch233 -p1 -b .rhel6-nss-tls1.3
%endif
%patch234 -p1 -b .rhbz-1821418
%patch402 -p1 -b .1196777
# Patch for big endian platforms only
%if 0%{?big_endian}
%endif
# Thunderbird patches
%patch501 -p1 -b .python-encode
%patch503 -p1 -b .mozilla-s390-context
%patch505 -p1 -b .mozilla-bmo1005535
%patch506 -p1 -b .mozilla-bmo1504834-part1
%patch507 -p1 -b .mozilla-bmo1504834-part2
%patch508 -p1 -b .mozilla-bmo1504834-part3
%patch509 -p1 -b .mozilla-bmo1504834-part4
%patch510 -p1 -b .mozilla-bmo1554971
%patch511 -p1 -b .mozilla-bmo1602730
%patch512 -p1 -b .mozilla-bmo849632
%patch513 -p1 -b .mozilla-bmo998749
%patch514 -p1 -b .mozilla-s390x-skia-gradient
%patch515 -p1 -b .mozilla-bmo1626236
%patch516 -p1 -b .D87019-thin-vec-big-endian.diff
%patch1001 -p1 -b .ppc64le-inline
%patch1004 -p1 -b .icu-make
%if 0%{?rhel} == 6
%patch600 -p1 -b .rhel6-dbusver
%patch601 -p1 -b .rhel6-kernel
%patch602 -p1 -b .rhel6-mach-fail
%patch603 -p1 -b .rhel6-zconst
%patch604 -p1 -b .rhel6-auxvh
%patch605 -p1 -b .rhel6-abiv2-mozbz1642174
%patch606 -p1 -b .rhel6-auxv
%patch607 -p1 -R -b .rhel6-at-no-automount
%patch608 -p1 -b .rhel6-clock_gettime
%endif
# CentOS patches
%if 0%{?rocky}
%patch10000 -p1 -b .mozilla-1238661
%patch10001 -p1 -b .mozilla-1526653
%endif
%{__rm} -f .mozconfig
%{__cp} %{SOURCE10} .mozconfig
function add_to_mozconfig() {
mozconfig_entry=$1
echo "ac_add_options --$1" >> .mozconfig
}
# Modify mozconfig file
%if %{official_branding}
add_to_mozconfig "enable-official-branding"
%endif
%{__cp} %{SOURCE24} mozilla-api-key
%{__cp} %{SOURCE27} google-api-key
%if %{?system_nss}
add_to_mozconfig "with-system-nspr"
add_to_mozconfig "with-system-nss"
%else
add_to_mozconfig "without-system-nspr"
add_to_mozconfig "without-system-nss"
%endif
%if 0%{?use_bundled_ffi}
add_to_mozconfig "with-system-ffi"
%endif
%if 0%{?system_ffi}
add_to_mozconfig "with-system-ffi"
%endif
%ifarch %{arm} %{ix86} x86_64
add_to_mozconfig "disable-elf-hack"
%endif
%if %{?system_hunspell}
echo "ac_add_options --enable-system-hunspell" >> .mozconfig
%else
# not available?
#echo "ac_add_options --disable-system-hunspell" >> .mozconfig
%endif
%if %{?debug_build}
add_to_mozconfig "enable-debug"
add_to_mozconfig "disable-optimize"
%else
%global optimize_flags "-g -O2"
%ifarch s390 s390x
%global optimize_flags "-g -O1"
%endif
%ifarch armv7hl
# ARMv7 need that (rhbz#1426850)
%global optimize_flags "-g -O2 -fno-schedule-insns"
%endif
%ifarch ppc64le aarch64
%global optimize_flags "-g -O2"
%endif
%if %{optimize_flags} != "none"
echo 'ac_add_options --enable-optimize=%{?optimize_flags}' >> .mozconfig
%else
echo 'ac_add_options --enable-optimize' >> .mozconfig
%endif
echo "ac_add_options --disable-debug" >> .mozconfig
%endif
# Second arches fail to start with jemalloc enabled
%ifnarch %{ix86} x86_64
echo "ac_add_options --disable-jemalloc" >> .mozconfig
%endif
%ifnarch %{ix86} x86_64
echo "ac_add_options --disable-webrtc" >> .mozconfig
%endif
%if !%{?system_jpeg}
echo "ac_add_options --without-system-jpeg" >> .mozconfig
%else
echo "ac_add_options --with-system-jpeg" >> .mozconfig
%endif
%if %{?system_libvpx}
echo "ac_add_options --with-system-libvpx" >> .mozconfig
%else
echo "ac_add_options --without-system-libvpx" >> .mozconfig
%endif
%if %{?system_libicu}
echo "ac_add_options --with-system-icu" >> .mozconfig
%else
echo "ac_add_options --without-system-icu" >> .mozconfig
%endif
%ifarch s390 s390x
echo "ac_add_options --disable-jit" >> .mozconfig
%endif
%ifnarch %{ix86}
%if !0%{?debug_build}
echo "ac_add_options --disable-debug-symbols" >> .mozconfig
%endif
%endif
echo 'export NODEJS="%{_buildrootdir}/bin/node-stdout-nonblocking-wrapper"' >> .mozconfig
# Remove executable bit to make brp-mangle-shebangs happy.
chmod -x third_party/rust/itertools/src/lib.rs
chmod a-x third_party/rust/gfx-backend-vulkan/src/*.rs
chmod a-x third_party/rust/gfx-hal/src/*.rs
chmod a-x third_party/rust/ash/src/extensions/ext/*.rs
chmod a-x third_party/rust/ash/src/extensions/khr/*.rs
chmod a-x third_party/rust/ash/src/extensions/mvk/*.rs
chmod a-x third_party/rust/ash/src/extensions/nv/*.rs
# install lightning langpacks
%build
ulimit -a
free
#set -e
# Hack for missing shell when building in brew on RHEL6
%if 0%{?rhel} == 6
export SHELL=/bin/sh
%endif
#GTK3 >>
%if ! 0%{?avoid_bundled_rebuild}
rm -rf %{_buildrootdir}/*
%endif
export PATH="%{_buildrootdir}/bin:$PATH"
function install_rpms_to_current_dir() {
PACKAGE_RPM=$(eval echo $1)
PACKAGE_DIR=%{_rpmdir}
if [ ! -f $PACKAGE_DIR/$PACKAGE_RPM ]; then
# Hack for tps tests
ARCH_STR=%{_arch}
%ifarch i386 i686
ARCH_STR="i?86"
%endif
%if 0%{?rhel} > 6
PACKAGE_DIR="$PACKAGE_DIR/$ARCH_STR"
%endif
fi
for package in $(ls $PACKAGE_DIR/$PACKAGE_RPM)
do
echo "$package"
rpm2cpio "$package" | cpio -idu
done
}
function build_bundled_package() {
PACKAGE_RPM=$1
PACKAGE_FILES=$2
PACKAGE_SOURCE=$3
PACKAGE_BUILD_OPTIONS=$4
export PACKAGE_DIR="%{_topdir}/RPMS"
PACKAGE_ALREADY_BUILD=0
%if %{?avoid_bundled_rebuild}
if ls $PACKAGE_DIR/$PACKAGE_RPM; then
PACKAGE_ALREADY_BUILD=1
fi
if ls $PACKAGE_DIR/%{_arch}/$PACKAGE_RPM; then
PACKAGE_ALREADY_BUILD=1
fi
%endif
if [ $PACKAGE_ALREADY_BUILD == 0 ]; then
echo "Rebuilding $PACKAGE_RPM from $PACKAGE_SOURCE"; echo "==============================="
rpmbuild --nodeps $PACKAGE_BUILD_OPTIONS --rebuild $PACKAGE_SOURCE
cat /var/tmp/rpm-tmp*
fi
find $PACKAGE_DIR
if [ ! -f $PACKAGE_DIR/$PACKAGE_RPM ]; then
# Hack for tps tests
ARCH_STR=%{_arch}
%ifarch i386 i686
ARCH_STR="i?86"
%endif
%if 0%{?rhel} > 6
export PACKAGE_DIR="$PACKAGE_DIR/$ARCH_STR"
%endif
fi
pushd $PACKAGE_DIR
echo "Installing $PACKAGE_DIR/$PACKAGE_RPM"; echo "==============================="
pwd
PACKAGE_LIST=$(echo $PACKAGE_DIR/$PACKAGE_RPM | tr " " "\n")
for PACKAGE in $PACKAGE_LIST
do
rpm2cpio $PACKAGE | cpio -iduv
done
PATH=$PACKAGE_DIR/usr/bin:$PATH
export PATH
LD_LIBRARY_PATH=$PACKAGE_DIR/usr/%{_lib}:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
# Clean rpms to avoid including them to package
%if ! 0%{?avoid_bundled_rebuild}
rm -f $PACKAGE_FILES
%endif
popd
}
# Build and install local yasm if needed
# ======================================
%if 0%{?use_bundled_yasm}
build_bundled_package 'yasm-1*.rpm' 'yasm-*.rpm' '%{SOURCE301}'
%endif
%if 0%{?bundle_nss}
rpm -ivh %{SOURCE402}
#rpmbuild --nodeps --define '_prefix %{gtk3_install_path}' --without=tests -ba %{_specdir}/nspr.spec
rpmbuild --nodeps --define '_prefix %{gtk3_install_path}' -ba %{_specdir}/nspr.spec
pushd %{_buildrootdir}
install_rpms_to_current_dir nspr-4*.rpm
install_rpms_to_current_dir nspr-devel*.rpm
popd
echo "Setting nspr flags"
# nss-setup-flags-env.inc
sed -i 's@%{gtk3_install_path}@%{_buildrootdir}%{gtk3_install_path}@g' %{_buildrootdir}%{gtk3_install_path}/%{_lib}/pkgconfig/nspr*.pc
export LDFLAGS="-L%{_buildrootdir}%{gtk3_install_path}/%{_lib} $LDFLAGS"
export LDFLAGS="-Wl,-rpath,%{gtk3_install_path}/%{_lib} $LDFLAGS"
export LDFLAGS="-Wl,-rpath-link,%{_buildrootdir}%{gtk3_install_path}/%{_lib} $LDFLAGS"
export PKG_CONFIG_PATH=%{_buildrootdir}%{gtk3_install_path}/%{_lib}/pkgconfig
export PATH="{_buildrootdir}%{gtk3_install_path}/bin:$PATH"
export PATH=%{_buildrootdir}/%{gtk3_install_path}/bin:$PATH
echo $PKG_CONFIG_PATH
rpm -ivh %{SOURCE403}
rpmbuild --nodeps --define '_prefix %{gtk3_install_path}' -ba %{_specdir}/nss.spec
pushd %{_buildrootdir}
#cleanup
#rm -rf {_buildrootdir}/usr/lib/debug/*
#rm -rf {_buildrootdir}/usr/lib/.build-id
#install_rpms_to_current_dir nss-%{gtk3_nvr}*.rpm
#install_rpms_to_current_dir nss-devel-%{gtk3_nvr}*.rpm
install_rpms_to_current_dir nss-3*.rpm
install_rpms_to_current_dir nss-devel*.rpm
install_rpms_to_current_dir nss-pkcs11-devel*.rpm
install_rpms_to_current_dir nss-softokn-3*.rpm
install_rpms_to_current_dir nss-softokn-devel*.rpm
install_rpms_to_current_dir nss-softokn-freebl-3*.rpm
install_rpms_to_current_dir nss-softokn-freebl-devel*.rpm
install_rpms_to_current_dir nss-util-3*.rpm
install_rpms_to_current_dir nss-util-devel*.rpm
popd
%filter_provides_in %{gtk3_install_path}/%{_lib}
%filter_requires_in %{gtk3_install_path}/%{_lib}
%filter_from_requires /libnss3.so.*/d
%filter_from_requires /libsmime3.so.*/d
%filter_from_requires /libssl3.so.*/d
%filter_from_requires /libnssutil3.so.*/d
%filter_from_requires /libnspr4.so.*/d
%endif
%if 0%{?rhel} == 6
%filter_from_requires /libnss3.so.*/d
%filter_from_requires /libsmime3.so.*/d
%filter_from_requires /libssl3.so.*/d
%filter_from_requires /libnssutil3.so.*/d
%filter_from_requires /libnspr4.so.*/d
%filter_from_provides /libnss3.so.*/d
%filter_from_provides /libsmime3.so.*/d
%filter_from_provides /libssl3.so.*/d
%filter_from_provides /libnssutil3.so.*/d
%filter_from_provides /libnspr4.so.*/d
%endif
%if 0%{?bundle_gtk3}
%if ! 0%{?avoid_bundled_rebuild}
rpm -ivh %{SOURCE200}
rpmbuild --nodeps --define '_prefix %{gtk3_install_path}' -ba %{_specdir}/gtk3-private.spec
%endif
pushd %{_buildrootdir}
install_rpms_to_current_dir gtk3-private-%{gtk3_nvr}*.rpm
install_rpms_to_current_dir gtk3-private-devel-%{gtk3_nvr}*.rpm
install_rpms_to_current_dir gtk3-private-rpm-scripts-%{gtk3_nvr}*.rpm
popd
%endif
%if 0%{?bundle_gtk3}
# gtk3-private-3.22.26.el6-1-requires-provides-filter.inc
%include_file %{SOURCE206}
%endif
%if 0%{use_bundled_ffi}
# Install libraries to the predefined location to later add them to the Firefox libraries
rpm -ivh %{SOURCE303}
rpmbuild --nodeps --define '_prefix %{gtk3_install_path}' -ba %{_specdir}/libffi.spec
pushd %{_buildrootdir}
install_rpms_to_current_dir 'libffi*.rpm'
popd
%filter_from_requires /libffi.so.6/d
%endif
%filter_setup
# If needed build the bundled python 2.7 and 3.6 and put it in the PATH
%if 0%{?use_bundled_python_3}
pushd %{_builddir}/python3/Python-%{bundled_python_version_3}
./configure --prefix="%{_buildrootdir}" --exec-prefix="%{_buildrootdir}" --libdir="%{_buildrootdir}/lib"
make %{?_smp_mflags} install V=1 -j1
cp Tools/scripts/pathfix.py %{_buildrootdir}/bin
popd
%endif
%if 0%{?use_bundled_python_2}
pushd %{_builddir}/python2/Python-%{bundled_python_version_2}
./configure --prefix="%{_buildrootdir}" --exec-prefix="%{_buildrootdir}" --libdir="%{_buildrootdir}/lib"
make %{?_smp_mflags} install V=1
popd
%endif
function replace_prefix() {
FILE_NAME=$1
PKG_CONFIG_PREFIX=$2
cat $FILE_NAME | tail -n +2 > tmp.txt
echo "$PKG_CONFIG_PREFIX" > $FILE_NAME
cat tmp.txt >> $FILE_NAME
rm -rf tmp.txt
}
# Build and install local openssl if needed
# =========================================
%if 0%{?use_bundled_openssl}
rpm -ivh %{SOURCE305}
rpmbuild --nodeps -ba %{_specdir}/openssl.spec
pushd %{_buildrootdir}
install_rpms_to_current_dir openssl-1.0.2k*.rpm
install_rpms_to_current_dir openssl-libs-1.0.2k*.rpm
install_rpms_to_current_dir openssl-devel-1.0.2k*.rpm
install_rpms_to_current_dir openssl-static-1.0.2k*.rpm
# openssl is installed to %{_buildrootdir}/usr/lib(64)/...
export PKG_CONFIG_PATH=%{_buildrootdir}/%{_libdir}/pkgconfig/:$PKG_CONFIG_PATH
replace_prefix %{_buildrootdir}/%{_libdir}/pkgconfig/libcrypto.pc prefix=%{_buildrootdir}/usr
replace_prefix %{_buildrootdir}/%{_libdir}/pkgconfig/libssl.pc prefix=%{_buildrootdir}/usr
replace_prefix %{_buildrootdir}/%{_libdir}/pkgconfig/openssl.pc prefix=%{_buildrootdir}/usr
cat %{_buildrootdir}/%{_libdir}/pkgconfig/libcrypto.pc
cat %{_buildrootdir}/%{_libdir}/pkgconfig/libssl.pc
cat %{_buildrootdir}/%{_libdir}/pkgconfig/openssl.pc
pushd %{_rpmdir}
rm -f openssl-*.rpm
popd
popd
%endif
# GTK3 <<
# We need to disable exit on error temporarily for the following scripts:
set +e
%if 0%{?use_dts}
source scl_source enable devtoolset-%{dts_version}
%endif
%if 0%{?use_rustts}
source scl_source enable rust-toolset-%{rust_toolset_version}
%endif
env
which gcc
which c++
which g++