Пакет texlive: Specfile

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
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
406
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
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
573
574
575
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
# BEGIN SourceDeps(oneline):
BuildRequires: gcc-c++ gobject-introspection-devel imake libXt-devel perl(Archive/Tar.pm) perl(BibTeX/Parser.pm) perl(BibTeX/Parser/Author.pm) perl(Date/Format.pm) perl(Date/Parse.pm) perl(Digest/SHA1.pm) perl(Encode.pm) perl(Encode/Alias.pm) perl(Encode/Locale.pm) perl(ExtUtils/MakeMaker.pm) perl(Fatal.pm) perl(File/Copy/Recursive.pm) perl(File/Which.pm) perl(HTML/FormatText.pm) perl(HTML/TreeBuilder.pm) perl(HTTP/Request/Common.pm) perl(IO/Compress/Zip.pm) perl(IPC/System/Simple.pm) perl(JSON.pm) perl(LWP/Protocol/https.pm) perl(LWP/Simple.pm) perl(LWP/UserAgent.pm) perl(LaTeX/ToUnicode.pm) perl(Locale/Maketext/Simple.pm) perl(Math/Trig.pm) perl(Pod/Man.pm) perl(Pod/Text.pm) perl(Pod/Usage.pm) perl(Spreadsheet/ParseExcel.pm) perl(Statistics/Descriptive.pm) perl(Statistics/Distributions.pm) perl(Term/ANSIColor.pm)
BuildRequires: perl(Term/ReadKey.pm) perl(Test.pm) perl(Tk.pm) perl(Tk/Dialog.pm) perl(Tk/NoteBook.pm) perl(URI/Escape.pm) perl(WWW/Mechanize.pm) perl(autodie.pm) perl-devel texinfo xorg-cf-files zlib-devel bzlib-devel
# END SourceDeps(oneline)
# findreq artefacts
# let's drop the dep for now
%filter_from_requires /^gambit$/d
# noise
%filter_from_requires /^.bin.sh5$/d
%filter_from_requires /^.bin.bsh$/d
%filter_from_requires /^.bin.ksh$/d
%filter_from_requires /^perl(make-rules.pl)/d
%filter_from_requires /^perl(installer.ctan-mirrors.pl)/d
%filter_from_requires /^perl(installer.mirrors.pl)/d
%filter_from_requires /^perl(TeXLive.trans.pl)/d

BuildRequires: libpixman-devel
BuildRequires: chrpath
# see https://bugzilla.altlinux.org/show_bug.cgi?id=10382
%define _localstatedir %{_var}
BuildRequires: /usr/bin/hg
#define _binary_payload		w9.gzdio
#define _source_payload		w9.gzdio

%global __requires_exclude ^perl\\((PDF::Reuse.*|Pedigree.*|TeXLive.*|Tk::path_tre|only|pdfTeX|script::MakeSPList)\\)|pear\\(animals.php\\)
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_docdir}

# need to bootstrap first
# - xindy need clisp in main
# - let asymptote be packaged separately, as the generated one is known
#   to not be fully functional
%define enable_asymptote	0
%define enable_xindy		0

# in its own package
%define enable_xdvik            1
%define enable_dvi2tty          1

# luajit supports only these architectures
%ifarch %ix86 x86_64 %arm aarch64 %mips
%define enable_luajittex	1
%define enable_mfluajit		1
%else
%define enable_luajittex	0
%define enable_mfluajit		0
%endif

%define with_system_poppler	1
%define with_system_dialog	1
%define with_system_icu		1
%define with_system_lcdf	0
%define with_system_psutils	1
%define with_system_t1lib	1
%define with_system_tex4ht	0
%define with_system_teckit	1
%define with_system_graphite2	1
%define with_system_harfbuzz	1

%define enable_shared		1

%define texmfbindir		%{_bindir}
%define texmfdir		%{_datadir}/texmf
%define texmfdistdir		%{_datadir}/texmf-dist
%define texmflocaldir		%{_datadir}/texmf-local
%define texmfextradir		%{_datadir}/texmf-extra
%define texmffontsdir		%{_datadir}/texmf-fonts
%define texmfprojectdir		%{_datadir}/texmf-project
%define texmfvardir		%{_localstatedir}/lib/texmf
%define texmfconfdir		%{_sysconfdir}/texmf
%define relYear	2021
%global tl_version %relYear
%global mga_tl_timestamp 20210325


#-----------------------------------------------------------------------
Name:		texlive
Version:	%relYear
Release:	alt5_3
Summary:	The TeX formatting system
Group:		Publishing
License:	http://www.tug.org/texlive/LICENSE.TL
URL:		http://tug.org/texlive/
Source0:	ftp://tug.org/historic/systems/texlive/%{relYear}/%{name}-%{mga_tl_timestamp}-source.tar.xz
Source1:	ftp://tug.org/historic/systems/texlive/%{relYear}/%{name}-%{mga_tl_timestamp}-source.tar.xz.sha512

%if %{enable_xdvik}
Requires:	ghostscript-module-X
%endif


#-----------------------------------------------------------------------
%if %{with_system_dialog}
Requires:	dialog
%endif
Requires:	ghostscript
%if %{enable_asymptote}
Requires:	gv
Requires:	tkinter
%endif
%if %{with_system_lcdf}
Requires:	lcdf-typetoools
%else
%endif
%if %{with_system_psutils}
Requires:	psutils
%endif
%if %{with_system_teckit}
Requires:	libteckit-utils
%endif
%if %{with_system_tex4ht}
Requires:	tex4ht
%else
%endif
Requires:	texlive-collection-basic

# Fix upgrade for luatex (mga#12303)

#-----------------------------------------------------------------------
BuildRequires:	autoconf-archive
BuildRequires:	bison
%if %{enable_xindy}
BuildRequires:	clisp
BuildRequires:	libffcall-devel
%endif
%if %{enable_asymptote}
BuildRequires:	libfftw3-devel
BuildRequires:	flex
%endif
BuildRequires:	pkgconfig(freetype2)
BuildRequires:	pkgconfig(fontconfig)
BuildRequires:  libgmp-devel
%if %{enable_asymptote}
BuildRequires:	libgc-devel
BuildRequires:	libsigsegv-devel
BuildRequires:	ghostscript-dvipdf
BuildRequires:	libgsl-devel
BuildRequires:	libGL-devel
%endif
BuildRequires:	libgs-devel
BuildRequires:	pkgconfig(libbrotlienc)
BuildRequires:	pkgconfig(libwoff2enc)
BuildRequires:	libxxhash-devel
BuildRequires:	libpotrace-devel
BuildRequires:	pkgconfig(gdlib)
BuildRequires:  graphite2-devel
BuildRequires:  pkgconfig(harfbuzz)
BuildRequires:  pkgconfig(mpfr)
%if %{with_system_poppler}
BuildRequires: pkgconfig(poppler)
%endif
BuildRequires:	pkgconfig(xaw7)
%if !%{with_system_dialog}
BuildRequires:	ncurses-devel
%endif
BuildRequires:	pkgconfig(libpng)
%if %{with_system_t1lib}
BuildRequires:	t1lib-devel
%endif
%if %{with_system_teckit}
BuildRequires:	libteckit-devel
%endif
%if %{with_system_icu}
BuildRequires:	libicu-devel
%endif
%if %{with_system_graphite2}
BuildRequires:	libgraphite2-devel
%endif
%if %{with_system_harfbuzz}
BuildRequires:	libharfbuzz-devel
%endif
%if %{enable_xindy}
BuildRequires:	texlive
%endif
%if %{enable_asymptote}
BuildRequires:	makeinfo
%endif
BuildRequires:	pkgconfig(zziplib)
BuildRequires:	pkgconfig(cairo)
BuildRequires:	libpaper-devel
BuildRequires:	mercurial mercurial-hgext

#-----------------------------------------------------------------------
Patch1: texlive-20160523-mageia-format.patch
%if %{enable_asymptote}
Patch2: texlive-20160523-mageia-asymptote.patch
%endif
Patch4: texlive-20160523-texmf-mageia-kpfix.patch
Patch5: includePatch.patch
Patch7: texlive-dvisvgm-system-libs.patch
Source44: import.info
Provides: dvipng = %{tl_version}
Provides: lcdf-typetools = %{tl_version}
Provides: ps2eps = %{tl_version}
Provides: tex4ht = %{tl_version}
Obsoletes: dvipng <= 1.14-alt1.qa1.1
Obsoletes: lcdf-typetools <= 2.104-alt1
Obsoletes: ps2eps <= 1.68-alt1
Obsoletes: tex4ht <= 1.0.2009_06_11_1038-alt1
Conflicts: dvipng <= 1.14-alt1.qa1.1
Conflicts: lcdf-typetools <= 2.104-alt1
Conflicts: ps2eps <= 1.68-alt1
Conflicts: tetex-afm < 2.01
Conflicts: tetex-bibtex8 < 2.01
Conflicts: tetex-core < 2.01
Conflicts: tetex-dvilj < 2.01
Conflicts: tetex-dvips < 2.01
Conflicts: tetex-latex < 2.01
Conflicts: tetex-xdvi < 2.01
Conflicts: tex4ht <= 1.0.2009_06_11_1038-alt1
Conflicts: texlive-base-bin < 2009
Conflicts: texlive-extra-utils < 2009
Conflicts: texlive-font-utils < 2009
Conflicts: texlive-lang-indic < 2009
Conflicts: texlive-latex-base < 2009
Conflicts: texlive-metapost < 2009
Conflicts: texlive-omega < 2009
Conflicts: texlive-xetex < 2009
Patch33: texlive-2017-alt-texmf-first.patch
Patch34: texlive-2018-alt-gcc8.patch
Provides: texlive-collection-binextra = %{tl_version}
Patch35: texlive-2018-e2k-luatex.patch
# Poppler patches
#Patch101: 0001-try-to-adapt-to-poppler-0.58.patch

# fixed build with gcc-13
Patch36: texlive-20210325-alt-gcc13.patch

#-----------------------------------------------------------------------
%description
TeX Live is an easy way to get up and running with the TeX document
production system. It provides a comprehensive TeX system. It includes
all the major TeX-related programs, macro packages, and fonts that are
free software, including support for many languages around the world.

%files
%{texmfbindir}/*
%dir %{texmfvardir}
%ghost %{texmfvardir}/ls-R
%dir %{texmfconfdir}/web2c
%ghost %{texmfconfdir}/ls-R
%ghost %config(noreplace) %{texmfconfdir}/web2c/updmap.cfg


#-----------------------------------------------------------------------
%if %{enable_shared}
########################################################################
%define        kpathsea_major          6
%define        kpathsea                libkpathsea%{kpathsea_major}
%exclude %{texmfbindir}/teckit_compile

%package	-n %{kpathsea}
Summary:	Path searching library for TeX-related files
Group:		System/Libraries

%description	-n %{kpathsea}
Kpathsea implements generic path searching, configuration,
and TeX-specific file searching.

%files		-n %{kpathsea}
%{_libdir}/libkpathsea.so.%{kpathsea_major}
%{_libdir}/libkpathsea.so.%{kpathsea_major}.*

#-----------------------------------------------------------------------
%define	kpathsea_devel		libkpathsea-devel

%package	-n %{kpathsea_devel}
Summary:	Kpathsea development files
Group:		Development/C
Provides:	kpathsea-devel = %{version}-%{release}

%description	-n %{kpathsea_devel}
Kpathsea implements generic path searching, configuration,
and TeX-specific file searching.
This package includes the kpathsea development files.

%files		-n %{kpathsea_devel}
%{_includedir}/kpathsea
%{_libdir}/libkpathsea.so
%{_libdir}/pkgconfig/kpathsea.pc

#-----------------------------------------------------------------------
%define        texlua_major           5
%define        texluajit_major        2
%define        texlua                 libtexlua%{texlua_major}

%package	-n %{texlua}
Summary:	Library for TeXlua
Group:		System/Libraries

%description	-n %{texlua}
TeXlua library

%files		-n %{texlua}
%{_libdir}/libtexlua53.so.%{texlua_major}
%{_libdir}/libtexlua53.so.%{texlua_major}.*
%if %{enable_luajittex}
%{_libdir}/libtexluajit.so.%{texluajit_major}
%{_libdir}/libtexluajit.so.%{texluajit_major}.*
%endif


#-----------------------------------------------------------------------
%define	texlua_devel		libtexlua-devel

%package	-n %{texlua_devel}
Summary:	Library for TeXlua
Group:		Development/C
Provides:	texlua-devel = %{version}-%{release}

%description	-n %{texlua_devel}
TeXlua library
This package includes the TeXlua development files.

%files		-n %{texlua_devel}
%{_includedir}/texlua53
%{_libdir}/libtexlua53.so
%{_libdir}/pkgconfig/texlua53.pc
%if %{enable_luajittex}
%{_includedir}/texluajit
%{_libdir}/libtexluajit.so
%{_libdir}/pkgconfig/texluajit.pc
%endif

#-----------------------------------------------------------------------
%define        synctex_major           2
%define        synctex                 libsynctex%{synctex_major}

%package	-n %{synctex}
Summary:	Library for SyncTeX
Group:		System/Libraries

%description	-n %{synctex}
synctex library

%files		-n %{synctex}
%{_libdir}/libsynctex.so.%{synctex_major}
%{_libdir}/libsynctex.so.%{synctex_major}.*

#-----------------------------------------------------------------------
%define	synctex_devel		libsynctex-devel

%package	-n %{synctex_devel}
Summary:	Library for SyncTeX
Group:		Development/C
Provides:	synctex-devel = %{version}-%{release}

%description	-n %{synctex_devel}
synctex library
This package includes the synctex development files.

%files		-n %{synctex_devel}
%{_includedir}/synctex
%{_libdir}/libsynctex.so
%{_libdir}/pkgconfig/synctex.pc

#-----------------------------------------------------------------------
%define        ptexenc_major           1
%define        ptexenc                 libptexenc%{ptexenc_major}

%package	-n %{ptexenc}
Summary:	Library for Japanese pTeX
Group:		System/Libraries

%description	-n %{ptexenc}
ptexenc is a useful library for Japanese pTeX
(which stands for publishing TeX, and is an extension of
TeX by ASCII Co.) and its surrounding tools.

%files		-n %{ptexenc}
%{_libdir}/libptexenc.so.%{ptexenc_major}
%{_libdir}/libptexenc.so.%{ptexenc_major}.*

#-----------------------------------------------------------------------
%define	ptexenc_devel		libptexenc-devel

%package	-n %{ptexenc_devel}
Summary:	Library for Japanese pTeX
Group:		Development/C
Provides:	ptexenc-devel = %{version}-%{release}

%description	-n %{ptexenc_devel}
ptexenc is a useful library for Japanese pTeX
(which stands for publishing TeX, and is an extension of
TeX by ASCII Co.) and its surrounding tools.
This package includes the ptexenc development files.

%files		-n %{ptexenc_devel}
%{_includedir}/ptexenc
%{_libdir}/libptexenc.so
%{_libdir}/pkgconfig/ptexenc.pc

########################################################################
# enable_shared
%endif

#-----------------------------------------------------------------------
%prep
%setup -q -n %{name}-%{mga_tl_timestamp}-source
hg init -q .
hg add -q .
hg commit -q --user "rpmbuild <rpmbuild>" -m "%{NAME}-%{VERSION} base"
cat %_sourcedir/texlive-20160523-mageia-format.patch | hg import -  -q -m texlive-20160523-mageia-format.patch --user "rpmbuild <rpmbuild>"
%if %{enable_asymptote}
cat %_sourcedir/texlive-20160523-mageia-asymptote.patch | hg import -  -q -m texlive-20160523-mageia-asymptote.patch --user "rpmbuild <rpmbuild>"
%endif
cat %_sourcedir/texlive-20160523-texmf-mageia-kpfix.patch | hg import -  -q -m texlive-20160523-texmf-mageia-kpfix.patch --user "rpmbuild <rpmbuild>"
cat %_sourcedir/includePatch.patch | hg import -  -q -m includePatch.patch --user "rpmbuild <rpmbuild>"
cat %_sourcedir/texlive-dvisvgm-system-libs.patch | hg import -  -q -m texlive-dvisvgm-system-libs.patch --user "rpmbuild <rpmbuild>"


# setup default builtin values, added to paths.h from texmf.cnf
perl -pi -e 's%%^(TEXMFMAIN\s+= ).*%%$1%{texmfdistdir}%%;'			  \
	 -e 's%%^(TEXMFDIST\s+= ).*%%$1%{texmfdistdir}%%;'			  \
	 -e 's%%^(TEXMFLOCAL\s+= ).*%%$1%{texmflocaldir}%%;'			  \
	 -e 's%%^(TEXMFSYSVAR\s+= ).*%%$1%{texmfvardir}%%;'		  \
	 -e 's%%^(TEXMFSYSCONFIG\s+= ).*%%$1%{texmfconfdir}%%;'		  \
	 -e 's%%^(TEXMFHOME\s+= ).*%%$1\$HOME/texmf%%;'			  \
	 -e 's%%^(TEXMFVAR\s+= ).*%%$1\$HOME/.texlive%{relYear}/texmf-var%%;'	  \
	 -e 's%%^(TEXMFCONFIG\s+= ).*%%$1\$HOME/.texlive%{relYear}/texmf-config%%;'\
	 -e 's%%^(OSFONTDIR\s+= ).*%%$1%{_datadir}/fonts%%;'		  \
	texk/kpathsea/texmf.cnf
%patch33 -p0
%patch34 -p1
%patch35 -p2
%patch36 -p1

%if ! %{enable_luajittex}
# even if building luajit is disabled, build scripts still call
# configure from libs/*. let's just drop the luajit sources here.
rm -rf libs/luajit
%endif

#-----------------------------------------------------------------------
%build
%add_optflags -fpermissive
export CXXFLAGS="%{optflags} -std=c++14"

#for dvisvgm system libs patches
autoreconf -vfi texk/dvisvgm
# viy: LTO
# and something like autoreconf -fisv libs/cairo does not work
rm -rf libs/cairo

# viy: for new
#libtool: Version mismatch error.  This is libtool 2.4.7, but the
#libtool: definition of this LT_INIT comes from libtool 2.4.6.
./reautoconf
mkdir -p Work
pushd Work

%define _configure_script ../configure
CONFIGURE_TOP=.. \
%configure							\
	--with-banner-add="/Mageia"				\
	--disable-native-texlive-build				\
	--enable-missing					\
	--disable-linked-scripts				\
	--with-system-gmp					\
	--with-system-graphite2					\
	--with-system-harfbuzz					\
	--with-system-libpaper					\
	--with-system-mpfr					\
	--with-system-zlib					\
%if %{enable_luajittex}
	--enable-luajittex					\
%else
	--disable-luajittex					\
	--disable-luajithbtex					\
%endif
%if %{enable_mfluajit}
	--enable-mfluajit					\
%else
	--disable-mfluajit					\
%endif
%if %{enable_shared}
	--enable-shared						\
	--disable-static					\
%else
	--disable-shared					\
%endif
%if %{enable_xindy}
	--enable-xindy-rules            			\
%else
	--disable-xindy						\
%endif
%if %{enable_xdvik}
        --enable-xdvik                                          \
%else
        --disable-xdvik                                         \
%endif
%if %{enable_dvi2tty}
        --enable-dvi2tty                                        \
%else
        --disable-dvi2tty                                       \
%endif
	--with-system-freetype2					\
	--with-freetype2-includes=%{_includedir}/freetype2	\
%if %{with_system_dialog}
	--disable-dialog					\
%else
	--enable-dialog						\
%endif
%if %{with_system_psutils}
	--disable-psutils					\
%else
	--enable-psutils					\
%endif
	--with-system-gd					\
%if %{with_system_lcdf}
	--disable-lcdf-typetools				\
%endif
	--with-system-libpng					\
%if %{with_system_t1lib}
	--with-system-t1lib					\
	--disable-t1utils					\
%endif
%if %{with_system_teckit}
	--disable-teckit					\
	--with-teckit-includes=%{_includedir}/teckit		\
%endif
%if %{with_system_tex4ht}
	--disable-tex4htk					\
%endif
%if %{with_system_icu}
	--with-system-icu					\
%else
	--without-system-icu					\
%endif
%if %{with_system_poppler}
	--without-system-xpdf					\
	--with-system-poppler					\
%else
	--without-system-xpdf					\
%endif
%if %{with_system_graphite2}
	--with-system-graphite2					\
%else
	--without-system-graphite2					\
%endif
%if %{with_system_harfbuzz}
	--with-system-harfbuzz					\
%else
	--without-system-harfbuzz					\
%endif
	--with-system-zziplib					\
	--with-system-cairo					\
	--with-system-pixman
%define _configure_script ./configure
%make_build

popd

%if %{enable_asymptote}
pushd utils/asymptote
%configure							\
	--enable-gc=system					\
	--enable-texlive-build					\
	--datadir=%{texmfdir}
%make_build
popd
%endif

#-----------------------------------------------------------------------
%install
pushd Work
%makeinstall_std
popd

%if %{enable_asymptote}
pushd utils/asymptote
%makeinstall_std
popd
%endif

mkdir -p %{buildroot}%{_datadir}
for dir in texmf texmf-dist; do
    if [ -d %{buildroot}%{_prefix}/$dir ]; then
	rm -fr %{buildroot}%{_datadir}/$dir
	mv %{buildroot}%{_prefix}/$dir %{buildroot}%{_datadir}
    fi
done

mkdir -p %{buildroot}%{texmfvardir}
mkdir -p %{buildroot}%{texmfconfdir}

%if %{with_system_lcdf}
# stray directory left
rm -fr %{buildroot}%{_datadir}/lcdf-typetools-for-tex-live
%else
# openmpi has a program with the same name
if [ -f %{buildroot}%{texmfbindir}/otfinfo ]; then
    mv -f %{buildroot}%{texmfbindir}/otfinfo{,-texlive}
fi
%endif

pushd %{buildroot}%{texmfbindir}
	# missing symbolic links
	ln -sf aleph lamed
	ln -sf luatex dvilualatex
	ln -sf luatex dviluatex
	ln -sf luahbtex lualatex
	ln -sf pdftex amstex
	ln -sf pdftex cslatex
	ln -sf pdftex csplain
	ln -sf pdftex eplain
	ln -sf pdftex etex
	ln -sf pdftex latex
	ln -sf pdftex mex
	ln -sf pdftex mltex
	ln -sf pdftex mllatex
	ln -sf pdftex pdfcslatex
	ln -sf pdftex pdfcsplain
	ln -sf pdftex pdfetex
	ln -sf pdftex pdflatex
	ln -sf pdftex pdfmex
	ln -sf pdftex physe
	ln -sf pdftex phyzzx
	ln -sf pdftex utf8mex
	ln -sf pdftex texsis
	ln -sf ptex platex
	ln -sf mpost metafun
	ln -sf mpost mfplain
	ln -sf xetex xelatex

    # correct symlinks
    for file in *; do
	link=`readlink $file` || :
	if [ "x$link" != "x" ]; then
	    ln -sf `echo $link |					\
		sed	-e 's|\.\./.*texmf-dist/|%{texmfdistdir}/|'	\
			-e 's|\.\./.*texmf/|%{texmfdir}/|'`		\
		$file
	fi
    done
%if %{with_system_dialog}
	ln -sf %{_bindir}/dialog tcdialog
%endif
%if %{enable_asymptote}
	ln -sf %{texmfdir}/asymptote/GUI/xasy.py xasy
%endif
	# install scripts from texlive-texmf
	rm -f a2ping afm2afm arlatex authorindex autoinst bibexport		\
	bundledoc cachepic cmap2enc de-macro dviasm ebong e2pall	\
	epspdf epspdftk epstopdf fig4latex findhyph font2afm		\
	fragmaster ht htcontext htlatex htmex httex httexi htxelatex	\
	htxetex latex2man latexdiff latexdiff-vc latexmk latexrevise	\
	listings-ext.sh makeglossaries mathspic mk4ht mkgrkindex	\
	mkjobtexmf mkluatexfontdb mkt1font mptopdf ot2kpx pdf180	\
	pdf270 pdf90 pdfannotextractor pdfatfi pdfbook pdfcrop	\
	pdfflip pdfjam pdfjam-pocketmod pdfjam-slides3up		\
	pdfjam-slides6up pdfjoin pdfnup pdfpun pdfthumb perltex	\
	pfm2kpx pkfix  pkfix-helper ppower4 ps4pdf pst2pdf purifyeps	\
	repstopdf rpdfcrop rungs showglyphs simpdftex splitindex	\
	svn-multi texcount texdiff texdirflatten texdoc texdoctk	\
	texloganalyser thumbpdf tlmgr ulqda updmap vpe vpl2ovp	\
	vpl2vpl
popd

# use texmf data
rm -fr %{buildroot}%{texmfdir} %{buildroot}%{texmfdistdir}

# install manual pages and info files from texlive-texmf tarball
rm -fr %{buildroot}%{_mandir} %{buildroot}%{_infodir}

%if !%{enable_shared}
# do not generate dynamic libraries and do not install static ones
rm -fr %{buildroot}%{_libdir}
rm -fr %{buildroot}%{_includedir}
%endif

rm -f %{buildroot}%{_datadir}/applications/xdvi.desktop

# drop .la files
find %{buildroot} -name "*.la" -delete
for rpm404_ghost in %{texmfvardir}/ls-R %{texmfconfdir}/ls-R %{texmfconfdir}/web2c/updmap.cfg
do
    mkdir -p %buildroot`dirname "$rpm404_ghost"`
    touch %buildroot"$rpm404_ghost"
done
# kill rpath
for i in `find %buildroot{%_bindir,%_libdir,/usr/libexec,/usr/lib,/usr/sbin} -type f -perm -111 ! -name '*.la' `; do
	chrpath -d $i ||:
done


%post 
rm -f %{texmfdir}/ls-R %{texmfdistdir}/ls-R %{texmfconfdir}/ls-R


#-----------------------------------------------------------------------
%changelog
* Thu Jul 27 2023 Mikhail Tergoev <fidel@altlinux.org> 2021-alt5_3
- NMU: fixed build with gcc-13 (ALT bug 46864)

* Tue Jul 11 2023 Mikhail Tergoev <fidel@altlinux.org> 2021-alt4_3
- NMU: fixed build (force compiling with gcc-12)

* Wed Jun 22 2022 Igor Vlasenko <viy@altlinux.org> 2021-alt3_3
- fixed build

* Tue Jan 04 2022 Igor Vlasenko <viy@altlinux.org> 2021-alt2_3
- riscv64 support

* Thu Sep 23 2021 Igor Vlasenko <viy@altlinux.org> 2021-alt1_3
- fixed build

* Thu Aug 05 2021 Igor Vlasenko <viy@altlinux.org> 2021-alt1_2
- new version

* Fri Dec 11 2020 Igor Vlasenko <viy@altlinux.ru> 2019-alt2_7
- fixed build with gcc10

* Wed Mar 11 2020 Nikita Ermakov <arei@altlinux.org> 2019-alt1_7
- Make texlive build with poppler >= 0.83.

* Mon Nov 04 2019 Igor Vlasenko <viy@altlinux.ru> 2019-alt1_6
- filetrigger fixes

* Thu Oct 31 2019 Andrey Savchenko <bircoph@altlinux.org> 2019-alt1_3
- Use external ligraphite2 and harfbuzz. This fixes build on E2K.
- Remove obsolete E2K patches.

* Sat Jul 20 2019 Igor Vlasenko <viy@altlinux.ru> 2019-alt1_2
- new version

* Fri May 24 2019 Gleb F-Malinovskiy <glebfm@altlinux.org> 2018-alt3_12
- Fixed build on architectures not supported by luajit.

* Tue Apr 09 2019 Igor Vlasenko <viy@altlinux.ru> 2018-alt2_12
- fixed build with poppler 75 (closes: #35567)

* Wed Feb 13 2019 Igor Vlasenko <viy@altlinux.ru> 2018-alt2_10
- fixed build

* Wed Dec 05 2018 Igor Vlasenko <viy@altlinux.ru> 2018-alt2_7
- built with new poppler (closes: #35711)

* Tue Oct 30 2018 Igor Vlasenko <viy@altlinux.ru> 2018-alt2_4
- rebuild with new icu

* Tue Oct 16 2018 Igor Vlasenko <viy@altlinux.ru> 2018-alt1_4
- new version; fixes CVE-2018-17407

* Sat Jun 16 2018 Igor Vlasenko <viy@altlinux.ru> 2017-alt2_4
- luatex bugfix thanks to lakostis@ (closes: #35024)

* Sun Mar 11 2018 Igor Vlasenko <viy@altlinux.ru> 2017-alt2_3
- final release

* Thu Mar 01 2018 Igor Vlasenko <viy@altlinux.ru> 2017-alt1_3
- new version