File: postscriptbarcode.spec

package info (click to toggle)
libpostscriptbarcode 20200401-1.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 3,920 kB
  • sloc: ansic: 563; makefile: 304; perl: 277; xml: 243; sh: 107; lisp: 92; java: 73; python: 45; ruby: 21
file content (413 lines) | stat: -rw-r--r-- 11,897 bytes parent folder | download
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
Name:           postscriptbarcode
Version:        <empty>
Release:        1%{?dist}
Summary:        Barcode Writer in Pure PostScript
Group:          Development/Libraries


# 
# This file is intended to provide a guide to packagers of RPM-based distributions to promote consistency.
#
# The packages have been built on the OBS but not necessarily installed and tested:
# https://build.opensuse.org/package/show/home:terryburton:postscriptbarcode/libpostscriptbarcode
#
# Please contribute any improvements back here:
# https://github.com/bwipp/postscriptbarcode/tree/master/packaging-examples
#
# Known issues:
#
# * RHEL/CentOS 5 too old due to /usr/bin/ld: unrecognized option '-Bsymbolic-functions'. We could disabled this but probably not worth going back this far.
# * Re-enabled postscriptbarcode_test which is failing with an invalid_free recent OpenSUSE.
#

# No Python 3 in RHEL or before SuSE 12
%if 0%{?fedora} || 0%{?suse_version} >= 1200
%global with_python3 1
%endif

# Ruby fails due to extconf.rb bug in RHEL/CentOS/SciLinux 6:
# [   83s] Makefile:152: Commands were specified for file `postscriptbarcode.so' at Makefile:122,
# [   83s] Makefile:152: but `postscriptbarcode.so' is now considered the same file as `/usr/lib/ruby/1.8/i386-linux/postscriptbarcode.so'.
# [   83s] Makefile:152: Commands for `/usr/lib/ruby/1.8/i386-linux/postscriptbarcode.so' will be ignored in favor of those for `postscriptbarcode.so'.
# Ruby-devel is not available in the base channel for RHEL 7 on OBS
%if 0%{?rhel} != 6 && 0%{?rhel} != 7
%global with_ruby 1
%endif

# Doxygen segfaults on RHEL/CentOS/SciLinux 6:
%if 0%{?rhel} != 6
%global with_docs 1
%endif

# Fedora-style compat macros for SuSE
%{!?__python2:          %global __python2 /usr/bin/python2}
%{!?python2_sitearch:   %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python2_sitelib:    %global python2_sitelib  %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%if 0%{?with_python3}
%{!?__python3:          %global __python3 /usr/bin/python3}
%{!?python3_sitearch:   %global python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python3_sitelib:    %global python3_sitelib  %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif

%if 0%{?with_ruby}
%{!?ruby_vendorarchdir: %global ruby_vendorarchdir %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorarchdir"]')}
%{!?ruby_vendorlibdir:  %global ruby_vendorlibdir  %(ruby -rrbconfig -e 'puts RbConfig::CONFIG["vendorlibdir"]')}
%endif

# SuSE naming conventions
%if 0%{?suse_version}
%global postscriptbarcode_lib_pkgname libpostscriptbarcode0
%global python2_postscriptbarcode_pkgname python-postscriptbarcode
%else
%global postscriptbarcode_lib_pkgname postscriptbarcode-libs
%global python2_postscriptbarcode_pkgname python2-postscriptbarcode
%endif


License:        MIT
URL:            https://bwipp.terryburton.co.uk
Source0:        https://github.com/bwipp/postscriptbarcode/archive/master/%{name}-%{version}.tar.gz
BuildRequires:  ghostscript
BuildRequires:  swig
BuildRequires:  java-devel
BuildRequires:  ant
BuildRequires:  perl
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  chrpath

%if 0%{?with_docs}
BuildRequires:  doxygen
%if 0%{?rhel} == 5
BuildRequires:  graphviz-gd
%endif
%endif

%if 0%{?suse_version}
BuildRequires:  python-devel
BuildRequires:  fdupes
%else
BuildRequires:  python2-devel
%endif

%if 0%{?with_python3}
BuildRequires:  python3-devel
%endif


%if 0%{?with_ruby}

%if 0%{?fedora}
BuildRequires:  ruby(release)
BuildRequires:  rubypick
BuildRequires:  ruby-devel
%endif

%if 0%{?rhel} && 0%{?rhel} >=7
BuildRequires:  ruby(release)
BuildRequires:  ruby-devel
%endif

%if 0%{?rhel} && 0%{?rhel} <7
BuildRequires:  ruby
BuildRequires:  ruby-devel
%endif

%if 0%{?suse_version}
BuildRequires:  ruby
BuildRequires:  ruby-devel
%endif

%endif


# Required for EPEL <= 5
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)


%description
Barcode Writer in Pure Postscript generates all barcode formats entirely
within PostScript so that the process of converting the input data into
the printed output can be performed by the printer or RIP itself. This is
ideal for variable data printing (VDP) and avoids the need to re-implement
the barcode generation process whenever your language needs change.


%package -n %{postscriptbarcode_lib_pkgname}
Summary: Shared library for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: postscriptbarcode

%description -n %{postscriptbarcode_lib_pkgname}
This package provides the shared library for Barcode Writer in Pure PostScript.


%package -n %{postscriptbarcode_lib_pkgname}-devel
Summary: Development files for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}

%description -n %{postscriptbarcode_lib_pkgname}-devel
Package providing the development files for Barcode Writer in Pure PostScript


%package -n java-postscriptbarcode
Summary: Java binding for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}
Requires: java-headless
Requires: javapackages-tools

%description -n java-postscriptbarcode
This package provides the Java binding for Barcode Writer in Pure PostScript


%package -n perl-postscriptbarcode
Summary: Perl binding for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}
%if 0%{?fedora}
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
%endif
%if 0%{?suse_version}
%if 0%{?suse_version} < 1140
Requires: perl = %{perl_version}
%else
%{perl_requires}
%endif
%endif

%description -n perl-postscriptbarcode
This package provides the Perl binding for Barcode Writer in Pure PostScript


%package -n %{python2_postscriptbarcode_pkgname}
Summary: Python 2 binding for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}
%{?python_provide:%python_provide python2-postscriptbarcode}

%description -n %{python2_postscriptbarcode_pkgname}
This package provides the Python 2 binding for Barcode Writer in Pure PostScript


%if 0%{?with_python3}
%package -n python3-postscriptbarcode
Summary: Python 3 binding for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}
%{?python_provide:%python_provide python3-postscriptbarcode}

%description -n python3-postscriptbarcode
This package provides the Python 3 binding for Barcode Writer in Pure PostScript
%endif

%if 0%{?with_ruby}
%package -n ruby-postscriptbarcode
Summary: Ruby binding for Barcode Writer in Pure PostScript
Group: Development/Libraries
Requires: ruby(release)
Requires: %{postscriptbarcode_lib_pkgname} = %{version}-%{release}

%description -n ruby-postscriptbarcode
This package provides the Ruby binding for Barcode Writer in Pure PostScript
%endif


%prep
%setup -q -n %{name}-%{version}


%build

# For debugging
rpm --showrc

%{__make} %{?_smp_mflags}

pushd libs/c
%{__make} %{?_smp_mflags} CFLAGS="%{optflags}"
popd

pushd libs/bindings/java
%ant
popd

pushd libs/bindings/perl
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1
%{__make} %{?_smp_mflags}
find . -name 'postscriptbarcode.so' -exec chrpath -d {} \;
popd

pushd libs/bindings/python
# %%py2_build
CFLAGS="%{optflags}" %{__python2} setup.py build --executable="%{__python2} -s"
popd

%if 0%{?with_python3}
pushd libs/bindings/python
# %%py3_build
CFLAGS="%{optflags}" %{__python3} setup.py build --executable="%{__python3} -s"
popd
%endif

%if 0%{?with_ruby}
pushd libs/bindings/ruby
CONFIGURE_ARGS="--with-cflags='%{optflags}'" ruby extconf.rb --vendor
%{__make} %{?_smp_mflags}
popd
%endif

pushd libs/docs
mkdir -p html
touch html/index.html
%if 0%{?with_docs}
%{__make} %{_smp_mflags}
%endif
popd


%install

mkdir -p %{buildroot}/%{_datadir}/%{name}
cp -p build/monolithic_package/barcode.ps %{buildroot}%{_datadir}/%{name}/barcode.ps

pushd libs/c
%{__make} install-shared DESTDIR=%{buildroot} PREFIX=/usr LIBDIR=%{_libdir}
find %{buildroot}/%{_libdir} -name 'libpostscriptbarcode.so.*' -type f -exec chmod 0755 {} \;
popd

%if 0%{?suse_version}
export NO_BRP_CHECK_BYTECODE_VERSION=true
%endif

pushd libs/bindings/java
mkdir -p %{buildroot}/%{_javadir}/
cp -p *.jar %{buildroot}/%{_javadir}/
mkdir -p %{buildroot}/%{_libdir}/java-postscriptbarcode
cp -p *.so %{buildroot}/%{_libdir}/java-postscriptbarcode/
popd

pushd libs/bindings/perl
find . -type f -exec chmod 0664 {} \;
%{__make} pure_install DESTDIR=%{buildroot} OPTIMIZE="%{optflags}"
find %{buildroot}/%{perl_vendorarch} -type f -name 'postscriptbarcode.so' -exec chmod 0755 {} \;
find %{buildroot}/%{perl_vendorarch} -type f -name .packlist -exec rm -f {} \;
find %{buildroot}/%{perl_vendorarch} -type f -name '*.bs' -empty -exec rm -f {} \;
popd

%if 0%{?with_python3}
pushd libs/bindings/python
# %%py3_install
CFLAGS="%{optflags}" %{__python3} setup.py install -O1 --skip-build --prefix=%{_prefix} --root %{buildroot}
%if 0%{?suse_version}
%fdupes %{buildroot}/%{python3_sitearch}
%endif
popd
%endif

pushd libs/bindings/python
# %%py2_install
CFLAGS="%{optflags}" %{__python2} setup.py install -O1 --skip-build --prefix=%{_prefix} --root %{buildroot}
%if 0%{?suse_version}
%fdupes %{buildroot}/%{python2_sitearch}
%endif
popd

%if 0%{?with_ruby}
pushd libs/bindings/ruby
%{__make} install DESTDIR=%{?buildroot}
popd
%endif


%check
%{__make} test

pushd libs/c
# TODO: re-enable
# %%{__make} test 
popd

pushd libs/bindings/java
ant test
popd

pushd libs/bindings/perl
LD_LIBRARY_PATH="../../c:$LD_LIBRARY_PATH" %{__make} test
popd

pushd libs/bindings/python
LD_LIBRARY_PATH="../../c:$LD_LIBRARY_PATH" PYTHONPATH=%{buildroot}/%{python2_sitearch}:%{buildroot}/%{python2_sitelib} %{__python2} setup.py test
popd

%if 0%{?with_python3}
pushd libs/bindings/python
LD_LIBRARY_PATH="../../c:$LD_LIBRARY_PATH" PYTHONPATH=%{buildroot}/%{python3_sitearch}:%{buildroot}/%{python3_sitelib} %{__python3} setup.py test
popd
%endif

%if 0%{?with_ruby}
pushd libs/bindings/ruby
LD_LIBRARY_PATH="../../c:$LD_LIBRARY_PATH" ruby -I%{buildroot}/%{ruby_vendorarchdir} example.rb
popd
%endif


%post -n %{postscriptbarcode_lib_pkgname} -p /sbin/ldconfig

%postun -n %{postscriptbarcode_lib_pkgname} -p /sbin/ldconfig


%files
%defattr(-,root,root)
%doc CHANGES LICENSE README.md docs/*
%dir %{_datadir}/%{name}/
%{_datadir}/%{name}/barcode.ps

%files -n %{postscriptbarcode_lib_pkgname}
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md libs/docs/html/*
%{_libdir}/libpostscriptbarcode.so.*

%files -n %{postscriptbarcode_lib_pkgname}-devel
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{_includedir}/*
%{_libdir}/libpostscriptbarcode.so

%files -n java-postscriptbarcode
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{_javadir}/*
%dir %{_libdir}/java-postscriptbarcode/
%{_libdir}/java-postscriptbarcode/*

%files -n perl-postscriptbarcode
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/auto/postscriptbarcode/*
%{perl_vendorarch}/postscriptbarcode.pm

%files -n %{python2_postscriptbarcode_pkgname}
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{python2_sitearch}/*

%if 0%{?with_python3}
%files -n python3-postscriptbarcode
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{python3_sitearch}/*
%endif

%if 0%{?with_ruby}
%files -n ruby-postscriptbarcode
%defattr(-,root,root)
%doc CHANGES LICENSE libs/README.md
%{ruby_vendorarchdir}/*
%endif

%changelog