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