File swig.spec of Package A_tw-swig

189
 
1
#
2
# spec file for package swig
3
#
4
# Copyright (c) 2023 SUSE LLC
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via https://bugs.opensuse.org/
16
#
17
18
19
%bcond_with  swig_ocaml
20
%if 0%{?fedora} + 0%{?rhel_version} + 0%{?centos_version} > 0
21
%define docpath %{_docdir}/%{name}-%{version}
22
BuildRequires:  perl-Test-Simple
23
BuildRequires:  perl-devel
24
%if 0%{?centos_version} < 800
25
BuildRequires:  ruby
26
%endif
27
%endif
28
%if 0%{?suse_version} > 0
29
%define docpath %{_docdir}/%{name}
30
BuildRequires:  ruby-devel
31
%endif
32
Name:           swig
33
Version:        4.1.1
34
Release:        0
35
Summary:        Simplified Wrapper and Interface Generator
36
License:        BSD-3-Clause AND GPL-3.0-or-later
37
Group:          Development/Languages/C and C++
38
URL:            http://www.swig.org/
39
Source:         https://github.com/swig/swig/archive/v%{version}/%{name}-v%{version}.tar.gz
40
Source1:        %{name}.rpmlintrc
41
42
BuildRequires:  autoconf
43
BuildRequires:  automake
44
BuildRequires:  bison
45
BuildRequires:  fdupes
46
BuildRequires:  gcc-c++
47
BuildRequires:  libtool
48
BuildRequires:  pcre2-devel
49
BuildRequires:  perl
50
BuildRequires:  pkgconfig
51
%if 0%{?centos_version} >= 800
52
BuildRequires:  boost-devel
53
BuildRequires:  python3-devel
54
BuildRequires:  python3-tools
55
%else
56
%if 0%{?suse_version} >= 1599
57
BuildRequires:  libboost_headers-devel
58
BuildRequires:  python311-base
59
BuildRequires:  python(abi) = 3.11
60
BuildRequires:  python311-devel
61
BuildRequires:  python311-tools
62
%else
63
%if 0%{?suse_version} >= 1500
64
BuildRequires:  libboost_headers-devel
65
BuildRequires:  python3-devel
66
BuildRequires:  python3-tools
67
%else
68
BuildRequires:  boost-devel
69
BuildRequires:  python-devel > 2.6
70
%endif
71
%endif
72
%endif
73
%if %{with swig_ocaml}
74
BuildRequires:  ncurses-devel
75
BuildRequires:  ocaml >= 3.12.0
76
BuildRequires:  ocaml-camlp4-devel
77
BuildRequires:  ocaml-findlib
78
%endif
79
80
%description
81
SWIG is a compiler that attempts to make it easy to integrate C, C++,
82
or Objective-C code with scripting languages including Perl, Tcl, and
83
Python.  In a nutshell, you give it a bunch of ANSI C/C++ declarations
84
and it generates an interface between C and your favorite scripting
85
language.  However, this is only scratching the surface of what SWIG
86
can do--some of its more advanced features include automatic
87
documentation generation, module and library management, extensive
88
customization options, and more.
89
90
%package doc
91
Summary:        SWIG Manual
92
License:        BSD-3-Clause
93
Group:          Documentation/Man
94
Requires:       swig
95
BuildArch:      noarch
96
97
%description doc
98
SWIG is a compiler that attempts to make it easy to integrate C, C++,
99
or Objective-C code with scripting languages including Perl, Tcl, and
100
Python.  In a nutshell, you give it a bunch of ANSI C/C++ declarations
101
and it generates an interface between C and your favorite scripting
102
language.  However, this is only scratching the surface of what SWIG
103
can do--some of its more advanced features include automatic
104
documentation generation, module and library management, extensive
105
customization options, and more.
106
107
This package contains the SWIG manual.
108
109
%package examples
110
Summary:        SWIG example files
111
License:        BSD-3-Clause
112
Group:          Documentation/Howto
113
Requires:       swig
114
115
%description examples
116
SWIG is a compiler that attempts to make it easy to integrate C, C++,
117
or Objective-C code with scripting languages including Perl, Tcl, and
118
Python.  In a nutshell, you give it a bunch of ANSI C/C++ declarations
119
and it generates an interface between C and your favorite scripting
120
language.  However, this is only scratching the surface of what SWIG
121
can do--some of its more advanced features include automatic
122
documentation generation, module and library management, extensive
123
customization options, and more.
124
125
This package contains SWIG examples, useful both for testing and
126
understandig SWIG usage.
127
128
%prep
129
%setup -q
130
131
%build
132
%ifarch s390 s390x
133
export CCSHARED="-fPIC"
134
%endif
135
./autogen.sh
136
%configure \
137
%if %{without swig_ocaml}
138
    --without-ocaml \
139
%endif
140
    --disable-ccache
141
make %{?_smp_mflags}
142
143
%check
144
%if 0%{?suse_version} >= 1500 || 0%{?centos_version} >= 800
145
export PY3=true
146
%endif
147
make %{?_smp_mflags} check EXTRA_CXXFLAGS="-fexcess-precision=fast"
148
149
%install
150
%make_install
151
152
install -d %{buildroot}%{docpath}
153
cp -a TODO ANNOUNCE CHANGES* LICENSE README Doc/{Devel,Manual} \
154
    %{buildroot}%{docpath}
155
install -d %{buildroot}%{_datadir}/swig
156
cp -a Examples %{buildroot}%{_datadir}/swig/examples
157
rm -rf %{buildroot}%{_datadir}/swig/examples/test-suite
158
159
# rm files that are not needed for running or rebuilding the examples
160
find %{buildroot}%{_datadir}/swig \
161
    -name '*.dsp' -o -name '*.vcproj' -o -name '*.sln' -o \
162
    -name '*.o' -o -name '*_wrap.c' | xargs rm
163
164
# fix perms
165
chmod -x %{buildroot}%{docpath}/Manual/*
166
find %{buildroot}%{_datadir}/swig -name '*.h' -perm /111 | \
167
    xargs --no-run-if-empty chmod -x
168
ln -s %{_datadir}/swig/examples %{buildroot}%{docpath}/Examples
169
170
%fdupes %{buildroot}
171
172
%files
173
%defattr(644,root,root,755)
174
%dir %{docpath}
175
%{docpath}/[A-Z][A-Z]*
176
%{_datadir}/swig
177
%exclude %{_datadir}/swig/examples
178
%attr(755,root,root) %{_bindir}/swig
179
180
%files doc
181
%{docpath}/Devel
182
%{docpath}/Manual
183
184
%files examples
185
%{docpath}/Examples
186
%{_datadir}/swig/examples
187
188
%changelog
189