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.

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