You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

135 lines
4.2 KiB

  1. #
  2. # Copyright (C) 2019 Lucian Cristian <lucian.cristian@gmail.com>
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=uacme
  9. PKG_VERSION:=1.7.1
  10. PKG_RELEASE:=$(AUTORELEASE)
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://codeload.github.com/ndilieto/uacme/tar.gz/upstream/$(PKG_VERSION)?
  13. PKG_HASH:=36027a587256cbaa86650cec2a5b3eb000480e1150bd83941565661b392625ac
  14. PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
  15. PKG_LICENSE:=GPL-3.0-or-later
  16. PKG_LICENSE_FILES:=COPYING
  17. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-upstream-$(PKG_VERSION)
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. PKG_CONFIG_DEPENDS:= \
  21. CONFIG_LIBCURL_GNUTLS \
  22. CONFIG_LIBCURL_MBEDTLS \
  23. CONFIG_LIBCURL_OPENSSL \
  24. CONFIG_LIBCURL_WOLFSSL \
  25. CONFIG_LIBCURL_NOSSL \
  26. CONFIG_UACME_UALPN
  27. include $(INCLUDE_DIR)/package.mk
  28. define Package/uacme/Default
  29. SECTION:=net
  30. CATEGORY:=Network
  31. DEPENDS:=+uacme
  32. TITLE:=lightweight client for ACMEv2
  33. URL:=https://github.com/ndilieto/uacme
  34. endef
  35. define Package/uacme
  36. $(call Package/uacme/Default)
  37. SECTION:=net
  38. CATEGORY:=Network
  39. DEPENDS:=+libcurl +LIBCURL_WOLFSSL:libmbedtls
  40. TITLE:=lightweight client for ACMEv2
  41. Menu:=1
  42. endef
  43. define Package/uacme-ualpn
  44. $(call Package/uacme/Default)
  45. DEPENDS:=+uacme
  46. TITLE:=ualpn for uacme
  47. URL:=https://github.com/ndilieto/uacme
  48. endef
  49. define Package/uacme/Default/description
  50. lightweight client for the RFC8555 ACMEv2 protocol, written in plain C code
  51. with minimal dependencies (libcurl and one of GnuTLS, OpenSSL or mbedTLS).
  52. The ACMEv2 protocol allows a Certificate Authority (https://letsencrypt.org
  53. is a popular one) and an applicant to automate the process of verification
  54. and certificate issuance. The protocol also provides facilities for other
  55. certificate management functions, such as certificate revocation.
  56. endef
  57. define Package/uacme/config
  58. if PACKAGE_uacme && LIBCURL_WOLFSSL
  59. comment "libcurl uses WolfSSL; uacme will install mbedtls"
  60. comment "Choose another SSL lib in libcurl to avoid this"
  61. comment "ualpn will not be included, even selected"
  62. endif
  63. if PACKAGE_uacme && LIBCURL_NOSSL
  64. comment "libcurl is built without ssl; uacme needs ssl support"
  65. comment "Choose another SSL lib in libcurl to avoid this"
  66. comment "ualpn will not be included, even selected"
  67. endif
  68. if PACKAGE_uacme && LIBCURL_MBEDTLS
  69. comment "uacme will install mbedtls"
  70. comment "ualpn will not be included, even selected"
  71. endif
  72. endef
  73. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  74. CONFIGURE_ARGS+= \
  75. --disable-maintainer-mode \
  76. --disable-docs \
  77. $(if $(CONFIG_PACKAGE_uacme-ualpn),--with-ualpn,--without-ualpn) \
  78. $(if $(CONFIG_LIBCURL_GNUTLS),--with-gnutls --without-mbedtls --without-openssl,) \
  79. $(if $(CONFIG_LIBCURL_MBEDTLS),--without-gnutls --with-mbedtls --without-openssl --without-ualpn,) \
  80. $(if $(CONFIG_LIBCURL_OPENSSL),--without-gnutls --without-mbedtls --with-openssl,) \
  81. $(if $(CONFIG_LIBCURL_WOLFSSL),--without-gnutls --with-mbedtls --without-openssl --without-ualpn,)
  82. define Package/uacme/conffiles
  83. /etc/config/acme
  84. /etc/acme
  85. endef
  86. define Package/uacme/install
  87. $(INSTALL_DIR) \
  88. $(1)/usr/sbin \
  89. $(1)/etc/acme \
  90. $(1)/etc/config \
  91. $(1)/etc/init.d \
  92. $(1)/usr/share/uacme
  93. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/uacme $(1)/usr/sbin/uacme
  94. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/share/uacme/uacme.sh $(1)/usr/share/uacme/
  95. $(SED) '/^CHALLENGE_PATH=/d' $(1)/usr/share/uacme/uacme.sh
  96. $(INSTALL_CONF) ./files/acme.config $(1)/etc/config/acme
  97. $(INSTALL_BIN) ./files/run.sh $(1)/usr/share/uacme/run-uacme
  98. $(INSTALL_BIN) ./files/acme.init $(1)/etc/init.d/acme
  99. endef
  100. define Package/uacme-ualpn/install
  101. $(INSTALL_DIR) \
  102. $(1)/usr/sbin \
  103. $(1)/usr/share/uacme
  104. $(if $(CONFIG_LIBCURL_GNUTLS),$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ualpn $(1)/usr/sbin/ualpn; \
  105. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ualpn.sh $(1)/usr/share/uacme/,)
  106. $(if $(CONFIG_LIBCURL_OPENSSL),$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ualpn $(1)/usr/sbin/ualpn; \
  107. $(INSTALL_BIN) $(PKG_BUILD_DIR)/ualpn.sh $(1)/usr/share/uacme/,)
  108. endef
  109. define Package/uacme/prerm
  110. #!/bin/sh
  111. sed -i '/\/etc\/init\.d\/acme start/d' /etc/crontabs/root
  112. endef
  113. $(eval $(call BuildPackage,uacme))
  114. $(eval $(call BuildPackage,uacme-ualpn))