Merge pull request #2751 from dibdot/adblock
[feed/packages.git] / utils / opensc / Makefile
1 #
2 # Copyright (C) 2011-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=opensc
11 PKG_VERSION:=20150513
12 PKG_RELEASE:=1
13 PKG_LICENSE:=LGPL-2.1+
14 PKG_LICENSE_FILES:=COPYING
15 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
16
17 PKG_RELEASE=$(PKG_SOURCE_VERSION)
18
19 PKG_SOURCE_PROTO:=git
20 PKG_SOURCE_URL:=https://github.com/OpenSC/OpenSC.git
21 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
22 PKG_SOURCE_VERSION:=a09ca246a797230c14bc33a34f2dddc4a4dbff40
23 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
24 PKG_BUILD_DEPENDS:=+libpcsclite
25 PKG_FIXUP:=libtool
26
27 PKG_INSTALL:=1
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/libopensc
32 SECTION:=libs
33 CATEGORY:=Libraries
34 TITLE:=OpenSC libraries for smart cards
35 URL:=https://github.com/OpenSC/OpenSC/wiki
36 DEPENDS:=+libopenssl +libpthread
37 MENU:=1
38 endef
39
40 define Package/libopensc/description
41 OpenSC provides a set of libraries and utilities to work with smart cards.
42 Its main focus is on cards that support cryptographic operations, and
43 facilitate their use in security applications such as authentication,
44 mail encryption and digital signatures.
45 endef
46
47 define Package/libopensc-pkcs11
48 SECTION:=libs
49 CATEGORY:=Libraries
50 TITLE:=OpenSC - PKCS11 provider
51 URL:=https://github.com/OpenSC/OpenSC/wiki
52 DEPENDS:=libopensc
53 endef
54
55 define Package/libopensc-pkcs11/description
56 OpenSC PKCS#11 provider
57 endef
58
59 define Package/libpkcs11-spy
60 SECTION:=libs
61 CATEGORY:=Libraries
62 TITLE:=PKCS11 spying wrapper
63 URL:=https://github.com/OpenSC/OpenSC/wiki
64 DEPENDS:=+libopenssl +libpthread
65 endef
66
67 define Package/libpkcs11-spy/dscription
68 PKCS#11 spying wrapper
69 endef
70
71 define Package/opensc-utils
72 SECTION:=utils
73 CATEGORY:=Utilities
74 TITLE:=OpenSC - tools for smart cards
75 URL:=https://github.com/OpenSC/OpenSC/wiki
76 DEPENDS:=+libopensc
77 MENU:=1
78 endef
79
80 define Package/opensc-utils/description
81 OpenSC utilities
82 endef
83
84 define ToolGen
85 define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))
86 TITLE:=$(firstword $(subst :, ,$(1))) utility from opensc
87 URL:=https://github.com/OpenSC/OpenSC/wiki
88 SECTION:=utils
89 CATEGORY:=Utilities
90 DEPENDS:=opensc-utils $(wordlist 2,$(words $(subst :, ,$(1))),$(subst :, ,$(1)))
91 endef
92 endef
93
94 define ProfileGen
95 define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1))))
96 TITLE:=$(firstword $(subst :, ,$(1))) card profile for opensc
97 URL:=https://github.com/OpenSC/OpenSC/wiki
98 SECTION:=lib
99 CATEGORY:=Libraries
100 DEPENDS:=libopensc
101 endef
102 endef
103
104 TOOLS:= \
105 cardos-tool \
106 cryptoflex-tool \
107 dnie-tool \
108 eidenv \
109 iasecc-tool \
110 netkey-tool \
111 openpgp-tool \
112 opensc-tool \
113 opensc-explorer:+libncurses:+libreadline \
114 piv-tool \
115 pkcs11-tool \
116 pkcs15-crypt \
117 pkcs15-init \
118 pkcs15-tool \
119 sc-hsm-tool \
120 westcos-tool
121
122 PROFILES:= \
123 asepcos \
124 authentic \
125 cardos \
126 cyberflex \
127 entersafe \
128 epass2003 \
129 flex \
130 gpk \
131 ias_adele_admin1 \
132 ias_adele_admin2 \
133 ias_adele_common \
134 iasecc_admin_eid \
135 iasecc_generic_oberthur \
136 iasecc_generic_pki \
137 iasecc \
138 incrypto34 \
139 jcop \
140 miocos \
141 muscle \
142 myeid \
143 oberthur \
144 openpgp \
145 pkcs15 \
146 rutoken_ecp \
147 rutoken \
148 sc-hsm \
149 setcos \
150 starcos \
151 westcos
152
153 $(foreach file,$(TOOLS),$(eval $(call ToolGen,$(file))))
154 $(foreach file,$(PROFILES),$(eval $(call ProfileGen,$(file))))
155
156 define Build/InstallDev
157 $(INSTALL_DIR) $(1)/usr/lib
158 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.{a,so}* $(1)/usr/lib/
159 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.{a,so}* $(1)/usr/lib/
160 $(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/
161 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/
162 $(INSTALL_DIR) $(1)/usr/lib/pkcs11
163 $(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/
164 $(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/
165 $(INSTALL_DIR) $(1)/usr/share/opensc
166 $(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/
167 endef
168
169 define Package/libopensc/install
170 $(INSTALL_DIR) $(1)/usr/lib
171 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libopensc.so* $(1)/usr/lib/
172 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsmm-local.so* $(1)/usr/lib/
173 $(INSTALL_DIR) $(1)/etc
174 $(CP) $(PKG_INSTALL_DIR)/etc/opensc.conf $(1)/etc/
175 endef
176
177 define Package/libopensc-pkcs11/install
178 $(INSTALL_DIR) $(1)/usr/lib
179 $(CP) $(PKG_INSTALL_DIR)/usr/lib/opensc-pkcs11.so $(1)/usr/lib/
180 $(INSTALL_DIR) $(1)/usr/lib/pkcs11
181 $(LN) ../opensc-pkcs11.so $(1)/usr/lib/pkcs11/
182 endef
183
184 define Package/libpkcs11-spy/install
185 $(INSTALL_DIR) $(1)/usr/lib
186 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkcs11-spy.so $(1)/usr/lib/
187 $(INSTALL_DIR) $(1)/usr/lib/pkcs11
188 $(LN) ../pkcs11-spy.so $(1)/usr/lib/pkcs11/
189 endef
190
191 define Package/opensc-card-profiles
192 $(INSTALL_DIR) $(1)/usr/share/opensc
193 $(CP) $(PKG_INSTALL_DIR)/usr/share/opensc/* $(1)/usr/share/opensc/
194 endef
195
196 define Package/opensc-utils/install
197 true
198 endef
199
200 define ToolInstall
201 define Package/opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
202 $(INSTALL_DIR) $$(1)/usr/bin
203 $(INSTALL_BIN) \
204 $(PKG_INSTALL_DIR)/usr/bin/$(firstword $(subst :, ,$(1))) \
205 $$(1)/usr/bin/
206 endef
207 endef
208
209 define ProfileInstall
210 define Package/libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(1))))/install
211 $(INSTALL_DIR) $$(1)/usr/share/opensc
212 $(INSTALL_BIN) \
213 $(PKG_INSTALL_DIR)/usr/share/opensc/$(firstword $(subst :, ,$(1))).profile \
214 $$(1)/usr/share/opensc
215 endef
216 endef
217
218 $(foreach file,$(TOOLS),$(eval $(call ToolInstall,$(file))))
219 $(foreach file,$(PROFILES),$(eval $(call ProfileInstall,$(file))))
220
221 $(eval $(call BuildPackage,libopensc))
222 $(eval $(call BuildPackage,libopensc-pkcs11))
223 $(eval $(call BuildPackage,libpkcs11-spy))
224
225 $(eval $(call BuildPackage,opensc-utils))
226 $(foreach file,$(TOOLS),$(eval $(call BuildPackage,opensc-utils-$(subst _,-,$(firstword $(subst :, ,$(file)))))))
227 $(foreach file,$(PROFILES),$(eval $(call BuildPackage,libopensc-profile-$(subst _,-,$(firstword $(subst :, ,$(file)))))))