1
1
# /bin/bash
2
2
3
- # Copyright (C) 2014 Red Hat, Inc.
3
+ # Copyright (C) 2014 - 2020 Red Hat, Inc.
4
4
#
5
5
# This file is part of csdiff.
6
6
#
@@ -71,20 +71,16 @@ xz -c "$SRC_TAR" > "$SRC" || die "failed to compress sources"
71
71
72
72
SPEC=" ./$PKG .spec"
73
73
cat > " $SPEC " << EOF
74
- # python3 is not available on RHEL <= 7
75
- %if 0%{?fedora} || 0%{?rhel} > 7
76
- %bcond_without python3
77
- %else
78
- %bcond_with python3
79
- %endif
80
-
81
- # python2 is not available on RHEL > 7 and not needed on Fedora > 29
82
- %if 0%{?rhel} > 7 || 0%{?fedora} > 29
74
+ # python2 is not available on RHEL > 7 and Fedora
75
+ %if 0%{?rhel} > 7 || 0%{?fedora}
83
76
%bcond_with python2
84
77
%else
85
78
%bcond_without python2
86
79
%endif
87
80
81
+ # python3 support is optional
82
+ %bcond_without python3
83
+
88
84
Name: $PKG
89
85
Version: $VER
90
86
Release: 1%{?dist}
@@ -111,7 +107,7 @@ defect lists using various filtering predicates.
111
107
%if %{with python2}
112
108
%package -n python2-%{name}
113
109
Summary: Python interface to csdiff for Python 2
114
- %if 0%{?fedora} > 28
110
+ %if 0%{?fedora}
115
111
BuildRequires: boost-python2-devel
116
112
%endif
117
113
BuildRequires: python2-devel
@@ -125,7 +121,13 @@ code scan defect lists to find out added or fixed defects.
125
121
%if %{with python3}
126
122
%package -n python3-%{name}
127
123
Summary: Python interface to csdiff for Python 3
128
- BuildRequires: boost-python3-devel
124
+
125
+ # this packages redefines %%{python3_pkgversion} to 36 because there is
126
+ # no boost-python3-devel in epel-7 buildroot, only boost-python36-devel
127
+ %if 0%{?rhel} == 7
128
+ BuildRequires: epel-rpm-macros
129
+ %endif
130
+ BuildRequires: boost-python%{python3_pkgversion}-devel
129
131
BuildRequires: python3-devel
130
132
%{?python_provide:%python_provide python3-%{name}}
131
133
@@ -139,41 +141,40 @@ code scan defect lists to find out added or fixed defects.
139
141
140
142
%build
141
143
make version.cc
142
- mkdir csdiff_build
143
- cd csdiff_build
144
+ mkdir -p %{_target_platform}
145
+ cd %{_target_platform}
144
146
%cmake .. -B. -DBUILD_PYCSDIFF=OFF
145
- make %{?_smp_mflags} VERBOSE=yes
147
+ %make_build
146
148
147
149
%if %{with python2}
148
- mkdir ../csdiff_build_py2
149
- cd ../csdiff_build_py2
150
+ mkdir -p ../%{_target_platform}-py2
151
+ cd ../%{_target_platform}-py2
150
152
%cmake .. -B. -DPYTHON_EXECUTABLE=%{__python2}
151
- make %{?_smp_mflags} VERBOSE=yes pycsdiff
153
+ %make_build pycsdiff
152
154
%endif
153
155
154
156
%if %{with python3}
155
- mkdir ../csdiff_build_py3
156
- cd ../csdiff_build_py3
157
+ mkdir -p ../%{_target_platform}-py3
158
+ cd ../%{_target_platform}-py3
157
159
%cmake .. -B. \\
158
160
-DPYTHON_EXECUTABLE=%{__python3} \\
159
161
-DBOOST_PYTHON_LIB_NAME=boost_python%{python3_version_nodots}
160
- make %{?_smp_mflags} VERBOSE=yes pycsdiff
162
+ %make_build pycsdiff
161
163
%endif
162
164
163
165
%install
164
166
%if %{with python2}
165
- make install-pycsdiff -C csdiff_build_py2 DESTDIR=%{buildroot}
167
+ make install-pycsdiff -C %{_target_platform}-py2 DESTDIR=%{buildroot}
166
168
%endif
167
169
168
170
%if %{with python3}
169
- make install-pycsdiff -C csdiff_build_py3 DESTDIR=%{buildroot}
171
+ make install-pycsdiff -C %{_target_platform}-py3 DESTDIR=%{buildroot}
170
172
%endif
171
173
172
- cd csdiff_build
173
- %make_install
174
+ %make_install -C %{_target_platform}
174
175
175
176
%check
176
- cd csdiff_build
177
+ cd %{_target_platform}
177
178
ctest %{?_smp_mflags} --output-on-failure
178
179
179
180
%files
0 commit comments