File: graphviz.spec.fedora.in

package info (click to toggle)
graphviz 14.0.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 139,388 kB
  • sloc: ansic: 141,938; cpp: 11,957; python: 7,766; makefile: 4,043; yacc: 3,030; xml: 2,972; tcl: 2,495; sh: 1,388; objc: 1,159; java: 560; lex: 423; perl: 243; awk: 156; pascal: 139; php: 58; ruby: 49; cs: 31; sed: 1
file content (975 lines) | stat: -rw-r--r-- 26,965 bytes parent folder | download | duplicates (2)
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
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
# @configure_input@

#-- Global graphviz rpm and src.rpm tags-------------------------------------
Name:    graphviz
Summary: Graph Visualization Tools
Version: @VERSION@
Release: 1%{?dist}
Group:   Applications/Multimedia
License: EPL
URL:     https://graphviz.org/
Source0: https://gitlab.com/graphviz/graphviz/-/archive/@VERSION@/graphviz-@VERSION@.tar.gz

# Necessary conditionals
%ifarch %{mono_arches}
%global SHARP      1
%else
%global SHARP      0
%endif

# Assuming Fedora
%global LICENSE    1
%global ANN        1
%global ARRRR      1
%global DEEEE      0
%global DEVIL      1
%global GOLANG     1
%global GTS        1
%global GTK        1
%global JAVASCRIPT 0
%global LASI       1
%global PHP        1
%global WEBP       1

# Overrides for RHEL
%if 0%{?rhel}
%global LICENSE    0
%global ARRRR      0
%global DEEEE      0
%global DEVIL      0
%global GOLANG     0
%global GTS        0
%global GTK        0
%global JAVASCRIPT 0
%global LASI       0
%global SHARP      0
%global WEBP       0
%endif

# Overrides for Rocky
%if 0%{?rhel}
%global ANN        0
%endif

# Plugins version
%global pluginsver 8

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires: java-devel
BuildRequires: zlib-devel expat-devel bison m4 flex swig gcc-c++
BuildRequires: libX11-devel gtk2-devel freeglut-devel
BuildRequires: freetype-devel fontconfig-devel cairo-devel pango-devel
BuildRequires: gmp-devel gd gd-devel librsvg2-devel
BuildRequires: ghostscript ghostscript-devel poppler-glib-devel libtool-ltdl libtool-ltdl-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: ruby ruby-devel lua-devel
BuildRequires: perl-devel perl-libs tcl tcl-devel tk tk-devel
BuildRequires: python3 python3-devel

%if %{ANN}
BuildRequires: ann-devel
%endif
%if %{ARRRR}
BuildRequires: R-devel
%endif
%if %{DEEEE}
BuildRequires: ldc-druntime-devel
%endif
%if %{DEVIL}
BuildRequires: DevIL-devel
%endif
%if %{GOLANG}
BuildRequires: golang gcc-go swig >= 3.0.2
%endif
%if %{GTK}
BuildRequires: libglade2-devel gtkglext-devel
%endif
%if %{GTS}
BuildRequires: gts-devel
%endif
%if 0%{?fedora} > 0 || 0%{?rhel} >= 9
BuildRequires: guile30-devel
%else
BuildRequires: guile-devel
%endif
%if %{LASI}
BuildRequires: lasi-devel
%endif
%if %{PHP}
BuildRequires: php-devel
%endif
%if %{SHARP}
BuildRequires: mono-core
%endif
%if %{WEBP}
BuildRequires: libwebp-devel
%endif

%if %{PHP}
# What a meal PHP makes of versioning !!!
%define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
%global php_apiver %((echo 0; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)

%global ini_name     40-%{name}.ini

# Fix private-shared-object-provides
# RPM 4.8
%{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$}
%{?filter_setup}
# RPM 4.9
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$
%endif

#-- main graphviz rpm ------------------------------------------------
Requires:         %{name}-nox = %{version}-%{release}
Requires:         %{name}-x = %{version}-%{release}

%description
A collection of tools for the manipulation and layout
of graphs (as in nodes and edges, not as in bar-charts).

%files
%defattr(-,root,root,-)
%if %{LICENSE}
%license COPYING
%endif
%doc COPYING AUTHORS CHANGELOG.md NEWS README.md

#-- graphviz-nox rpm --------------------------------------------------
%package nox
Group:            Applications/Multimedia
Summary:          Graphviz commands with no X11 dependencies
Requires:         urw-fonts
Requires:         %{name}-libs = %{version}-%{release}
Requires:         %{name}-plugins-core = %{version}-%{release}
Provides:         %{name}-nox = %{version}-%{release}

%description nox
Graphviz plugins and commands that do not depend on x11. 
When used alone, this is intended for minimalist web-server apps
with no X11 on the server.

# completely remove any old configs before any fresh install of dot.
# don't remove any externally provided plugins. "doc -c" should refind them
%pre nox
rm -rf %{_libdir}/graphviz/config* || :

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config%{pluginsver}
%post nox
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%files nox
%defattr(-,root,root,-)
%if %{LICENSE}
%license COPYING
%endif
%doc COPYING AUTHORS CHANGELOG.md NEWS README.md
%{_bindir}/dot_builtins
%{_bindir}/dot_sandbox
%{_bindir}/acyclic
%{_bindir}/bcomps
%{_bindir}/ccomps
%{_bindir}/circo
%{_bindir}/cluster
%{_bindir}/dijkstra
%{_bindir}/dot
%{_bindir}/dot2gxl
%{_bindir}/fdp
%{_bindir}/gc
%{_bindir}/gml2gv
%{_bindir}/graphml2gv
%{_bindir}/gv2gml
%{_bindir}/gv2gxl
%{_bindir}/gvcolor
%{_bindir}/gvgen
%{_bindir}/gvmap
%{_bindir}/gvmap.sh
%{_bindir}/gvpack
%{_bindir}/gvpr
%{_bindir}/gxl2dot
%{_bindir}/gxl2gv
%if %{ANN}
%{_bindir}/mingle
%endif
%{_bindir}/edgepaint
%{_bindir}/mm2gv
%{_bindir}/neato
%{_bindir}/nop
%{_bindir}/osage
%{_bindir}/patchwork
%{_bindir}/prune
%{_bindir}/sccmap
%{_bindir}/sfdp
%{_bindir}/tred
%{_bindir}/twopi
%{_bindir}/unflatten
%{_mandir}/man1/acyclic.1*
%{_mandir}/man1/bcomps.1*
%{_mandir}/man1/ccomps.1*
%{_mandir}/man1/circo.1*
%{_mandir}/man1/cluster.1*
%{_mandir}/man1/dijkstra.1*
%{_mandir}/man1/dot.1*
%{_mandir}/man1/dot_sandbox.1*
%{_mandir}/man1/dot2gxl.1*
%{_mandir}/man1/fdp.1*
%{_mandir}/man1/gc.1*
%{_mandir}/man1/gml2gv.1*
%{_mandir}/man1/graphml2gv.1*
%{_mandir}/man1/gv2gml.1*
%{_mandir}/man1/gv2gxl.1*
%{_mandir}/man1/gvcolor.1*
%{_mandir}/man1/gvgen.1*
%{_mandir}/man1/gvmap.1*
%{_mandir}/man1/gvmap.sh.1*
%{_mandir}/man1/gvpack.1*
%{_mandir}/man1/gvpr.1*
%{_mandir}/man1/gxl2dot.1*
%{_mandir}/man1/gxl2gv.1*
%if %{ANN}
%{_mandir}/man1/mingle.1*
%endif
%{_mandir}/man1/edgepaint.1*
%{_mandir}/man1/mm2gv.1*
%{_mandir}/man1/neato.1*
%{_mandir}/man1/nop.1*
%{_mandir}/man1/osage.1*
%{_mandir}/man1/patchwork.1*
%{_mandir}/man1/prune.1*
%{_mandir}/man1/sccmap.1*
%{_mandir}/man1/sfdp.1*
%{_mandir}/man1/tred.1*
%{_mandir}/man1/twopi.1*
%{_mandir}/man1/unflatten.1*
%{_mandir}/man7/graphviz.7*
%dir %{_datadir}/graphviz
%{_datadir}/graphviz/gvpr/*

#-- graphviz-libs rpm --------------------------------------------------
%package libs
Group:            Applications/Multimedia
Summary:          Graphviz base libs
Requires(post):   /sbin/ldconfig
Requires(postun): /sbin/ldconfig

%description libs
Graphviz core libs 

%post libs
/sbin/ldconfig

%postun libs
/sbin/ldconfig

%files libs
%defattr(-,root,root,-)
%{_libdir}/libcdt.so.*
%{_libdir}/libcgraph.so.*
%{_libdir}/libgvc.so.*
%{_libdir}/libgvpr.so.*
%{_libdir}/libpathplan.so.*
%{_libdir}/libxdot.so.4*
%exclude %{_libdir}/graphviz/*

#-- graphviz-plugins-core rpm --------------------------------------------------
%package plugins-core
Group:            Applications/Multimedia
Summary:          Graphviz plugins - core layout engines and text renderers
Requires:         %{name}-nox = %{version}-%{release}

%description plugins-core
Graphviz plugins - core layout engines and text renderers

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
# this one is conditional because of rpm dependency ordering
# on a fresh install this package is installed before dot is avaiable from graphviz-nox
# no matter since dot -c is also run from the graphviz-nox install
%post plugins-core
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

# if there is no dot after everything else is done, then remove config
%postun plugins-core
if [ $1 -eq 0 ]; then
        rm -f %{_libdir}/graphviz/config%{pluginsver} || :
fi

%files plugins-core
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_core.so.*
%{_libdir}/graphviz/libgvplugin_dot_layout.so.*
%{_libdir}/graphviz/libgvplugin_neato_layout.so.*

#-- graphviz-x rpm --------------------------------------------------
%package x
Group:            Applications/Multimedia
Summary:          Graphviz commands with X11 dependencies
Requires:         %{name}-nox = %{version}-%{release}
Requires:         %{name}-plugins-x = %{version}-%{release}

%description x
Graphviz commands with X11 dependencies

%files x
%defattr(-,root,root,-)
%if %{LICENSE}
%license COPYING
%endif
%doc COPYING AUTHORS CHANGELOG.md NEWS README.md
%{_bindir}/vimdot
%{_mandir}/man1/vimdot.1*
%if %{GTK}
%{_bindir}/smyrna
%{_datadir}/graphviz/smyrna
%{_mandir}/man1/smyrna.1*
%endif

#-- graphviz-plugins-x rpm --------------------------------------------------
%package plugins-x
Group:            Applications/Multimedia
Summary:          Graphviz plugins with X11 dependencies
Requires:         %{name} = %{version}-%{release}

%description plugins-x
Graphviz plugins that depend on x11 - most installations will want this.

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-x
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-x
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-x
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_xlib.so.*
%{_libdir}/graphviz/libgvplugin_pango.so.*
%{_libdir}/graphviz/libgvplugin_rsvg.so.*
%{_libdir}/graphviz/libgvplugin_gdk.so.*
%{_libdir}/graphviz/libgvplugin_gs.so.*
%{_libdir}/graphviz/libgvplugin_poppler.so.*
%if %{LASI}
%{_libdir}/graphviz/libgvplugin_lasi.so.*
%endif

#-- graphviz-gd rpm --------------------------------------------------
%package gd
Group:            Applications/Multimedia
Summary:          Graphviz binaries that depend on libgd
Requires:         %{name} = %{version}-%{release}

# this next Requires is not strictly neccessary for diffimg,
#   but users will probably expect the plugins to get pulled in
Requires:         %{name}-plugins-gd = %{version}-%{release} 

%description gd
Graphviz binaries that depend on gd.  (Unless you absolutely have
to use GIF, you are recommended to use the PNG format instead because
of the better quality anti-aliased lines provided by the cairo+pango
based renderer.)

%files gd
%defattr(-,root,root,-)
%{_bindir}/diffimg
%{_mandir}/man1/diffimg.1*

#-- graphviz-plugins-gd rpm --------------------------------------------------
%package plugins-gd
Group:            Applications/Multimedia
Summary:          Graphviz plugin for gd renderers
Requires:         %{name} = %{version}-%{release}

%description plugins-gd
Graphviz plugin for image rendering using libgd.  (Unless you absolutely have
to use GIF, you are recommended to use the PNG format instead because
of the better quality anti-aliased lines provided by the cairo+pango
based renderer.)

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-gd
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-gd
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-gd
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_gd.so.*

#-- graphviz-plugins-kitty rpm --------------------------------------------------
%package plugins-kitty
Group:            Applications/Multimedia
Summary:          Graphviz plugin for kitty format
Requires:         %{name}-x = %{version}-%{release}
Provides:         %{name}-kitty = %{version}-%{release}

%description plugins-kitty
Graphviz plugin for Kitty terminal rendering.

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-kitty
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-kitty
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-kitty
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_kitty.so.*

#-- graphviz-plugins-vt rpm --------------------------------------------------
%package plugins-vt
Group:            Applications/Multimedia
Summary:          Graphviz plugin for vt format
Requires:         %{name}-x = %{version}-%{release}
Obsoletes:        %{name}-vt <= 2.41
Provides:         %{name}-vt = %{version}-%{release}

%description plugins-vt
Graphviz plugin for vt terminal rendering.

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-vt
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-vt
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-vt
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_vt.so.*

#-- graphviz-plugins-webp rpm --------------------------------------------------
%if %{WEBP}
%package plugins-webp
Group:            Applications/Multimedia
Summary:          Graphviz plugin for webp format images, using libwebp
Requires:         %{name}-x = %{version}-%{release}
Obsoletes:        %{name}-webp <= 2.41
Provides:         %{name}-webp = %{version}-%{release}

%description plugins-webp
Graphviz plugin for webp image rendering. 

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-webp
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-webp
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-webp
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_webp.so.*
%endif

#-- graphviz-plugins-devil rpm --------------------------------------------------
%if %{DEVIL}
%package plugins-devil
Group:            Applications/Multimedia
Summary:          Graphviz plugin for renderers based on DevIL
Requires:         %{name}-x = %{version}-%{release}
Obsoletes:        %{name}-devil <= 2.41
Provides:         %{name}-devil = %{version}-%{release}

%description plugins-devil
Graphviz plugin for renderers based on DevIL.  (Unless you absolutely have
to use BMP, TIF, or TGA, you are recommended to use the PNG format instead
supported directly by the cairo+pango based renderer in the base graphviz rpm.)

# run "dot -c" to generate plugin config in {_libdir}/graphviz/config{pluginsver}
%post plugins-devil
LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c

%postun plugins-devil
[ -x %{_bindir}/dot ] && LD_LIBRARY_PATH=%{_libdir} %{_bindir}/dot -c || :

%files plugins-devil
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz
%{_libdir}/graphviz/libgvplugin_devil.so.*
%endif

#-- graphviz-qt rpm --------------------------------------------------
%package qt
Group:            Applications/Multimedia
Summary:          Graphviz applications using _QT
Requires:         %{name}-x = %{version}-%{release}

%description qt
Graphviz applications using _QT - currently just gvedit

%files qt
%defattr(-,root,root,-)
%{_bindir}/gvedit
%{_datadir}/graphviz/gvedit
%{_mandir}/man1/gvedit.1*

#-- graphviz-lang-sharp rpm --------------------------------------------
%if %{SHARP}
%package lang-sharp
Group:          Applications/Multimedia
Summary:        C# extension for graphviz
Requires:       %{name} = %{version}-%{release}, mono-core
Obsoletes:      %{name}-sharp <= 2.41
Provides:       %{name}-sharp = %{version}-%{release}

%description lang-sharp
C# extension for graphviz.

%files lang-sharp
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/sharp
%{_libdir}/graphviz/sharp/*
%{_mandir}/man3/*.3sharp.*
%endif

#-- graphviz-lang-d rpm ---------------------------------------------
%if 0%{?DEEEE}
%package lang-d
Group:          Applications/Multimedia
Summary:        D extension for graphviz
Requires:       %{name} = %{version}-%{release}, D
Obsoletes:      %{name}-d <= 2.41
Provides:       %{name}-d = %{version}-%{release}

%description lang-d
D extension for graphviz.

%files lang-d
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/d
%{_libdir}/graphviz/d/*
%{_mandir}/man3/*.3d.*
%endif

#-- graphviz-lang-go rpm --------------------------------------------
%if %{GOLANG}
%package lang-go
Group:          Applications/Multimedia
Summary:        GO extension for graphviz
Requires:       %{name} = %{version}-%{release}, golang
Obsoletes:      %{name}-go <= 2.41
Provides:       %{name}-go = %{version}-%{release}

%description lang-go
Guile extension for graphviz.

%files lang-go
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/go
%{_libdir}/graphviz/go/*
%{_mandir}/man3/*.3go.*
%endif

#-- graphviz-lang-guile rpm --------------------------------------------
%package lang-guile
Group:          Applications/Multimedia
Summary:        Guile extension for graphviz
%if 0%{?fedora} > 0 || 0%{?rhel} >= 9
Requires:       %{name} = %{version}-%{release}, guile30
%else
Requires:       %{name} = %{version}-%{release}, guile
%endif
Obsoletes:      %{name}-guile <= 2.41
Provides:       %{name}-guile = %{version}-%{release}

%description lang-guile
Guile extension for graphviz.

%files lang-guile
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/guile
%{_libdir}/graphviz/guile/*
%{_mandir}/man3/*.3guile.*

#-- graphviz-lang-java rpm ---------------------------------------------
%package lang-java
Group:          Applications/Multimedia
Summary:        Java extension for graphviz
Requires:       %{name} = %{version}-%{release}, java
Obsoletes:      %{name}-java <= 2.41
Provides:       %{name}-java = %{version}-%{release}

%description lang-java
Java extension for graphviz.

%files lang-java
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/java
%{_libdir}/graphviz/java/*
%{_mandir}/man3/*.3java.*

#-- graphviz-lang-javascript rpm ---------------------------------------------
%if 0%{?JAVASCRIPT}
%package lang-javascript
Group:          Applications/Multimedia
Summary:        Javascript extension for graphviz
Requires:       %{name} = %{version}-%{release}, javascript
Obsoletes:      %{name}-javascript <= 2.41
Provides:       %{name}-javascript = %{version}-%{release}

%description lang-javascript
Javascript extension for graphviz.

%files lang-javascript
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/javascript
%{_libdir}/graphviz/javascript/*
%{_mandir}/man3/*.3javascript.*
%endif

#-- graphviz-lang-lua rpm ----------------------------------------------
%package lang-lua
Group:          Applications/Multimedia
Summary:        Lua extension for graphviz
Requires:       %{name} = %{version}-%{release}, lua
Obsoletes:      %{name}-lua <= 2.41
Provides:       %{name}-lua = %{version}-%{release}

%description lang-lua
Lua extension for graphviz.

%files lang-lua
%defattr(-,root,root,-)
%{_libdir}/lua*/*
%{_datadir}/graphviz/demo/*.lua*
%{_mandir}/man3/*.3lua.*
%exclude %{_libdir}/graphviz/lua/*.so

#-- graphviz-lang-perl rpm ---------------------------------------------
%package lang-perl
Group:          Applications/Multimedia
Summary:        Perl extension for graphviz
Requires:       %{name} = %{version}-%{release}, perl
Obsoletes:      %{name}-perl <= 2.41
Provides:       %{name}-perl = %{version}-%{release}

%description lang-perl
Perl extension for graphviz.

%files lang-perl
%defattr(-,root,root,-)
%{_libdir}/perl*/*
%{_datadir}/graphviz/demo/*.pl*
%{_mandir}/man3/*.3perl.*
%exclude %{_libdir}/graphviz/perl/*.so
%exclude %{_libdir}/graphviz/perl/*.pm

%if %{PHP}
#-- graphviz-lang-php rpm ----------------------------------------------
%package lang-php
Group:          Applications/Multimedia
Summary:        PHP extension for graphviz
Requires:       %{name} = %{version}-%{release}, /usr/bin/php
Obsoletes:      %{name}-php <= 2.41
Provides:       %{name}-php = %{version}-%{release}

%description lang-php
PHP extension for graphviz.

%files lang-php
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/php.d/%{name}.ini
%{php_extdir}/gv.so
%if 0%{?rhel}
%{_datadir}/php*/*
%endif
%{_datadir}/graphviz/demo/*.php*
%{_mandir}/man3/*.3php.*
%exclude %{_libdir}/graphviz/php/*.so
%if 0%{?rhel}
%exclude %{_libdir}/graphviz/php/*.php
%endif
%endif

#-- graphviz-lang-python3 rpm -------------------------------------------
%package lang-python3
Group:          Applications/Multimedia
Summary:        Python extension for graphviz
Requires:       %{name} = %{version}-%{release}, python3
Conflicts:      %{name}-python <= 2.41
Conflicts:      %{name}-lang-python <= 2.41

%description lang-python3
Python extension for graphviz.

%files lang-python3
%defattr(-,root,root,-)
%{_libdir}/python3*/*
%{_datadir}/graphviz/demo/*.py*
%{_mandir}/man3/gv.3python.*
%exclude %{_libdir}/graphviz/python3/*.so
%exclude %{_libdir}/graphviz/python3/*.py*

#-- graphviz-lang-R rpm ---------------------------------------------
%if %{ARRRR}
%package lang-R
Group:          Applications/Multimedia
Summary:        R extension for graphviz
Requires:       %{name} = %{version}-%{release}, R
Obsoletes:      %{name}-R <= 2.41
Provides:       %{name}-R = %{version}-%{release}

%description lang-R
R extension for graphviz.

%files lang-R
%defattr(-,root,root,-)
%dir %{_libdir}/graphviz/R
%{_libdir}/graphviz/R/*
%{_mandir}/man3/*.3r.*
%endif

#-- graphviz-lang-ruby rpm ---------------------------------------------
%package lang-ruby
Group:          Applications/Multimedia
Summary:        Ruby extension for graphviz
Requires:       %{name} = %{version}-%{release}, ruby
Obsoletes:      %{name}-ruby <= 2.41
Provides:       %{name}-ruby = %{version}-%{release}

%description lang-ruby
Ruby extension for graphviz.

%files lang-ruby
%defattr(-,root,root,-)
%{_libdir}/*ruby*/*
%{_datadir}/graphviz/demo/*.rb*
%{_mandir}/man3/*.3ruby.*
%exclude %{_libdir}/graphviz/ruby/*.so

#-- graphviz-lang-tcl rpm ----------------------------------------------
%package lang-tcl
Group:          Applications/Multimedia
Summary:        Tcl extension & tools for graphviz
Requires:       %{name} = %{version}-%{release}, tcl >= 8.3
Obsoletes:      %{name}-tcl <= 2.41
Provides:       %{name}-tcl = %{version}-%{release}

%description lang-tcl
Various tcl packages (extensions) for the graphviz tools.

%files lang-tcl
%defattr(-,root,root,-)
%{_libdir}/tcl*/*
%{_datadir}/graphviz/demo/*.tcl*
%{_datadir}/graphviz/demo/*_data
%{_datadir}/graphviz/demo/entities.html
%{_mandir}/man3/*.3tcl.*
%exclude %{_libdir}/graphviz/tcl/*

#-- graphviz-devel rpm --------------------------------------------
%package devel
Group:          Development/Libraries
Summary:        Development package for graphviz
Requires:       %{name}-libs = %{version}-%{release}, pkgconfig
Requires(post):   /sbin/ldconfig
Requires(postun): /sbin/ldconfig

%description devel
A collection of tools for the manipulation and layout
of graphs (as in nodes and edges, not as in bar-charts).
This package contains development files for graphviz-libs.

%post devel
/sbin/ldconfig

%postun devel
/sbin/ldconfig

%files devel
%defattr(-,root,root,-)
%{_includedir}/graphviz
%{_libdir}/libcdt.so
%{_mandir}/man3/cdt.3.*
%{_libdir}/pkgconfig/libcdt.pc
%{_libdir}/libcgraph.so
%{_mandir}/man3/cgraph.3.*
%{_libdir}/pkgconfig/libcgraph.pc
%{_libdir}/libgvc.so
%{_mandir}/man3/gvc.3.*
%{_libdir}/pkgconfig/libgvc.pc
%{_libdir}/libgvpr.so
%{_mandir}/man3/gvpr.3.*
%{_libdir}/pkgconfig/libgvpr.pc
%{_libdir}/libpathplan.so
%{_mandir}/man3/pathplan.3.*
%{_libdir}/pkgconfig/libpathplan.pc
%{_libdir}/libxdot.so
%{_mandir}/man3/xdot.3.*
%{_libdir}/pkgconfig/libxdot.pc
%{_mandir}/man3/expr.3.*
%{_mandir}/man3/pack.3.*
%exclude %{_libdir}/graphviz/libgvplugin*
%exclude %{_libdir}/graphviz/*.so

#-- graphviz-graphs rpm -------------------------------------------
%package graphs
Group:          Applications/Multimedia
Summary:        Demo graphs for graphviz
BuildArch:      noarch

%description graphs
Some demo graphs for graphviz.

%files graphs
%defattr(-,root,root,-)
%dir %{_datadir}/graphviz
%{_datadir}/graphviz/graphs
%if %{GTK}
%{_datadir}/graphviz/examples
%endif

#-- graphviz-doc rpm ----------------------------------------------
%package doc
Group:          Documentation
Summary:        PDF and HTML documents for graphviz
BuildArch:      noarch

%description doc
Provides some additional PDF and HTML documentation for graphviz.

%files doc
%defattr(-,root,root,-)
%doc __doc/*

#-- building --------------------------------------------------

%prep
%setup -q
for p in %{patches}; do
     patch -p1 < ${p} || exit 1
done

%build
CFLAGS="$RPM_OPT_FLAGS" \
./configure \
        --prefix=%{_prefix} \
        --bindir=%{_bindir} \
        --libdir=%{_libdir} \
        --includedir=%{_includedir} \
        --datadir=%{_datadir} \
        --mandir=%{_mandir} \
        --pdfdir='$(docdir)/pdf' \
        --htmldir='$(docdir)/html' \
        --disable-static \
        --disable-dependency-tracking \
        --enable-sharp \
        --enable-guile \
        --enable-java \
        --disable-d \
        --disable-javascript \
        --enable-lua \
        --enable-perl \
        --enable-php \
        --enable-ruby \
        --enable-tcl \
        --with-gdk \
        --with-ghostscript \
        --with-ipsepcola \
%if ! %{ANN}
        --without-ann \
%endif
%if ! %{GOLANG}
        --disable-go \
%endif
%if ! %{JAVASCRIPT}
        --disable-javascript \
%endif
%if ! %{LASI}
        --without-lasi \
%endif
%if ! %{PHP}
        --disable-php \
%endif
%if ! %{GTS}
        --without-gts \
%endif
%if ! %{SHARP}
        --disable-sharp \
%endif
%if ! %{ARRRR}
        --disable-r \
%endif
%if ! %{DEEEE}
        --disable-d \
%endif
%if ! %{WEBP}
        --without-webp \
%endif
%if ! %{DEVIL}
        --without-devil \
%endif
%if ! %{GTK}
        --without-gtk \
        --without-gtkgl \
        --without-gtkglext \
        --without-smyrna \
%endif
        --with-qt \
        --with-pangocairo \
        --with-poppler \
        --with-rsvg \
        --with-ortho \
        --with-sfdp \
        --with-x
make %{?_smp_mflags}

%install
rm -rf %{buildroot} __doc
make DESTDIR=%{buildroot} install
find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'
cp -a %{buildroot}%{_docdir}/%{name} __doc
rm -rf %{buildroot}%{_docdir}/%{name}

%if %{PHP}
# PHP configuration file
%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
%{__cat} << __EOF__ > %{buildroot}%{_sysconfdir}/php.d/%{name}.ini
; Enable %{name} extension module
extension=gv.so
__EOF__
%endif

# Remove executable modes from demos
find %{buildroot}%{_datadir}/%{name}/demo -type f -exec chmod a-x {} ';'

# Rename python demos to prevent byte compilation
find %{buildroot}%{_datadir}/%{name}/demo -type f -name "*.py" -exec mv {} {}.demo ';'

# Ghost plugins config
touch %{buildroot}%{_libdir}/graphviz/config%{pluginsver}

%check
%ifnarch ppc64 ppc
# regression test, segfaults on ppc/ppc64, possible endian issues?
#cd rtest
#make rtest
%endif

%clean
# optional regression test using the products in the build tree
# FIXME - rtest not working reliably in rpm build environment - JCE
%if 0%{?rtest}
#cd rtest
#make rtest
%endif
# clean up temporary installation
rm -rf %{buildroot}

#-- changelog --------------------------------------------------

%changelog
* @GRAPHVIZ_CHANGE_DATE@ @GRAPHVIZ_AUTHOR_NAME@ <@GRAPHVIZ_AUTHOR_EMAIL@> @VERSION@
- see git log
  (This automatically-replaced single-entry is used for frequent
  updates in the unstable development series of releases.
  A properly constructed changelog entry is a requirement
  for stable releases.)