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.

142 lines
4.4 KiB

  1. #
  2. # Copyright (C) 2019 Lucian Cristian
  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:=nss
  9. PKG_VERSION:=3.44.1
  10. PKG_RELEASE:=1
  11. PKG_MAINTAINER:=Lucian Cristian <lucian.cristian@gmail.com>
  12. PKG_LICENCE:=MPL-2.0
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:= \
  15. https://download.cdn.mozilla.net/pub/security/$(PKG_NAME)/releases/NSS_$(subst .,_,$(PKG_VERSION))_RTM/src \
  16. https://archive.mozilla.org/pub/security/$(PKG_NAME)/releases/NSS_$(subst .,_,$(PKG_VERSION))_RTM/src
  17. PKG_HASH:=fce4cb80c989cde35416ecbe55920856015a35151c4f21be64470e4dd4de12f8
  18. PKG_BUILD_PARALLEL:=0
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/libnss
  21. SECTION:=libs
  22. SUBMENU:=SSL
  23. CATEGORY:=Libraries
  24. TITLE:=Mozilla's SSL and TLS implementation
  25. URL:=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
  26. DEPENDS:=+libpthread +libsqlite3 +nspr
  27. endef
  28. define Package/nss-utils
  29. SECTION:=utils
  30. CATEGORY:=Utilities
  31. TITLE:=Utilities for Mozilla's SSL and TLS implementation
  32. URL:=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
  33. DEPENDS:=+libnss
  34. endef
  35. define Package/libnss/description
  36. Network Security Services (NSS) is a set of libraries designed to support
  37. cross-platform development of security-enabled client and server applications.
  38. Applications built with NSS can support SSL v2 and v3, TLS, PKCS 5, PKCS 7,
  39. PKCS 11, PKCS 12, S/MIME, X.509 v3 certificates, and other security standards.
  40. endef
  41. CONFIGURE_PATH = ./nss
  42. MAKE_PATH = ./nss
  43. LBITS = $(shell $(TARGET_CC) -dM -E - </dev/null | grep -q "__LP64__" && echo 64 || echo 32)
  44. ifeq ($(LBITS),64)
  45. export USE_64=1
  46. endif
  47. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  48. export CROSS_COMPILE=1
  49. export BUILD_OPT=1
  50. export NATIVE_CC=$(HOSTCC)
  51. export NATIVE_FLAGS=$(HOST_CFLAGS)
  52. export NSDISTMODE=copy
  53. export NSS_ENABLE_WERROR=0
  54. export NSS_DISABLE_GTESTS=1
  55. export NSS_USE_SYSTEM_SQLITE=1
  56. export OS_TARGET=Linux
  57. export OS_ARCH=Linux
  58. export OS_TEST=$(ARCH)
  59. export CPU_ARCH=$(ARCH)
  60. export fpic=$(FPIC)
  61. export NSPR_INCLUDE_DIR=$(STAGING_DIR)/usr/include/nspr
  62. export SEED_ONLY_DEV_URANDOM=1
  63. export OS_REL_CFLAGS=$(TARGET_CFLAGS)
  64. export NS_USE_GCC=1
  65. export FREEBL_NO_DEPEND=1
  66. #size optimisation, seems to not impact speed
  67. export NSS_DISABLE_DBM=1
  68. export NSS_PKIX_NO_LDAP=1
  69. export ALLOW_OPT_CODE_SIZE=1
  70. export OPT_CODE_SIZE=1
  71. #native compile nsinstall
  72. define Build/Prepare
  73. $(call Build/Prepare/Default)
  74. USE_NATIVE=1 OS_REL_CFLAGS="$(HOST_CFLAGS)" LDFLAGS="$(HOST_LDFLAGS)" CC="$(HOSTCC)" \
  75. $(MAKE) -C $(PKG_BUILD_DIR)/nss/coreconf/nsinstall
  76. # $(if $(CONFIG_LIBC_USE_GLIBC),, \
  77. # $(SED) '/-DHAVE_SYS_CDEFS_H/d' $(PKG_BUILD_DIR)/nss/lib/dbm/config/config.mk)
  78. endef
  79. define Package/libnss/conffiles
  80. /etc/pki/nssdb
  81. endef
  82. define Build/InstallDev
  83. $(INSTALL_DIR) \
  84. $(1)/usr/include/nss \
  85. $(1)/usr/lib \
  86. $(1)/usr/lib/pkgconfig
  87. $(CP) $(PKG_BUILD_DIR)/dist/private/nss/*.h \
  88. $(1)/usr/include/nss/
  89. $(CP) $(PKG_BUILD_DIR)/dist/public/nss/*.h \
  90. $(1)/usr/include/nss/
  91. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/*.so \
  92. $(1)/usr/lib/
  93. $(CP) $(PKG_BUILD_DIR)/nss/config/*.pc \
  94. $(1)/usr/lib/pkgconfig/
  95. endef
  96. define Package/nss-utils/install
  97. $(INSTALL_DIR) \
  98. $(1)/usr/bin
  99. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/bin/certutil $(1)/usr/bin
  100. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/bin/pk12util $(1)/usr/bin
  101. endef
  102. #for now pack only libreswan needed libs
  103. define Package/libnss/install
  104. $(INSTALL_DIR) \
  105. $(1)/usr/lib \
  106. $(1)/etc/pki/nssdb \
  107. $(1)/etc/ipsec.d
  108. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libfreebl3.so $(1)/usr/lib/
  109. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libnss3.so $(1)/usr/lib/
  110. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libnssutil3.so $(1)/usr/lib/
  111. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libsmime3.so $(1)/usr/lib/
  112. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libsoftokn3.so $(1)/usr/lib/
  113. $(CP) $(PKG_BUILD_DIR)/dist/build_dir/lib/libssl3.so $(1)/usr/lib/
  114. # Pprovide databases with a blank certificate
  115. $(CP) ./files/blank-cert9.db $(1)/etc/pki/nssdb/cert9.db
  116. $(CP) ./files/blank-key4.db $(1)/etc/pki/nssdb/key4.db
  117. $(CP) ./files/system-pkcs11.txt $(1)/etc/pki/nssdb/pkcs11.txt
  118. ln -s /etc/pki/nssdb/cert9.db $(1)/etc/ipsec.d/cert9.db
  119. ln -s /etc/pki/nssdb/key4.db $(1)/etc/ipsec.d/key4.db
  120. ln -s /etc/pki/nssdb/pkcs11.txt $(1)/etc/ipsec.d/pkcs11.txt
  121. endef
  122. $(eval $(call BuildPackage,nss-utils))
  123. $(eval $(call BuildPackage,libnss))