aboutsummaryrefslogtreecommitdiff
path: root/utils/opensc/Makefile
blob: 61dece7385bdebedd7d91c79dc4ed9a4302c3724 (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
#
# Copyright (C) 2011-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=opensc
PKG_VERSION:=0.24.0
PKG_RELEASE:=1
PKG_HASH:=24d03c69287291da32a30c4c38a304ad827f56cb85d83619e1f5403ab6480ef8

PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING
PKG_CPE_ID:=cpe:/a:opensc_project:opensc
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
PKG_SOURCE_URL:=https://github.com/OpenSC/OpenSC/releases/download/$(PKG_VERSION)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz

PKG_BUILD_DEPENDS:=pcsc-lite
PKG_FIXUP:=libtool

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/libopensc
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=OpenSC libraries for smart cards
  URL:=https://github.com/OpenSC/OpenSC/wiki
  DEPENDS:=+libopenssl +libpthread +zlib
  MENU:=1
endef

define Package/libopensc/description
  OpenSC provides a set of libraries and utilities to work with smart cards.
  Its main focus is on cards that support cryptographic operations, and
  facilitate their use in security applications such as authentication,
  mail encryption and digital signatures.
endef

define Package/libopensc-pkcs11
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=OpenSC - PKCS11 provider
  URL:=https://github.com/OpenSC/OpenSC/wiki
  DEPENDS:=libopensc
endef

define Package/libopensc-pkcs11/description
  OpenSC PKCS#11 provider
endef

define Package/libpkcs11-spy
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=PKCS11 spying wrapper
  URL:=https://github.com/OpenSC/OpenSC/wiki
  DEPENDS:=+libopenssl +libpthread
endef

define Package/libpkcs11-spy/dscription
  PKCS#11 spying wrapper
endef

define Package/opensc-utils
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=OpenSC - tools for smart cards
  URL:=https://github.com/OpenSC/OpenSC/wiki
  DEPENDS:=+libopensc
  MENU:=1
endef

define Package/opensc-utils/description
  OpenSC utilities
endef

define ToolGen
define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))
  TITLE:=$(firstword $(subst :, ,$(1))) utility from opensc
  URL:=https://github.com/OpenSC/OpenSC/wiki
  SECTION:=utils
  CATEGORY:=Utilities
  DEPENDS:=opensc-utils $(wordlist 2,$(words $(subst :, ,$(1))),$(subst :, ,$(1)))
endef
endef

define ProfileGen
define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1))))
  TITLE:=$(firstword $(subst :, ,$(1))) card profile for opensc
  URL:=https://github.com/OpenSC/OpenSC/wiki
  SECTION:=libs
  CATEGORY:=Libraries
  DEPENDS:=libopensc
endef
endef

CONFIGURE_ARGS += \
	--disable-man \
	--disable-notify \
	--disable-strict

TOOLS:= \
	cardos-tool \
	cryptoflex-tool \
	dnie-tool \
	egk-tool \
	eidenv \
	gids-tool \
	goid-tool \
	iasecc-tool \
	netkey-tool \
	openpgp-tool \
	opensc-tool \
	opensc-explorer:+libncurses:+libreadline \
	piv-tool \
	pkcs11-register \
	pkcs11-tool \
	pkcs15-crypt \
	pkcs15-init \
	pkcs15-tool \
	sc-hsm-tool \
	westcos-tool

PROFILES:= \
	asepcos \
	authentic \
	cardos \
	cyberflex \
	entersafe \
	epass2003 \
	flex \
	gids \
	gpk \
	ias_adele_admin1 \
	ias_adele_admin2 \
	ias_adele_common \
	iasecc_admin_eid \
	iasecc_generic_oberthur \
	iasecc_generic_pki \
	iasecc \
	incrypto34 \
	isoApplet \
	muscle \
	myeid \
	oberthur \
	openpgp \
	pkcs15 \
	rutoken_ecp \
	rutoken_lite \
	rutoken \
	sc-hsm \
	setcos \
	starcos \
	westcos

$(foreach file,$(TOOLS),$(eval $(call ToolGen,$(file))))
$(foreach file,$(PROFILES),$(eval $(call ProfileGen,$(file))))

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.{la,so}* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.{la,so}* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/lib/pkcs11
	$(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/
	$(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/
	$(INSTALL_DIR) $(1)/usr/share/opensc
	$(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/
endef

define Package/libopensc/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.so* $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.so* $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/etc
	$(CP) $(PKG_INSTALL_DIR)/etc/opensc.conf $(1)/etc/
endef

define Package/libopensc-pkcs11/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/lib/pkcs11
	$(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/
endef

define Package/libpkcs11-spy/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/
	$(INSTALL_DIR) $(1)/usr/lib/pkcs11
	$(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/
endef

define Package/opensc-card-profiles
	$(INSTALL_DIR) $(1)/usr/share/opensc
	$(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/
endef

define Package/opensc-utils/install
	true
endef

define ToolInstall
define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
	$(INSTALL_DIR) $$(1)/usr/bin
	$(INSTALL_BIN) \
		$(PKG_INSTALL_DIR)/usr/bin/$(firstword $(subst :, ,$(1))) \
		$$(1)/usr/bin/
endef
endef

define ProfileInstall
define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
	$(INSTALL_DIR) $$(1)/usr/share/opensc
	$(INSTALL_BIN) \
		$(PKG_INSTALL_DIR)/usr/share/opensc/$(firstword $(subst :, ,$(1))).profile \
		$$(1)/usr/share/opensc
endef
endef

$(foreach file,$(TOOLS),$(eval $(call ToolInstall,$(file))))
$(foreach file,$(PROFILES),$(eval $(call ProfileInstall,$(file))))

$(eval $(call BuildPackage,libopensc))
$(eval $(call BuildPackage,libopensc-pkcs11))
$(eval $(call BuildPackage,libpkcs11-spy))

$(eval $(call BuildPackage,opensc-utils))
$(foreach file,$(TOOLS),$(eval $(call BuildPackage,opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(file)))))))
$(foreach file,$(PROFILES),$(eval $(call BuildPackage,libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(file)))))))