summaryrefslogtreecommitdiff
path: root/vtk.spec
blob: f68bf25cdf98655b78b52f6bba590a80d170d14f (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
%undefine __cmake_in_source_build

%global _lto_cflags %{nil}

%bcond_with OSMesa
%ifarch %{java_arches}
%bcond_without java
%else
%bcond_with java
%endif
%bcond_without mpich
%bcond_without openmpi
%bcond_with flexiblas
%bcond_with gl2ps
%bcond_with fmt

Summary: The Visualization Toolkit - A high level 3D visualization library
Name: vtk
Version: 9.3.1
Release: 1
License: BSD
Source0: https://www.vtk.org/files/release/9.1/VTK-%{version}.tar.gz
Source1: https://www.vtk.org/files/release/9.1/VTKData-%{version}.tar.gz
Source2: xorg.conf
Source100: https://www.vtk.org/files/release/9.1/VTKData-%{version}.tar.gz_00
Source101: https://www.vtk.org/files/release/9.1/VTKData-%{version}.tar.gz_01
Source102: https://www.vtk.org/files/release/9.1/VTKData-%{version}.tar.gz_02

Patch01:  0001-fix-tao-pegtl-contrib-tracer.hpp-No-such-file-or-dir.patch

URL: https://vtk.org/

BuildRequires:  cmake
%global cmake_gen %{nil}
BuildRequires:  gcc-c++
%if %{with java}
BuildRequires: java-devel
%else
Obsoletes:     %{name}-java < %{version}-%{release}
Obsoletes:     %{name}-java-devel < %{version}-%{release}
%endif
%if %{with flexiblas}
BuildRequires:  flexiblas-devel
%else
BuildRequires:  blas-devel
BuildRequires:  lapack-devel
%endif
BuildRequires:  boost-devel
BuildRequires:  cgnslib-devel
BuildRequires:  cli11-devel
BuildRequires:  double-conversion-devel
BuildRequires:  eigen3-devel
BuildRequires:  expat-devel
%if %{with fmt}
BuildRequires:  fmt-devel >= 8.1.0
%endif
BuildRequires:  freetype-devel
BuildRequires:  gdal-devel
%if %{with gl2ps}
BuildRequires:  gl2ps-devel
%endif
BuildRequires:  glew-devel
BuildRequires:  hdf5-devel
BuildRequires:  jsoncpp-devel
BuildRequires:  libarchive-devel
BuildRequires:  libGL-devel
BuildRequires:  libharu-devel >= 2.3.0-9
BuildRequires:  libICE-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libpq-devel
BuildRequires:  libtheora-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  libX11-devel
BuildRequires:  libXext-devel
BuildRequires:  libXt-devel
BuildRequires:  lz4-devel
BuildRequires:  fastfloat-devel
BuildRequires:  verdict-devel
BuildRequires:  json-devel
BuildRequires:  mariadb-connector-c-devel
%{?with_OSMesa:BuildRequires: mesa-libOSMesa-devel}
BuildRequires:  motif-devel
BuildRequires:  netcdf-cxx-devel
BuildRequires:  openslide-devel
BuildRequires:  PEGTL-devel
BuildRequires:  proj-devel
BuildRequires:  pugixml-devel
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-qt5
BuildRequires:  qt5-qtbase-devel
BuildRequires:  qt5-qttools-devel
BuildRequires:  qt5-qtx11extras-devel
BuildRequires:  qt5-qtwebkit-devel
BuildRequires:  R-devel
BuildRequires:  sqlite-devel
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  utf8cpp-devel
BuildRequires:  zlib-devel
BuildRequires:  chrpath
BuildRequires:  doxygen
BuildRequires:  graphviz
BuildRequires:  gnuplot
BuildRequires:  wget
%if %{with mpich}
BuildRequires:  mpich-devel
BuildRequires:  python%{?python3_pkgversion}-mpi4py-mpich
BuildRequires:  netcdf-mpich-devel
%endif
%if %{with openmpi}
BuildRequires:  openmpi-devel
BuildRequires:  python%{?python3_pkgversion}-mpi4py-openmpi
BuildRequires:  netcdf-openmpi-devel
%endif
Requires: hdf5 = %{_hdf5_version}

%global vtk_devel_requires \
Requires: cmake \
%if %{with flexiblas} \
Requires: flexiblas-devel \
%else \
Requires: blas-devel \
Requires: lapack-devel \
%endif \
Requires: blas-devel \
Requires: boost-devel \
Requires: cgnslib-devel \
Requires: cli11-static \
Requires: double-conversion-devel \
Requires: eigen3-static \
Requires: expat-devel \
%if %{with fmt} \
Requires: fmt-devel \
%endif \
Requires: freetype-devel \
Requires: gdal-devel \
%if %{with gl2ps} \
Requires: gl2ps-devel \
%endif \
Requires: glew-devel \
Requires: jsoncpp-devel \
Requires: lapack-devel \
Requires: libarchive-devel \
Requires: libGL-devel \
Requires: libharu-devel >= 2.3.0-9 \
Requires: libjpeg-devel \
Requires: libogg-devel \
Requires: libpng-devel \
Requires: libpq-devel \
Requires: libtheora-devel \
Requires: libtiff-devel \
Requires: libxml2-devel \
Requires: libX11-devel \
Requires: libXext-devel \
Requires: lz4-devel \
Requires: mariadb-connector-c-devel \
%if %{with OSMesa} \
Requires: mesa-libOSMesa-devel \
%endif \
Requires: netcdf-cxx-devel \
Requires: openslide-devel \
Requires: PEGTL-devel \
Requires: proj-devel \
Requires: pugixml-devel \
Requires: python3-devel \
Requires: sqlite-devel \
Requires: qt5-qtbase-devel \
Requires: qt5-qttools-devel \
Requires: qt5-qtx11extras-devel \
Requires: qt5-qtwebkit-devel \
Requires: utf8cpp-devel \
Requires: zlib-devel \
Requires: fastfloat-devel \
Requires: verdict-devel \
Requires: json-devel \
Requires: sqlite-devel \

Provides: bundled(kwsys-base64)
Provides: bundled(kwsys-commandlinearguments)
Provides: bundled(kwsys-directory)
Provides: bundled(kwsys-dynamicloader)
Provides: bundled(kwsys-encoding)
Provides: bundled(kwsys-fstream)
Provides: bundled(kwsys-fundamentaltype)
Provides: bundled(kwsys-glob)
Provides: bundled(kwsys-md5)
Provides: bundled(kwsys-process)
Provides: bundled(kwsys-regularexpression)
Provides: bundled(kwsys-status)
Provides: bundled(kwsys-system)
Provides: bundled(kwsys-systeminformation)
Provides: bundled(kwsys-systemtools)
Provides: bundled(diy2)
Provides: bundled(exodusII) = 2.0.0
Provides: bundled(exprtk) = 2.71
%if !%{with fmt}
Provides: bundled(fmt) = 8.1.0
%endif
Provides: bundled(ftgl) = 1.32
%if !%{with gl2ps}
Provides: bundled(gl2ps) = 1.4.0
%endif
Provides: bundled(ioss) = 20210512
Provides: bundled(kissfft)
Provides: bundled(metaio)
Provides: bundled(verdict) = 1.2.0
Provides: bundled(vpic)
Provides: bundled(xdmf2) = 2.1
Provides: bundled(xdmf3)

Obsoletes: %{name}-tcl < 8.2.0-1
Obsoletes: %{name}-qt-tcl < 8.2.0-1

%description
VTK is an open-source software system for image processing, 3D
graphics, volume rendering and visualization. VTK includes many
advanced algorithms (e.g., surface reconstruction, implicit modeling,
decimation) and rendering techniques (e.g., hardware-accelerated
volume rendering, LOD control).

NOTE: The version in this package has NOT been compiled with MPI support.
%if %{with mpich}
Install the %{name}-mpich package to get a version compiled with mpich.
%endif
%if %{with openmpi}
Install the %{name}-openmpi package to get a version compiled with openmpi.
%endif

%package devel
Summary: VTK header files for building C++ code
Requires: %{name}%{?_isa} = %{version}-%{release}
%if %{with java}
Requires: %{name}-java%{?_isa} = %{version}-%{release}
%endif
Requires: python%{python3_pkgversion}-%{name}%{?_isa} = %{version}-%{release}
Requires: hdf5-devel%{?_isa}
Requires: netcdf-mpich-devel%{?_isa}
%{vtk_devel_requires}

%description devel
This provides the VTK header files required to compile C++ programs that
use VTK to do 3D visualization.

%package -n python%{python3_pkgversion}-%{name}
Summary: Python 3 bindings for VTK
Requires: vtk%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python%{python3_pkgversion}-vtk}
Provides: %{py3_dist vtk} = %{version}
Provides: python%{python3_version}dist(vtk) = %{version}
Obsoletes: python3-vtk-qt < 8.2.0-27
Provides:  python%{python3_pkgversion}-vtk-qt = %{version}-%{release}

%description -n python%{python3_pkgversion}-%{name}
Python 3 bindings for VTK.

%if %{with java}
%package java
Summary: Java bindings for VTK
Requires: %{name}%{?_isa} = %{version}-%{release}

%description java
Java bindings for VTK.

%package java-devel
Summary: Java development for VTK
Requires: %{name}-java%{?_isa} = %{version}-%{release}
Requires: java-devel

%description java-devel
Java development for VTK.
%endif

%package qt
Summary: Qt bindings for VTK
Requires: %{name}%{?_isa} = %{version}-%{release}

%description qt
Qt bindings for VTK.

%if %{with mpich}
%package mpich
Summary: The Visualization Toolkit - mpich version

Obsoletes: %{name}-mpich-tcl < 8.2.0-1
Obsoletes: %{name}-mpich-qt-tcl < 8.2.0-1
%if %{without java}
Obsoletes:     %{name}-mpich-java < %{version}-%{release}
Obsoletes:     %{name}-mpich-java-devel < %{version}-%{release}
%endif

%description mpich
VTK is an open-source software system for image processing, 3D
graphics, volume rendering and visualization. VTK includes many
advanced algorithms (e.g., surface reconstruction, implicit modeling,
decimation) and rendering techniques (e.g., hardware-accelerated
volume rendering, LOD control).

NOTE: The version in this package has been compiled with mpich support.

%package mpich-devel
Summary: VTK header files for building C++ code with mpich
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}-%{name}-mpich%{?_isa} = %{version}-%{release}
Requires: mpich-devel
Requires: hdf5-mpich-devel%{?_isa}
%{vtk_devel_requires}

%description mpich-devel
This provides the VTK header files required to compile C++ programs that
use VTK to do 3D visualization.

NOTE: The version in this package has been compiled with mpich support.

%package -n python%{python3_pkgversion}-%{name}-mpich
Summary: Python 3 bindings for VTK with mpich
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}
Obsoletes: python3-vtk-mpich-qt < 8.2.0-15
Provides:  python%{python3_pkgversion}-vtk-mpich-qt = %{version}-%{release}

%description -n python%{python3_pkgversion}-%{name}-mpich
python 3 bindings for VTK with mpich.

%if %{with java}
%package mpich-java
Summary: Java bindings for VTK with mpich
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}

%description mpich-java
Java bindings for VTK with mpich.

%package mpich-java-devel
Summary: Java development for VTK with mpich
Requires: %{name}-mpich-java%{?_isa} = %{version}-%{release}
Requires: java-devel

%description mpich-java-devel
Java development for VTK with mpich.
%endif

%package mpich-qt
Summary: Qt bindings for VTK with mpich
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}

%description mpich-qt
Qt bindings for VTK with mpich.
%endif

%if %{with openmpi}
%package openmpi
Summary: The Visualization Toolkit - openmpi version

Obsoletes: %{name}-openmpi-tcl < 8.2.0-1
Obsoletes: %{name}-openmpi-qt-tcl < 8.2.0-1
%if %{without java}
Obsoletes:     %{name}-mpich-java < %{version}-%{release}
Obsoletes:     %{name}-mpich-java-devel < %{version}-%{release}
%endif

%description openmpi
VTK is an open-source software system for image processing, 3D
graphics, volume rendering and visualization. VTK includes many
advanced algorithms (e.g., surface reconstruction, implicit modeling,
decimation) and rendering techniques (e.g., hardware-accelerated
volume rendering, LOD control).

NOTE: The version in this package has been compiled with openmpi support.

%package openmpi-devel
Summary: VTK header files for building C++ code with openmpi
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}
Requires: python%{python3_pkgversion}-%{name}-openmpi%{?_isa} = %{version}-%{release}
Requires: openmpi-devel
Requires: hdf5-openmpi-devel%{?_isa}
Requires: netcdf-openmpi-devel%{?_isa}
%{vtk_devel_requires}

%description openmpi-devel
This provides the VTK header files required to compile C++ programs that
use VTK to do 3D visualization.

NOTE: The version in this package has been compiled with openmpi support.

%package -n python%{python3_pkgversion}-%{name}-openmpi
Summary: Python 3 bindings for VTK with openmpi
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}
Obsoletes: python3-vtk-openmpi-qt < 8.2.0-15
Provides:  python%{python3_pkgversion}-vtk-openmpi-qt = %{version}-%{release}

%description -n python%{python3_pkgversion}-%{name}-openmpi
Python 3 bindings for VTK with openmpi.

%if %{with java}
%package openmpi-java
Summary: Java bindings for VTK with openmpi
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}

%description openmpi-java
Java bindings for VTK with openmpi.

%package openmpi-java-devel
Summary: Java development for VTK with openmpi
Requires: %{name}-openmpi-java%{?_isa} = %{version}-%{release}
Requires: java-devel

%description openmpi-java-devel
Java development for VTK with openmpi.
%endif

%package openmpi-qt
Summary: Qt bindings for VTK with openmpi
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}

%description openmpi-qt
Qt bindings for VTK with openmpi.
%endif

%package data
Summary: VTK data files for tests/examples
BuildArch: noarch
Obsoletes: vtkdata < 6.1.0-3

%description data
VTK data files for tests and examples.

%package examples
Summary: Examples for VTK
Requires: %{name}%{?_isa} = %{version}-%{release}, %{name}-data = %{version}

%description examples
This package contains many well-commented examples showing how to use
VTK. Examples are available in the C++, Tcl, Python and Java
programming languages.


%prep
cat %{SOURCE100} %{SOURCE101} %{SOURCE102} > %{SOURCE1}
%autosetup -p1 -b 1 -n VTK-%{version}
for x in vtk{cli11,doubleconversion,eigen,expat,%{?with_fmt:fmt,}freetype,%{?with_gl2ps:gl2ps,}glew,hdf5,jpeg,jsoncpp,libharu,libproj,libxml2,lz4,lzma,mpi4py,netcdf,ogg,pegtl,png,pugixml,sqlite,theora,tiff,utf8,zfp,zlib}
do
  rm -r ThirdParty/*/${x}
done

find Utilities/KWSys/vtksys/ -name \*.[ch]\* | grep -vE '^Utilities/KWSys/vtksys/([a-z].*|Configure|SharedForward|Status|String\.hxx|Base64|CommandLineArguments|Directory|DynamicLoader|Encoding|FStream|FundamentalType|Glob|MD5|Process|RegularExpression|System|SystemInformation|SystemTools)(C|CXX|UNIX)?\.' | xargs rm

mkdir vtk-examples
cp -a Examples vtk-examples
find vtk-examples -type f | xargs chmod -R a-x

%build
export CFLAGS="%{optflags} -D_UNICODE -DHAVE_UINTPTR_T"
export CXXFLAGS="%{optflags} -D_UNICODE -DHAVE_UINTPTR_T"
export CPPFLAGS=-DACCEPT_USE_OF_DEPRECATED_PROJ_API_H
%if %{with java}
export JAVA_HOME=/usr/lib/jvm/java
%endif

%global vtk_cmake_options \\\
 -DCMAKE_INSTALL_DOCDIR=share/doc/%{name} \\\
 -DCMAKE_INSTALL_JARDIR=share/java \\\
 -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} \\\
 -DCMAKE_INSTALL_JNILIBDIR:PATH=%{_lib}/%{name} \\\
 -DCMAKE_INSTALL_LICENSEDIR:PATH=share/licenses/%{name} \\\
 -DCMAKE_INSTALL_QMLDIR:PATH=%{_lib}/qt5/qml \\\
 -DVTK_CUSTOM_LIBRARY_SUFFIX="" \\\
 -DVTK_VERSIONED_INSTALL:BOOL=OFF \\\
 -DVTK_GROUP_ENABLE_Imaging:STRING=YES \\\
 -DVTK_GROUP_ENABLE_Qt:STRING=YES \\\
 -DVTK_GROUP_ENABLE_Rendering:STRING=YES \\\
 -DVTK_GROUP_ENABLE_StandAlone:STRING=YES \\\
 -DVTK_GROUP_ENABLE_Views:STRING=YES \\\
 -DVTK_GROUP_ENABLE_Web:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_CommonArchive:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_DomainsMicroscopy:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_GeovisGDAL:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_ImagingOpenGL2:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_InfovisBoost:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_InfovisBoostGraphAlgorithms:STRING=YES \\\
 -DVTK_MODULE_ENABLE_VTK_IOMySQL:STRING=YES \\\
 -DVTK_PYTHON_OPTIONAL_LINK:BOOL=OFF \\\
 -DVTK_PYTHON_VERSION=3 \\\
%if %{with OSMesa} \
 -DVTK_OPENGL_HAS_OSMESA:BOOL=ON \\\
%endif \
%if %{with java} \
 -DVTK_WRAP_JAVA:BOOL=ON \\\
 -DJAVA_INCLUDE_PATH:PATH=$JAVA_HOME/include \\\
 -DJAVA_INCLUDE_PATH2:PATH=$JAVA_HOME/include/linux \\\
 -DJAVA_AWT_INCLUDE_PATH:PATH=$JAVA_HOME/include \\\
%else \
 -DVTK_WRAP_JAVA:BOOL=OFF \\\
%endif \
 -DVTK_WRAP_PYTHON:BOOL=ON \\\
 -DVTK_USE_EXTERNAL=ON \\\
%if !%{with fmt} \
 -DVTK_MODULE_USE_EXTERNAL_VTK_fmt:BOOL=OFF \\\
%endif \
%if !%{with gl2ps} \
 -DVTK_MODULE_USE_EXTERNAL_VTK_gl2ps:BOOL=OFF \\\
%endif \
 -DVTK_MODULE_USE_EXTERNAL_VTK_exprtk:BOOL=OFF \\\
 -DVTK_MODULE_USE_EXTERNAL_VTK_ioss:BOOL=OFF \\\
 -DVTK_USE_TK=ON \\\
  %{?with_flexiblas:-DBLA_VENDOR=FlexiBLAS}
# https://gitlab.kitware.com/cmake/cmake/issues/17223
#-DVTK_MODULE_ENABLE_VTK_IOPostgreSQL:STRING=YES \\\

%global _vpath_builddir build
%cmake %{cmake_gen} \
 %{vtk_cmake_options} \
 -DVTK_BUILD_DOCUMENTATION:BOOL=OFF \
 -DVTK_BUILD_EXAMPLES:BOOL=OFF \
 -DVTK_BUILD_TESTING:BOOL=OFF
%cmake_build

%if %{with mpich}
%global _vpath_builddir build-mpich
%_mpich_load
export CC=mpicc
export CXX=mpic++
%cmake %{cmake_gen} \
 %{vtk_cmake_options} \
 -DCMAKE_PREFIX_PATH:PATH=$MPI_HOME \
 -DCMAKE_INSTALL_PREFIX:PATH=$MPI_HOME \
 -DCMAKE_INSTALL_LIBDIR:PATH=lib \
 -DCMAKE_INSTALL_JNILIBDIR:PATH=lib/%{name} \
 -DCMAKE_INSTALL_QMLDIR:PATH=lib/qt5/qml \
 -DVTK_USE_MPI:BOOL=ON
%cmake_build
%_mpich_unload
%endif

%if %{with openmpi}
%global _vpath_builddir build-openmpi
%_openmpi_load
export CC=mpicc
export CXX=mpic++
%cmake %{cmake_gen} \
 %{vtk_cmake_options} \
 -DCMAKE_PREFIX_PATH:PATH=$MPI_HOME \
 -DCMAKE_INSTALL_PREFIX:PATH=$MPI_HOME \
 -DCMAKE_INSTALL_LIBDIR:PATH=lib \
 -DCMAKE_INSTALL_JNILIBDIR:PATH=lib/%{name} \
 -DCMAKE_INSTALL_QMLDIR:PATH=lib/qt5/qml \
 -DVTK_USE_MPI:BOOL=ON
%cmake_build
%_openmpi_unload
%endif

# Remove executable bits from sources (some of which are generated)
find . -name \*.c -or -name \*.cxx -or -name \*.h -or -name \*.hxx -or \
       -name \*.gif | xargs chmod -x


%install
%global _vpath_builddir build
%cmake_install

pushd build
ls %{buildroot}%{_libdir}/*.so.* \
  | grep -Ev '(Java|Qt|Python)' | sed -e's,^%{buildroot},,' > libs.list
popd

%if %{with mpich}
%_mpich_load
%global _vpath_builddir build-mpich
%cmake_install

ls %{buildroot}%{_libdir}/mpich/lib/*.so.* \
  | grep -Ev '(Java|Python|Qt)' | sed -e's,^%{buildroot},,' > build-mpich/libs.list

mv %{buildroot}%{_libdir}/mpich/share/licenses/vtk %{buildroot}%{_defaultlicensedir}/%{name}-mpich
%_mpich_unload
%endif

%if %{with openmpi}
%_openmpi_load
%global _vpath_builddir build-openmpi
%cmake_install

ls %{buildroot}%{_libdir}/openmpi/lib/*.so.* \
  | grep -Ev '(Java|Python|Qt)' | sed -e's,^%{buildroot},,' > build-openmpi/libs.list

mv %{buildroot}%{_libdir}/openmpi/share/licenses/vtk %{buildroot}%{_defaultlicensedir}/%{name}-openmpi
%_openmpi_unload
%endif

for file in `find %{buildroot} -type f -perm 0755 \
  | xargs -r file | grep ASCII | awk -F: '{print $1}'`; do
  head -1 $file | grep '^#!' > /dev/null && continue
  chmod 0644 $file
done
find Utilities/Upgrading -type f -print0 | xargs -0 chmod -x

mkdir -p _docs
cp -pr --parents Wrapping/*/README* _docs/

mkdir -p %{buildroot}%{_datadir}/vtkdata
cp -alL build/ExternalData/* %{buildroot}%{_datadir}/vtkdata/
rm -rf %{buildroot}%{_datadir}/vtkdata/Wrapping
export QA_RPATHS=18

%files -f build/libs.list
%license %{_defaultlicensedir}/%{name}/
%doc README.md _docs/Wrapping

%files devel
%doc Utilities/Upgrading
%{_bindir}/vtkParseJava
%{_bindir}/vtkProbeOpenGLVersion
%{_bindir}/vtkWrapHierarchy
%{_bindir}/vtkWrapJava
%{_includedir}/%{name}
%{_libdir}/*.so
%{_libdir}/cmake/%{name}/
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/hierarchy/
%{_docdir}/%{name}/

%files -n python%{python3_pkgversion}-vtk
%{python3_sitearch}/*
%{_libdir}/*Python*.so.*
%{_bindir}/vtkpython
%{_bindir}/vtkWrapPython
%{_bindir}/vtkWrapPythonInit

%if %{with java}
%files java
%{_libdir}/*Java.so.*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*Java.so
%{_javadir}/vtk.jar
%endif

%files qt
%{_libdir}/lib*Qt*.so.*
%exclude %{_libdir}/*Python*.so.*
%{_libdir}/qt5/qml/*

%if %{with mpich}
%files mpich -f build-mpich/libs.list
%license %{_defaultlicensedir}/%{name}-mpich/
%doc README.md _docs/Wrapping

%files mpich-devel
%{_libdir}/mpich/bin/vtkParseJava
%{_libdir}/mpich/bin/vtkProbeOpenGLVersion
%{_libdir}/mpich/bin/vtkWrapHierarchy
%{_libdir}/mpich/bin/vtkWrapJava
%{_libdir}/mpich/include/
%{_libdir}/mpich/lib/*.so
%{_libdir}/mpich/lib/cmake/
%dir %{_libdir}/mpich/lib/%{name}
%{_libdir}/mpich/lib/%{name}/hierarchy/

%files -n python%{python3_pkgversion}-vtk-mpich
%{_libdir}/mpich/lib/python%{python3_version}/
%{_libdir}/mpich/lib/*Python*.so.*
%{_libdir}/mpich/bin/pvtkpython
%{_libdir}/mpich/bin/vtkpython
%{_libdir}/mpich/bin/vtkWrapPython
%{_libdir}/mpich/bin/vtkWrapPythonInit

%if %{with java}
%files mpich-java
%{_libdir}/mpich/lib/*Java.so.*
%dir %{_libdir}/mpich/lib/%{name}
%{_libdir}/mpich/lib/%{name}/*Java.so
%{_libdir}/mpich/share/java/vtk.jar
%endif

%files mpich-qt
%{_libdir}/mpich/lib/lib*Qt*.so.*
%exclude %{_libdir}/mpich/lib/*Python*.so.*
%{_libdir}/mpich/lib/qt5/
%endif

%if %{with openmpi}
%files openmpi -f build-openmpi/libs.list
%license %{_defaultlicensedir}/%{name}-openmpi/
%doc README.md _docs/Wrapping

%files openmpi-devel
%{_libdir}/openmpi/bin/vtkParseJava
%{_libdir}/openmpi/bin/vtkProbeOpenGLVersion
%{_libdir}/openmpi/bin/vtkWrapHierarchy
%{_libdir}/openmpi/bin/vtkWrapJava
%{_libdir}/openmpi/include/
%{_libdir}/openmpi/lib/*.so
%{_libdir}/openmpi/lib/cmake/
%dir %{_libdir}/openmpi/lib/%{name}
%{_libdir}/openmpi/lib/%{name}/hierarchy/

%files -n python%{python3_pkgversion}-vtk-openmpi
%{_libdir}/openmpi/lib/python%{python3_version}/
%{_libdir}/openmpi/lib/*Python*.so.*
%{_libdir}/openmpi/bin/pvtkpython
%{_libdir}/openmpi/bin/vtkpython
%{_libdir}/openmpi/bin/vtkWrapPython
%{_libdir}/openmpi/bin/vtkWrapPythonInit

%if %{with java}
%files openmpi-java
%{_libdir}/openmpi/lib/*Java.so.*
%dir %{_libdir}/openmpi/lib/%{name}
%{_libdir}/openmpi/lib/%{name}/*Java.so
%{_libdir}/openmpi/share/java/vtk.jar
%endif

%files openmpi-qt
%{_libdir}/openmpi/lib/lib*Qt*.so.*
%exclude %{_libdir}/openmpi/lib/*Python*.so.*
%{_libdir}/openmpi/lib/qt5/
%endif

%files data
%{_datadir}/vtkdata

%files examples
%doc vtk-examples/Examples


%changelog
* Tue Aug 5 2025 mimanchiok <mimanchiok@qq.com> - 9.3.1-1
- project init