aboutsummaryrefslogtreecommitdiff
path: root/tests/texlive.scm
blob: fac9faf7141488249dcfdd045583b0cf6c60fcdd (about) (plain)
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
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
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017, 2022 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2023 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-texlive)
  #:use-module (gnu packages tex)
  #:use-module (guix import texlive)
  #:use-module (guix tests)
  #:use-module (guix tests http)
  #:use-module (guix build utils)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64)
  #:use-module (srfi srfi-26)
  #:use-module (web client)
  #:use-module (ice-9 match))

(test-begin "texlive")

(define %fake-tlpdb
  '(("12many"
     . ((name
         . "12many")
        (catalogue
         . "one2many")
        (shortdesc
         . "Generalising mathematical index sets")
        (longdesc
         . "In the discrete branches of mathematics...")
        (docfiles
         . ("texmf-dist/doc/latex/12many/12many.pdf"
            "texmf-dist/doc/latex/12many/README"))
        (srcfiles
         . ("texmf-dist/source/latex/12many/12many.dtx"
            "texmf-dist/source/latex/12many/12many.ins"))
        (runfiles
         . ("texmf-dist/tex/latex/12many/12many.sty"))
        (catalogue-license . "lppl")))
    ("adforn"
     (name . "adforn")
     (shortdesc . "OrnementsADF font with TeX/LaTeX support")
     (longdesc . "The bundle provides the Ornements ADF font...")
     (execute "addMap OrnementsADF.map")
     (docfiles
      "texmf-dist/doc/fonts/adforn/COPYING"
      "texmf-dist/doc/fonts/adforn/NOTICE"
      "texmf-dist/doc/fonts/adforn/README"
      "texmf-dist/doc/fonts/adforn/adforn.pdf")
     (runfiles
      "texmf-dist/fonts/afm/arkandis/adforn/OrnementsADF.afm"
      "texmf-dist/fonts/enc/dvips/adforn/OrnementsADF.enc"
      "texmf-dist/fonts/map/dvips/adforn/OrnementsADF.map"
      "texmf-dist/fonts/tfm/arkandis/adforn/OrnementsADF.tfm"
      "texmf-dist/fonts/type1/arkandis/adforn/OrnementsADF.pfb"
      "texmf-dist/tex/latex/adforn/adforn.sty"
      "texmf-dist/tex/latex/adforn/uornementsadf.fd")
     (catalogue-license . "lppl gpl2"))
    ("authorindex"
     (name . "authorindex")
     (shortdesc . "Index citations by author names")
     (longdesc . "This package allows the user to...")
     (depend "authorindex.ARCH")
     (docfiles "texmf-dist/doc/latex/authorindex/COPYING")
     (runfiles
      "texmf-dist/scripts/authorindex/authorindex"
      "texmf-dist/tex/latex/authorindex/authorindex.sty")
     (catalogue-license . "lppl"))
    ("authorindex.x86_64-linux"
     (name . "authorindex.x86_64-linux")
     (binfiles "bin/amd64-netbsd/authorindex"))
    ("chs-physics-report"
     . ((name . "ch-physics-report")
        (shortdesc . "Physics lab reports...")
        (longdesc . "This package may...")
        (docfiles
         .
         ("texmf-dist/doc/latex/chs-physics-report/README.txt"
          "texmf-dist/doc/latex/chs-physics-report/chs-physics-report.pdf"))
        (runfiles
         .
         ("texmf-dist/tex/latex/chs-physics-report/chs-physics-report.sty"))
        (catalogue-license . "pd cc-by-sa-3")))
    ("collection-basic"
     (name . "collection-basic")
     (shortdesc . "Essential programs and files")
     (longdesc . "These files are regarded as basic...")
     (depend "amsfonts" "hyph-utf8" "hyphen-base" "texlive-common"
             "texlive.infra" "tlshell"))
    ("collection-texworks"
     (name . "collection-texworks")
     (shortdesc . "TeXworks editor...")
     (longdesc . "See http...")
     (depend "texworks" "collection-basic"))
    ("cyrillic-bin"
     (name . "cyrillic-bin")
     (shortdesc . "Cyrillic bibtex and makeindex")
     (depend "cyrillic-bin.ARCH")
     (docfiles
      "texmf-dist/doc/man/man1/rubibtex.1"
      "texmf-dist/doc/man/man1/rubibtex.man1.pdf")
     (runfiles
      "texmf-dist/scripts/texlive-extra/rumakeindex.sh"
      "texmf-dist/scripts/texlive-extra/rubibtex.sh"))
    ("cyrillic-bin.x86_64-linux"
     (name . "cyrillic-bin.x86_64-linux")
     (shortdesc . "x86_64-linux files of cyrillic-bin")
     (binfiles
      "bin/x86_64-linux/rubibtex"
      "bin/x86_64-linux/rumakeindex"))
    ("example"
     . ((name . "example")
        (shortdesc . "Typeset examples...")
        (longdesc . "The package makes it easier...")
        (runfiles
         .
         ("texmf-dist/tex/latex/example/example.sty"))
        (catalogue-license . "gpl")))
    ("lollipop"
     (name . "lollipop")
     (shortdesc . "TeX made easy")
     (longdesc . "Lollipop is TeX made easy...")
     (execute "AddFormat name=lollipop engine=tex options=\"lollipop.ini\"...")
     (docfiles
      "texmf-dist/doc/otherformats/lollipop/README"
      "texmf-dist/doc/otherformats/lollipop/manual/address.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/appendix.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/btxmac.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/comm.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/comment.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/example.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/extern.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/head.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/list.tex"
      "texmf-dist/doc/otherformats/lollipop/manual/lollipop-manual.bib"
      "texmf-dist/doc/otherformats/lollipop/manual/lollipop-manual.pdf")
     (runfiles
      "texmf-dist/tex/lollipop/lollipop-define.tex"
      "texmf-dist/tex/lollipop/lollipop-document.tex"
      "texmf-dist/tex/lollipop/lollipop-float.tex"
      "texmf-dist/tex/lollipop/lollipop-fontdefs.tex"
      "texmf-dist/tex/lollipop/lollipop-fonts.tex"
      "texmf-dist/tex/lollipop/lollipop-heading.tex"
      "texmf-dist/tex/lollipop/lollipop-lists.tex"
      "texmf-dist/tex/lollipop/lollipop-output.tex"
      "texmf-dist/tex/lollipop/lollipop-plain.tex"
      "texmf-dist/tex/lollipop/lollipop-text.tex"
      "texmf-dist/tex/lollipop/lollipop-tools.tex"
      "texmf-dist/tex/lollipop/lollipop.ini"
      "texmf-dist/tex/lollipop/lollipop.tex")
     (catalogue-license . "gpl3"))
    ("pax"
     (name . "pax")
     (shortdesc . "Extract and reinsert PDF...")
     (longdesc . "If PDF files are...")
     (depend "pax.ARCH")
     (docfiles
      "texmf-dist/doc/latex/pax/README")
     (srcfiles
      "texmf-dist/source/latex/pax/Makefile"
      "texmf-dist/source/latex/pax/build.xml")
     (runfiles
      "texmf-dist/scripts/pax/pdfannotextractor.pl")
     (catalogue-license . "lppl gpl"))
    ("pax.x86_64-linux"
     (name . "pax.x86_64-linux")
     (shortdesc . "x86_64-linux files of pax")
     (binfiles
      "bin/x86_64-linux/pdfannotextractor"))
    ("stricttex"
     . ((name
         . "stricttex")
        (shortdesc
         . "Strictly balanced brackets and numbers in command names")
        (longdesc
         . "This is a small, LuaLaTeX-only package providing you with three,
sometimes useful features: It allows you to make brackets [...]  \"strict\",
meaning that each [ must be balanced by a ]. It allows you to use numbers in
command names, so that you can do stuff like \\newcommand\\pi12{\\pi_{12}}. It
allows you to use numbers and primes in command names, so that you can do
stuff like \\newcommand\\pi'12{\\pi '_{12}}.")
        (docfiles
         . ("texmf-dist/doc/lualatex/stricttex/README.md"
            "texmf-dist/doc/lualatex/stricttex/stricttex.pdf"))
        (runfiles
         . ("texmf-dist/tex/lualatex/stricttex/stricttex.lua"
            "texmf-dist/tex/lualatex/stricttex/stricttex.sty"))
        (catalogue-license . "lppl1.3c")))
    ("tex"
     (name . "tex")
     (shortdesc . "A sophisticated typesetting engine")
     (longdesc . "TeX is a typesetting system that incorporates...")
     (depend "cm" "hyphen-base" "tex.ARCH")
     (docfiles "texmf-dist/doc/man/man1/tex.1")
     (catalogue-license . "knuth"))
    ("texsis"
     . ((name
         . "texsis")
        (shortdesc
         . "Plain TeX macros for Physicists")
        (longdesc
         . "TeXsis is a TeX macro package which provides useful features for
typesetting research papers and related documents. For example, it includes
support specifically for: Automatic numbering of equations, figures, tables
and references; Simplified control of type sizes, line spacing, footnotes,
running headlines and footlines, and tables of contents, figures and tables;
Specialized document formats for research papers, preprints and \"e-prints\",
conference proceedings, theses, books, referee reports, letters, and
memoranda; Simplified means of constructing an index for a book or thesis;
Easy to use double column formatting; Specialized environments for lists,
theorems and proofs, centered or non-justified text, and listing computer
code; Specialized macros for easily constructing ruled tables. TeXsis was
originally developed for physicists, but others may also find it useful. It is
completely compatible with Plain TeX.")
        (depend . ("tex" "plain" "knuth-lib" "hyphen-base" "cm"))
        (docfiles
         . ("texmf-dist/doc/man/man1/texsis.1"
            "texmf-dist/doc/man/man1/texsis.man1.pdf"
            "texmf-dist/doc/otherformats/texsis/base/COPYING"
            "texmf-dist/doc/otherformats/texsis/base/Example.tex"
            "texmf-dist/doc/otherformats/texsis/base/Fonts.tex"
            "texmf-dist/doc/otherformats/texsis/base/INSTALL"
            "texmf-dist/doc/otherformats/texsis/base/Install.tex"
            "texmf-dist/doc/otherformats/texsis/base/MANIFEST"
            "texmf-dist/doc/otherformats/texsis/base/Manual.fgl"
            "texmf-dist/doc/otherformats/texsis/base/Manual.ref"
            "texmf-dist/doc/otherformats/texsis/base/Manual.tbl"
            "texmf-dist/doc/otherformats/texsis/base/Manual.tex"
            "texmf-dist/doc/otherformats/texsis/base/NEWS"
            "texmf-dist/doc/otherformats/texsis/base/README"
            "texmf-dist/doc/otherformats/texsis/base/TXSapxF.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXScover.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSdcol.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSdoc.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSdoc0.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSdocM.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSend.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSenvmt.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSeqns.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSfigs.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSfmts.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSfonts.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSinstl.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSintro.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSletr.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSmisc.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSprns.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSrefs.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSrevs.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSruled.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSsects.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXSsite.000"
            "texmf-dist/doc/otherformats/texsis/base/TXSsymb.doc"
            "texmf-dist/doc/otherformats/texsis/base/TXStags.doc"
            "texmf-dist/doc/otherformats/texsis/base/index.tex"
            "texmf-dist/doc/otherformats/texsis/base/letr"
            "texmf-dist/doc/otherformats/texsis/base/penguin.eps"
            "texmf-dist/doc/otherformats/texsis/base/penguin2.eps"
            "texmf-dist/doc/otherformats/texsis/base/texsis.el"
            "texmf-dist/doc/otherformats/texsis/base/texsis.lsm"))
        (runfiles
         . ("texmf-dist/bibtex/bst/texsis/texsis.bst"
            "texmf-dist/tex/texsis/base/AIP.txs"
            "texmf-dist/tex/texsis/base/CVformat.txs"
            "texmf-dist/tex/texsis/base/Elsevier.txs"
            "texmf-dist/tex/texsis/base/Exam.txs"
            "texmf-dist/tex/texsis/base/Formletr.txs"
            "texmf-dist/tex/texsis/base/IEEE.txs"
            "texmf-dist/tex/texsis/base/PhysRev.txs"
            "texmf-dist/tex/texsis/base/Spanish.txs"
            "texmf-dist/tex/texsis/base/Swedish.txs"
            "texmf-dist/tex/texsis/base/TXSconts.tex"
            "texmf-dist/tex/texsis/base/TXSdcol.tex"
            "texmf-dist/tex/texsis/base/TXSenvmt.tex"
            "texmf-dist/tex/texsis/base/TXSeqns.tex"
            "texmf-dist/tex/texsis/base/TXSfigs.tex"
            "texmf-dist/tex/texsis/base/TXSfmts.tex"
            "texmf-dist/tex/texsis/base/TXSfonts.tex"
            "texmf-dist/tex/texsis/base/TXShead.tex"
            "texmf-dist/tex/texsis/base/TXSinit.tex"
            "texmf-dist/tex/texsis/base/TXSletr.tex"
            "texmf-dist/tex/texsis/base/TXSmacs.tex"
            "texmf-dist/tex/texsis/base/TXSmemo.tex"
            "texmf-dist/tex/texsis/base/TXSprns.tex"
            "texmf-dist/tex/texsis/base/TXSrefs.tex"
            "texmf-dist/tex/texsis/base/TXSruled.tex"
            "texmf-dist/tex/texsis/base/TXSsects.tex"
            "texmf-dist/tex/texsis/base/TXSsite.tex"
            "texmf-dist/tex/texsis/base/TXSsymb.tex"
            "texmf-dist/tex/texsis/base/TXStags.tex"
            "texmf-dist/tex/texsis/base/TXStitle.tex"
            "texmf-dist/tex/texsis/base/Tablebod.txs"
            "texmf-dist/tex/texsis/base/WorldSci.txs"
            "texmf-dist/tex/texsis/base/color.txs"
            "texmf-dist/tex/texsis/base/nuclproc.txs"
            "texmf-dist/tex/texsis/base/printfont.txs"
            "texmf-dist/tex/texsis/base/spine.txs"
            "texmf-dist/tex/texsis/base/texsis.tex"
            "texmf-dist/tex/texsis/base/thesis.txs"
            "texmf-dist/tex/texsis/base/twin.txs"
            "texmf-dist/tex/texsis/config/texsis.ini"))
        (catalogue-license . "lppl")))
    ("trsym"
     (name . "trsym")
     (shortdesc . "Symbols for transformations")
     (longdesc . "The bundle provides Metafont...")
     (docfiles "texmf-dist/doc/latex/trsym/README"
               "texmf-dist/doc/latex/trsym/manifest.txt"
               "texmf-dist/doc/latex/trsym/trsym.pdf")
     (srcfiles "texmf-dist/source/latex/trsym/trsym.dtx"
               "texmf-dist/source/latex/trsym/trsym.ins")
     (runfiles "texmf-dist/fonts/source/public/trsym/trsy.mf"
               "texmf-dist/fonts/source/public/trsym/trsy10.mf"
               "texmf-dist/fonts/source/public/trsym/trsy12.mf"
               "texmf-dist/fonts/tfm/public/trsym/trsy10.tfm"
               "texmf-dist/fonts/tfm/public/trsym/trsy12.tfm"
               "texmf-dist/tex/latex/trsym/trsym.sty"
               "texmf-dist/tex/latex/trsym/utrsy.fd")
     (catalogue-license . "lppl"))))

(test-assert "texlive->guix-package, no docfiles"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "example"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-example")
               ('version _)
               ('source ('texlive-origin
                         'name 'version
                         ('list "tex/latex/example/")
                         ('base32 (? string? hash))))
               ('build-system 'texlive-build-system)
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "texsis"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-texsis")
               ('version _)
               ('source ('texlive-origin
                         'name 'version
                         ('list "bibtex/bst/texsis/"
                                "doc/man/man1/texsis.1"
                                "doc/man/man1/texsis.man1.pdf"
                                "doc/otherformats/texsis/base/"
                                "tex/texsis/base/"
                                "tex/texsis/config/")
                         ('base32 (? string? hash))))
               ('outputs ''("out" "doc"))
               ('build-system 'texlive-build-system)
               ('propagated-inputs
                ('list 'texlive-cm
                       'texlive-hyphen-base
                       'texlive-knuth-lib
                       'texlive-plain
                       'texlive-tex))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license 'lppl))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, with METAFONT files"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "trsym"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name _)
               ('version _)
               ('source _)
               ('outputs _)
               ('build-system _)
               ('native-inputs
                ('list 'texlive-metafont))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, with catalogue entry, no inputs"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "12many"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-12many")
               ('version _)
               ('source ('texlive-origin
                         'name 'version
                         ('list "doc/latex/12many/"
                                "source/latex/12many/"
                                "tex/latex/12many/")
                         ('base32 (? string? hash))))
               ('outputs ''("out" "doc"))
               ('build-system 'texlive-build-system)
               ('home-page "https://ctan.org/pkg/one2many")
               ('synopsis (? string?))
               ('description (? string?))
               ('license 'lppl))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, multiple licenses"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "chs-physics-report"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-chs-physics-report")
               ('version _)
               ('source ('texlive-origin
                         'name 'version
                         ('list "doc/latex/chs-physics-report/"
                                "tex/latex/chs-physics-report/")
                         ('base32 (? string? hash))))
               ('outputs ''("out" "doc"))
               ('build-system 'texlive-build-system)
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license ('list 'public-domain 'cc-by-sa3.0)))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, meta-package"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "collection-texworks"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-collection-texworks")
               ('version _)
               ('source #f)
               ('build-system 'trivial-build-system)
               ('arguments
                ('list '#:builder ('gexp ('mkdir ('ungexp 'output)))))
               ('propagated-inputs
                ('list 'texlive-collection-basic))
               ('home-page "https://www.tug.org/texlive/")
               ('synopsis (? string?))
               ('description (? string?))
               ('license
                ('fsf-free "https://www.tug.org/texlive/copying.html")))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, with TeX format"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "lollipop"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-lollipop")
               ('version _)
               ('source ('texlive-origin
                         'name 'version
                         ('list "doc/otherformats/lollipop/"
                                "tex/lollipop/")
                         ('base32 (? string? hash))))
               ('outputs ''("out" "doc"))
               ('build-system 'texlive-build-system)
               ('arguments ('list '#:create-formats ('gexp ('list "lollipop"))))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license 'gpl3))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, execute but no TeX format"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "adforn"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-adforn")
               ('version _)
               ('source _)
               ('outputs ''("out" "doc"))
               ('build-system 'texlive-build-system)
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, translate dependencies"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "collection-basic"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-collection-basic")
               ('version _)
               ('source _)
               ('build-system 'trivial-build-system)
               ('arguments
                ('list '#:builder ('gexp ('mkdir ('ungexp 'output)))))
               ('propagated-inputs
                ('list 'texlive-amsfonts 'texlive-hyphen-complete))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, lonely `hyphen-base' dependency and ARCH"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "tex"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-tex")
               ('version _)
               ('source _)
               ('outputs _)
               ('build-system 'texlive-build-system)
               ('arguments ('list '#:texlive-latex-bin? #f))
               ('propagated-inputs
                ('list 'texlive-cm 'texlive-hyphen-base))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, single script, no extension"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "authorindex"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-authorindex")
               ('version _)
               ('source _)
               ('outputs _)
               ('build-system 'texlive-build-system)
               ('arguments
                ('list '#:link-scripts ('gexp ('list "authorindex"))))
               ('home-page (? string?))
               ('synopsis (? string?))
               ('description (? string?))
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, multiple scripts, with extensions"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "cyrillic-bin"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-cyrillic-bin")
               ('version _)
               ('source _)
               ('outputs _)
               ('build-system 'texlive-build-system)
               ('arguments
                ('list '#:link-scripts
                       ('gexp ('list "rubibtex.sh" "rumakeindex.sh"))))
               ('home-page _)
               ('synopsis _)
               ('description _)
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-assert "texlive->guix-package, script with associated input"
  ;; Replace network resources with sample data.
  (mock ((guix build svn) svn-fetch
         (lambda* (url revision directory
                       #:key (svn-command "svn")
                       (user-name #f)
                       (password #f)
                       (recursive? #t))
           (mkdir-p directory)
           (with-output-to-file (string-append directory "/foo")
             (lambda ()
               (display "source")))))
        (let ((result (texlive->guix-package "pax"
                                             #:package-database
                                             (lambda _ %fake-tlpdb))))
          (match result
            (('package
               ('name "texlive-pax")
               ('version _)
               ('source _)
               ('outputs _)
               ('build-system 'texlive-build-system)
               ('arguments
                ('list '#:link-scripts ('gexp ('list "pdfannotextractor.pl"))))
               ('inputs
                ('list 'perl))
               ('home-page _)
               ('synopsis _)
               ('description _)
               ('license _))
             #true)
            (_
             (begin
               (format #t "~s~%" result)
               (pk 'fail result #f)))))))

(test-end "texlive")
(match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs ghc-8.4)))) (arguments (substitute-keyword-arguments (package-arguments ghc-8.4) ((#:make-flags make-flags ''()) #~(cons "EXTRA_RUNTEST_OPTS=--skip-perf-tests" #$make-flags)) ((#:phases phases '%standard-phases) #~(modify-phases #$phases (add-after 'install 'remove-unnecessary-references (lambda* (#:key outputs #:allow-other-keys) (substitute* (find-files (string-append (assoc-ref outputs "out") "/lib/") "settings") (("/gnu/store/.*/bin/(.*)" m program) program)) ;; Remove references to "doc" output from "out" by rewriting ;; the "haddock-interfaces" fields and removing the optional ;; "haddock-html" field in the generated .conf files. (let ((doc (assoc-ref outputs "doc")) (out (assoc-ref outputs "out"))) (with-fluids ((%default-port-encoding #f)) (for-each (lambda (config-file) (substitute* config-file (("^haddock-html: .*") "\n") (((format #f "^haddock-interfaces: ~a" doc)) (string-append "haddock-interfaces: " out)))) (find-files (string-append out "/lib") ".conf"))) ;; Move the referenced files to the "out" output. (for-each (lambda (haddock-file) (let* ((subdir (string-drop haddock-file (string-length doc))) (new (string-append out subdir))) (mkdir-p (dirname new)) (rename-file haddock-file new))) (find-files doc "\\.haddock$"))))) (add-after 'unpack-testsuite 'skip-tests (lambda _ ;; These two tests refer to the root user, which doesn't exist ;; (see <https://bugs.gnu.org/36692>). (substitute* "libraries/unix/tests/all.T" (("^test\\('T8108'") "# guix skipped: test('T8108'")) (substitute* "libraries/unix/tests/libposix/all.T" (("^test\\('posix010'") "# guix skipped: test('posix010'")))))))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory)))))) (define-public ghc-8.8 (package (inherit ghc-8.6) (name "ghc") (version "8.8.4") (source (origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-src.tar.xz")) (sha256 (base32 "0bgwbxxvdn56l91bp9p5d083gzcfdi6z8l8b17qzjpr3n8w5wl7h")))) (native-inputs `(("ghc-bootstrap" ,ghc-8.6) ("ghc-testsuite" ,(origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-testsuite.tar.xz")) (patches (search-patches "ghc-testsuite-dlopen-pie.patch" "ghc-testsuite-grep-compat.patch" "ghc-testsuite-recomp015-execstack.patch")) (sha256 (base32 "0c55pj2820q26rikhpf636sn4mjgqsxjrl94vsywrh79dxp3k14z")) (modules '((guix build utils))) (snippet ;; collections.Iterable was moved to collections.abc in Python 3.10. '(substitute* "testsuite/driver/testlib.py" (("collections\\.Iterable") "collections.abc.Iterable"))))) ("git" ,git-minimal/pinned) ; invoked during tests ,@(filter (match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs ghc-8.6)))) (arguments (substitute-keyword-arguments (package-arguments ghc-8.6) ((#:phases phases '%standard-phases) #~(modify-phases #$phases (add-before 'build 'fix-cc-reference (lambda _ (substitute* "utils/hsc2hs/Common.hs" (("\"cc\"") "\"gcc\"")))) (add-after 'unpack-testsuite 'skip-more-tests (lambda _ ;; XXX: This test fails because our ld-wrapper script ;; mangles the response file passed to the linker. (substitute* "testsuite/tests/hp2ps/all.T" (("^test\\('T15904'") "# guix skipped: test('T15904'")))))))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory)))))) (define-public ghc-8.10 (package (inherit ghc-8.8) (name "ghc") (version "8.10.7") (source (origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-src.tar.xz")) (sha256 (base32 "179ws2q0dinl1a39wm9j37xzwm84zfz3c5543vz8v479khigdvp3")))) (native-inputs `(;; GHC 8.10.7 must be built with GHC >= 8.6. ("ghc-bootstrap" ,ghc-8.6) ("ghc-testsuite" ,(origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-testsuite.tar.xz")) (patches (search-patches "ghc-testsuite-dlopen-pie.patch" "ghc-testsuite-grep-compat.patch" "ghc-testsuite-recomp015-execstack.patch")) (sha256 (base32 "1zl25gg6bpx5601k8h3cqnns1xfc0nqgwnh8jvn2s65ra3f2g1nz")) (modules '((guix build utils))) (snippet ;; collections.Iterable was moved to collections.abc in Python 3.10. '(substitute* "testsuite/driver/testlib.py" (("collections\\.Iterable") "collections.abc.Iterable"))))) ("git" ,git-minimal/pinned) ; invoked during tests ,@(filter (match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs ghc-8.8)))) (arguments (substitute-keyword-arguments (package-arguments ghc-8.8) ((#:phases phases '%standard-phases) #~(modify-phases #$phases (add-after 'unpack-testsuite 'patch-more-shebangs (lambda* (#:key inputs #:allow-other-keys) (let ((bash (assoc-ref inputs "bash"))) (substitute* '("testsuite/tests/driver/T8602/T8602.script") (("/bin/sh") (string-append bash "/bin/sh")))))) ;; Mark failing tests as broken. Reason for failure is unknown. (add-after 'skip-more-tests 'skip-even-more-tests (lambda _ (substitute* '("testsuite/tests/driver/T16521/all.T") (("extra_files" all) (string-append "[" all)) (("\\]\\), " all) (string-append all "expect_broken(0)], "))))) (add-after 'skip-more-tests 'skip-failing-tests-i686 (lambda _ (substitute* '("testsuite/tests/codeGen/should_compile/all.T") (("(test\\('T15155l', )when\\(unregisterised\\(\\), skip\\)" all before) (string-append before "when(arch('i386'), skip)"))) ;; Unexpected failures: ;; quasiquotation/T14028.run T14028 [bad stderr] (dyn) (substitute* '("testsuite/tests/quasiquotation/all.T") (("unless\\(config.have_ext_interp, skip\\),") "unless(config.have_ext_interp, skip), when(arch('i386'), skip),")))) ;; i686 fails on CI, but (sometimes and with generous timeouts) completes ;; locally. The issue seems to be that the testsuite tries to run some very ;; broad regular expressions on output files of several megabytes in size, ;; which takes a long time. Since the expressions never match anything on ;; our builds anyways, remove them. ;; TODO: Merge with 'skip-failing-tests-i686 or move into snippets on ;; next rebuild. Note that they are required for GHC 8.10 and 9.2. #$@(if (string-prefix? "i686" (or (%current-target-system) (%current-system))) #~((add-after 'skip-failing-tests-i686 'skip-more-failing-tests-i686 (lambda _ (substitute* '("testsuite/tests/profiling/should_run/all.T") (("test\\('T11627a', \\[ ") "test('T11627a', [ when(arch('i386'), skip), ")) (substitute* '("testsuite/driver/testlib.py") ((".*changes being made to the file will invalidate the code signature.*") "") ((".*warning: argument unused during compilation:.*") ""))))) #~()))))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory)))))) (define-public ghc-8 ghc-8.10) (define-public ghc-9.0 (package (inherit ghc-8.10) (name "ghc") (version "9.0.2") (source (origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-src.tar.xz")) (sha256 (base32 "15wii8can2r3dcl6jjmd50h2jvn7rlmn05zb74d2scj6cfwl43hl")) (patches (search-patches "ghc-9-StgCRunAsm-only-when-needed.patch")))) (native-inputs `(;; GHC 9.0.2 must be built with GHC >= 8.8 ("ghc-bootstrap" ,ghc-8.10) ("ghc-testsuite" ,(origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-testsuite.tar.xz")) (sha256 (base32 "1m5fzhr4gjn9ni8gxx7ag3fkbw1rspjzgv39mnfb0nkm5mw70v3s")) (patches (search-patches "ghc-9.2-grep-warnings.patch" "ghc-testsuite-recomp015-execstack.patch")) (modules '((guix build utils))) (snippet ;; collections.Iterable was moved to collections.abc in Python 3.10. '(substitute* "testsuite/driver/testlib.py" (("collections\\.Iterable") "collections.abc.Iterable"))))) ,@(filter (match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs ghc-8.10)))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory)))))) (define-public ghc-9.2 ;; Use 8.10 to shorten the build chain. (let ((base ghc-8.10)) (package (inherit base) (name "ghc") (version "9.2.8") (source (origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-src.tar.xz")) (sha256 (base32 "18b7ln4gx2vy62jpv3z5slv3zfxmxnmkgajznks15zglddwd24sz")) (patches (search-patches "ghc-9.2-cabal-support-package-path.patch" "ghc-9-StgCRunAsm-only-when-needed.patch")))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:phases phases '%standard-phases) #~(modify-phases #$phases ;; File Common.hs has been moved to src/ in this release. (replace 'fix-cc-reference (lambda _ (substitute* "utils/hsc2hs/src/Common.hs" (("\"cc\"") "\"gcc\"")))) (add-after 'skip-more-tests 'skip-T21694-i686 (lambda _ (substitute* '("testsuite/tests/simplCore/should_compile/all.T") (("^test\\('T21694', \\[ " all) (string-append all "when(arch('i386'), skip), "))))))) ;; Increase verbosity, so running the test suite does not time out on CI. ((#:make-flags make-flags ''()) #~(cons "VERBOSE=4" #$make-flags)))) (properties '((max-silent-time . 36000))) ; 10 hours, for i686. (native-inputs `(;; GHC 9.2 must be built with GHC >= 8.6. ("ghc-bootstrap" ,base) ("ghc-testsuite" ,(origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-testsuite.tar.xz")) (sha256 (base32 "0cmmwhcwv9fjzvmgjj85d354858qqbmqfzaz5160xqj4yl9zk225")) (patches (search-patches "ghc-9.2-grep-warnings.patch" "ghc-testsuite-recomp015-execstack.patch")))) ,@(filter (match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs base)))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory))))))) ;; Versions newer than ghc defined below (i.e. the compiler ;; haskell-build-system uses) should use ghc-next as their name to ;; ensure ghc (without version specification) and ghc-* packages are ;; always compatible. See https://issues.guix.gnu.org/issue/47335. (define-public ghc ghc-9.2) ;; 9.4 is the last version to support the make-based build system, ;; but it boot with 9.2, only 9.0 is supported. (define ghc-bootstrap-for-9.4 ghc-9.0) ;; We need two extra dependencies built with ghc-bootstrap-for-9.4, ;; which are duplicated here from haskell-xyz to make sure the ;; bootstraping process always works. (define ghc-alex-bootstrap-for-9.4 (hidden-package (package (name "ghc-alex") (version "3.2.6") (source (origin (method url-fetch) (uri (hackage-uri "alex" version)) (sha256 (base32 "042lrkn0dbpjn5ivj6j26jzb1fwrj8c1aj18ykxja89isg0hiali")))) (build-system haskell-build-system) (arguments (list #:tests? #f #:haskell ghc-bootstrap-for-9.4)) (native-inputs (list which)) (home-page "https://www.haskell.org/alex/") (synopsis "Tool for generating lexical analysers in Haskell") (description "Alex is a tool for generating lexical analysers in Haskell. It takes a description of tokens based on regular expressions and generates a Haskell module containing code for scanning text efficiently. It is similar to the tool lex or flex for C/C++.") (license license:bsd-3)))) (define ghc-happy-bootstrap-for-9.4 (hidden-package (package (name "ghc-happy") (version "1.20.0") (source (origin (method url-fetch) (uri (hackage-uri "happy" version)) (sha256 (base32 "1346r2x5ravs5fqma65bzjragqbb2g6v41wz9maknwm2jf7kl79v")))) (build-system haskell-build-system) (arguments (list #:haskell ghc-bootstrap-for-9.4 #:tests? #f)) (home-page "https://hackage.haskell.org/package/happy") (synopsis "Parser generator for Haskell") (description "Happy is a parser generator for Haskell. Given a grammar specification in BNF, Happy generates Haskell code to parse the grammar. Happy works in a similar way to the yacc tool for C.") (license license:bsd-3)))) (define-public ghc-9.4 ;; Inherit from 9.2, which added a few fixes, but boot from 9.0 (see above). (let ((base ghc-9.2)) (package (inherit base) (name "ghc-next") (version "9.4.4") (source (origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-src.tar.xz")) (sha256 (base32 "1qk7rlqf02s3b6m6sqqngmjq1mxnrz88h159lz6k25gddmdg5kp8")) (patches (search-patches "ghc-9-StgCRunAsm-only-when-needed.patch")))) (arguments (substitute-keyword-arguments (package-arguments base) ((#:phases phases '%standard-phases) #~(modify-phases #$phases ;; Files don’t exist any more. (delete 'skip-tests))))) (native-inputs `(;; GHC 9.4 must be built with GHC >= 9.0. ("ghc-bootstrap" ,ghc-bootstrap-for-9.4) ("ghc-testsuite" ,(origin (method url-fetch) (uri (string-append "https://www.haskell.org/ghc/dist/" version "/ghc-" version "-testsuite.tar.xz")) (sha256 (base32 "04p2lawxxg3nyv6frzhyjyh3arhqqyh5ka3alxa2pxhcd2hdcja3")) (patches (search-patches "ghc-testsuite-recomp015-execstack.patch")))) ("ghc-alex" ,ghc-alex-bootstrap-for-9.4) ("ghc-happy" ,ghc-happy-bootstrap-for-9.4) ,@(filter (match-lambda (("ghc-bootstrap" . _) #f) (("ghc-testsuite" . _) #f) (_ #t)) (package-native-inputs base)))) (native-search-paths (list (search-path-specification (variable "GHC_PACKAGE_PATH") (files (list (string-append "lib/ghc-" version))) (file-pattern ".*\\.conf\\.d$") (file-type 'directory))))))) ;;; haskell.scm ends here