6fd73e3a48a89b3565d5b620105274e910bdbed0
[openwrt/openwrt.git] / package / utils / px5g / Makefile
1 #
2 # Copyright (C) 2010-2015 Jo-Philipp Wich <jo@mein.io>
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:=px5g
11 PKG_RELEASE:=4
12 PKG_LICENSE:=LGPL-2.1
13 PKG_BUILD_DIR:=$(BUILD_DIR)/px5g-$(BUILD_VARIANT)
14
15 PKG_USE_MIPS16:=0
16
17 PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/px5g-mbedtls
22 SECTION:=utils
23 CATEGORY:=Utilities
24 SUBMENU:=Encryption
25 TITLE:=X.509 certificate generator (using mbedtls)
26 DEPENDS:=+libmbedtls
27 PROVIDES:=px5g
28 VARIANT:=mbedtls
29 endef
30
31 define Package/px5g-mbedtls/description
32 Px5g is a tiny standalone X.509 certificate generator.
33 It suitable to create key files and certificates in DER
34 and PEM format for use with stunnel, uhttpd and others.
35 endef
36
37 define Package/px5g-standalone
38 SECTION:=utils
39 CATEGORY:=Utilities
40 SUBMENU:=Encryption
41 TITLE:=X.509 certificate generator (standalone)
42 VARIANT:=standalone
43 endef
44 Package/px5g-standalone/description = $(Package/px5g-mbedtls/description)
45
46 define Build/Prepare
47 mkdir -p $(PKG_BUILD_DIR)
48 endef
49
50 TARGET_LDFLAGS := -lmbedtls -lmbedx509 -lmbedcrypto
51
52 ifeq ($(BUILD_VARIANT),standalone)
53 TARGET_LDFLAGS := -Wl,-Bstatic $(TARGET_LDFLAGS) -Wl,-Bdynamic
54 endif
55
56 TARGET_CFLAGS += -Wl,--gc-sections
57
58 define Build/Compile
59 $(TARGET_CC) $(TARGET_CFLAGS) -o $(PKG_BUILD_DIR)/px5g px5g.c $(TARGET_LDFLAGS)
60 endef
61
62 define Package/px5g-mbedtls/install
63 $(INSTALL_DIR) $(1)/usr/sbin
64 $(INSTALL_BIN) $(PKG_BUILD_DIR)/px5g $(1)/usr/sbin/px5g
65 endef
66
67 Package/px5g-standalone/install = $(Package/px5g-mbedtls/install)
68
69 $(eval $(call BuildPackage,px5g-mbedtls))
70 $(eval $(call BuildPackage,px5g-standalone))