Skip to content

Commit 8821df7

Browse files
committed
Fixups + try build Fedora package with meson
1 parent 766a89d commit 8821df7

7 files changed

Lines changed: 76 additions & 57 deletions

File tree

.clang-tidy-include

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,38 @@ src/common/*.c
44
src/libopensc/*.h
55
src/libopensc/*.c
66

7+
src/minidriver/*.h
8+
src/minidriver/*.c
9+
710
src/pkcs11/*.h
811
src/pkcs11/*.c
12+
13+
src/pkcs15init/*.h
14+
src/pkcs15init/*.c
15+
16+
src/scconf/*.h
17+
src/scconf/*.c
18+
19+
src/sm/*.h
20+
src/sm/*.c
21+
22+
src/smm/*.h
23+
src/smm/*.c
24+
25+
src/tests/*.h
26+
src/tests/*.c
27+
28+
src/tests/unittests/*.h
29+
src/tests/unittests/*.c
30+
31+
src/tests/p11test/*.h
32+
src/tests/p11test/*.c
33+
34+
src/tests/fuzzing/*.h
35+
src/tests/fuzzing/*.c
36+
37+
src/tools/*.h
38+
src/tools/*.c
39+
40+
src/ui/*.h
41+
src/ui/*.c

.github/workflows/linux-meson.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@ name: Linux (meson)
22

33
on:
44
pull_request:
5+
paths:
6+
- '**.c'
7+
- '**.h'
8+
- '**.sh'
9+
- .github/workflows/linux-meson.yml
10+
- '**meson.build'
11+
- doc/**
512
branches: master
13+
push:
614

715
permissions:
816
contents: read # to fetch code (actions/checkout)

.github/workflows/rpmbuild.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ jobs:
5858
5959
- name: RPM Build
6060
run: |
61-
git config --global --add safe.directory /__w/opensc/opensc
62-
./bootstrap
63-
./configure
64-
make dist
61+
git config --global --add safe.directory $GITHUB_WORKSPACE
62+
meson setup build/
63+
meson dist -C build/ --formats xztar
6564
mkdir -p rpmbuild/SOURCES
66-
cp opensc-*.tar.gz src/pkcs11/opensc.module rpmbuild/SOURCES/
65+
cp build/meson-dist/opensc-*.tar.xz rpmbuild/SOURCES/
6766
rpmbuild --define "_topdir $PWD/rpmbuild" -ba packaging/opensc.spec

packaging/opensc.spec

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ Summary: Smart card library and applications
55

66
License: LGPL-2.1-or-later AND BSD-3-Clause
77
URL: https://github.com/OpenSC/OpenSC/wiki
8-
Source0: https://github.com/OpenSC/OpenSC/releases/download/%{version}/%{name}-%{version}.tar.gz
9-
Source1: opensc.module
8+
Source0: https://github.com/OpenSC/OpenSC/releases/download/%{version}/%{name}-%{version}.tar.xz
109

1110
BuildRequires: make
1211
BuildRequires: pcsc-lite-devel
1312
BuildRequires: readline-devel
1413
BuildRequires: openssl-devel
1514
BuildRequires: /usr/bin/xsltproc
1615
BuildRequires: docbook-style-xsl
17-
BuildRequires: autoconf automake libtool gcc
16+
BuildRequires: meson gcc
1817
%if 0%{?fedora} || 0%{?rhel} > 10
1918
BuildRequires: bash-completion-devel
2019
%else
2120
BuildRequires: bash-completion
2221
%endif
23-
BuildRequires: zlib-ng-devel
22+
BuildRequires: zlib-ng-compat-devel
2423
BuildRequires: p11-kit-devel
2524
# For tests
2625
BuildRequires: libcmocka-devel
@@ -77,67 +76,45 @@ cp -p src/scconf/README.scconf .
7776
# No {_libdir} here to avoid multilib conflicts; it's just an example
7877
sed -i -e 's|/usr/local/towitoko/lib/|/usr/lib/ctapi/|' etc/opensc.conf.example.in
7978

80-
81-
%build
82-
autoreconf -fvi
83-
%ifarch %{ix86}
84-
sed -i -e 's/opensc.conf/opensc-%{_arch}.conf/g' src/libopensc/Makefile.in
79+
%conf
80+
%meson -Dopenssl=enabled \
81+
%if ! 0%{?rhel}
82+
-Dopenpace=enabled \
8583
%endif
86-
sed -i -e 's|"/lib /usr/lib\b|"/%{_lib} %{_libdir}|' configure # lib64 rpaths
87-
%set_build_flags
88-
CFLAGS="$CFLAGS -Wstrict-aliasing=2 -Wno-deprecated-declarations"
89-
%configure --disable-static \
90-
--disable-autostart-items \
91-
--disable-notify \
92-
--disable-assert \
93-
--enable-pcsc \
94-
--enable-cmocka \
95-
--enable-sm
96-
%make_build
84+
-Dreadline=enabled \
85+
-Dzlib=enabled \
86+
-Dtests=true \
87+
-Ddriver=pcsc \
88+
-Ddoc=true \
89+
-Dman=true
9790

91+
%build
92+
%meson_build
9893

9994
%check
100-
make check || (cat tests/*.log src/tests/unittests/*.log && exit 1)
101-
95+
%meson_test
10296

10397
%install
104-
%make_install
105-
install -Dpm 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/p11-kit/modules/opensc.module
106-
107-
%ifarch %{ix86}
108-
# To avoid multilib issues, move these files on 32b intel architectures
109-
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/opensc.conf
110-
install -Dpm 644 etc/opensc.conf $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf
111-
rm -f $RPM_BUILD_ROOT%{_mandir}/man5/opensc.conf.5
112-
install -Dpm 644 doc/files/opensc.conf.5 $RPM_BUILD_ROOT%{_mandir}/man5/opensc-%{_arch}.conf.5
113-
# use NEWS file timestamp as reference for configuration file
114-
touch -r NEWS $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf
115-
touch -r NEWS $RPM_BUILD_ROOT%{_mandir}/man5/opensc-%{_arch}.conf.5
116-
%else
117-
# For backward compatibility, symlink the old location to the new files
118-
ln -s %{_sysconfdir}/opensc.conf $RPM_BUILD_ROOT%{_sysconfdir}/opensc-%{_arch}.conf
119-
%endif
120-
121-
find $RPM_BUILD_ROOT%{_libdir} -type f -name "*.la" | xargs rm
98+
%meson_install
12299

123100
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/opensc
124101

125102
# Upstream considers libopensc API internal and no longer ships
126103
# public headers and pkgconfig files.
127104
# Remove the symlink as nothing is supposed to link against libopensc.
128-
rm -f $RPM_BUILD_ROOT%{_libdir}/libopensc.so
105+
rm $RPM_BUILD_ROOT%{_libdir}/libopensc.so
129106
# remove the .pc file so we do not confuse users #1673139
130-
rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/*.pc
131-
rm -f $RPM_BUILD_ROOT%{_libdir}/libsmm-local.so
107+
rm $RPM_BUILD_ROOT%{_libdir}/pkgconfig/*.pc
108+
rm $RPM_BUILD_ROOT%{_libdir}/libsmm-local.so
132109

133110
%if 0%{?rhel}
134-
rm -rf %{buildroot}%{_bindir}/npa-tool
135-
rm -rf %{buildroot}%{_mandir}/man1/npa-tool.1*
111+
rm %{buildroot}%{_bindir}/npa-tool
112+
rm %{buildroot}%{_mandir}/man1/npa-tool.1*
136113
%endif
137114

138115
# the pkcs11-register is not applicable to Fedora/RHEL where we use p11-kit
139-
rm -rf %{buildroot}%{_bindir}/pkcs11-register
140-
rm -rf %{buildroot}%{_mandir}/man1/pkcs11-register.1*
116+
rm %{buildroot}%{_bindir}/pkcs11-register
117+
rm %{buildroot}%{_mandir}/man1/pkcs11-register.1*
141118

142119
# Remove the notification files
143120
rm %{buildroot}%{_datadir}/applications/org.opensc.notify.desktop

src/libopensc/meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ libopensc_sources = files(
4747
'card-setcos.c',
4848
'card-skeid.c',
4949
'card-starcos.c',
50+
'card-srbeid.c',
5051
'card-tcos.c',
5152
'compression.c',
5253
'ctbcs.c',
@@ -104,6 +105,7 @@ libopensc_sources = files(
104105
'pkcs15-skey.c',
105106
'pkcs15-starcert.c',
106107
'pkcs15-starcos-esign.c',
108+
'pkcs15-srbeid.c',
107109
'pkcs15-syn.c',
108110
'pkcs15-tccardos.c',
109111
'pkcs15-tcos.c',

src/pkcs11/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if depp11kit.found()
9292
if host_machine.system() != 'windows'
9393
install_symlink('onepin-opensc-pkcs11.' + extension_of_libraries,
9494
install_dir: p11kit_modules_path,
95-
pointing_to: 'opensc-pkcs11.' + extension_of_libraries
95+
pointing_to: prefix_of_libraries + 'opensc-pkcs11.' + extension_of_libraries
9696
)
9797
endif
9898
else

src/tools/pkcs11-tool.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@
8080
* but does use some OpenSSL routines
8181
*/
8282
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
83-
static OSSL_PROVIDER *legacy_provider = NULL;
84-
static OSSL_PROVIDER *default_provider = NULL;
85-
static OSSL_LIB_CTX *osslctx = NULL;
83+
static OSSL_PROVIDER *legacy_provider = NULL;
84+
static OSSL_PROVIDER *default_provider = NULL;
85+
static OSSL_LIB_CTX *osslctx = NULL;
8686
#endif
8787

8888
#ifdef _WIN32
@@ -94,7 +94,7 @@
9494
#ifdef ENABLE_PKCS11
9595
#ifndef HAVE_P11KIT
9696
#ifndef ENABLE_SHARED
97-
extern CK_FUNCTION_LIST_3_0 pkcs11_function_list_3_0;
97+
extern CK_FUNCTION_LIST_3_0 pkcs11_function_list_3_0;
9898
#endif
9999
#endif
100100
#endif

0 commit comments

Comments
 (0)