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