net-snmp sun mods install: make sure destdirs exist
[unleashed-userland.git] / components / openindiana / ca-certificates / Makefile
blob911d03ee37f679087ae09e3af10bd427774ae975
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright 2016 Alexander Pyhalov
16 include ../../../make-rules/shared-macros.mk
18 COMPONENT_NAME= ca-certificates
20 COMPONENT_VERSION= 3.26
21 IPS_COMPONENT_VERSION= 1.0
22 COMPONENT_SUMMARY= Common CA certificates
23 COMPONENT_SRC= nss-$(COMPONENT_VERSION)
24 COMPONENT_ARCHIVE= $(COMPONENT_SRC).tar.gz
25 COMPONENT_ARCHIVE_HASH= \
26 sha256:91783a570ab953693eb977ce47c501f04c104cec287fa011c91bcc8970d1c564
27 COMPONENT_ARCHIVE_URL= \
28 https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_26_RTM/src/$(COMPONENT_ARCHIVE)
29 COMPONENT_PROJECT_URL = https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
31 include $(WS_MAKE_RULES)/prep.mk
32 include $(WS_MAKE_RULES)/ips.mk
34 PKG_OPTIONS+= -I $(COMPONENT_DIR)
36 CLEAN_PATHS += $(BUILD_DIR) $(PROTO_DIR)
38 $(BUILD_32): $(BUILD_DIR_32)/.certs_renamed
40 $(BUILD_DIR_32)/.certs_renamed: $(BUILD_DIR_32)/.certs_extracted
41 for i in $(BUILD_DIR_32)/xx*; do \
42 FILE_LEN=$$(wc -l "$$i" |awk ' { print $$1; }' ); \
43 BEGIN=$$(grep -n "BEGIN CERT" "$$i" |cut -d : -f 1); \
44 TAIL=$$(($$FILE_LEN-$$BEGIN+1)); \
45 NAME=$$(head -1 "$$i" | tr ' ' '_'); \
46 tail -n $$TAIL "$$i" > $(BUILD_DIR_32)/$${NAME}.pem ;\
47 done
48 $(TOUCH) $@
50 $(BUILD_DIR_32)/.certs_extracted: $(BUILD_DIR_32)/ca-bundle.processed
51 cd $(BUILD_DIR_32) &&\
52 NUM=$$(awk '/BEGIN/{n++} END{print n-2}' $(BUILD_DIR_32)/ca-bundle.processed) &&\
53 csplit -s -n 3 $(BUILD_DIR_32)/ca-bundle.processed '/END CERT/1' "{$$NUM}"
54 $(TOUCH) $@
56 $(BUILD_DIR_32)/ca-bundle.processed: $(BUILD_DIR_32)/ca-bundle.crt
57 grep -v '^#' $(BUILD_DIR_32)/ca-bundle.crt | grep -v '^$$' > $@
59 $(BUILD_DIR_32)/ca-bundle.crt: $(BUILD_DIR_32)/certdata.txt
60 cd $(BUILD_DIR_32) && $(PERL) $(COMPONENT_DIR)/mk-ca-bundle.pl -n
63 $(BUILD_DIR_32)/certdata.txt: $(SOURCE_DIR)/nss/lib/ckfw/builtins/certdata.txt
64 $(MKDIR) $(BUILD_DIR_32)
65 $(CP) $(SOURCE_DIR)/nss/lib/ckfw/builtins/certdata.txt $@
67 $(SOURCE_DIR)/nss/lib/ckfw/builtins/certdata.txt: $(SOURCE_DIR)/.prep
69 $(INSTALL_32): $(BUILD_32)
70 $(MKDIR) $(PROTO_DIR)/etc/certs/CA $(PROTO_DIR)/etc/openssl/certs
71 $(CP) $(BUILD_DIR_32)/ca-bundle.crt $(PROTO_DIR)/etc/certs/ca-certificates.crt
72 $(CP) $(BUILD_DIR_32)/*.pem $(PROTO_DIR)/etc/certs/CA/
73 cd $(PROTO_DIR)/etc/certs/CA &&\
74 for i in *.pem ; do \
75 HASH=$$(openssl x509 -noout -hash -in $$i); \
76 ln -fs ../../certs/CA/$${i} ../../openssl/certs/$${HASH}.0; \
77 done;
78 touch $@
80 build: $(BUILD_32)
82 install: $(INSTALL_32)
84 REQUIRED_PACKAGES += file/gnu-coreutils
85 REQUIRED_PACKAGES += library/security/openssl
86 REQUIRED_PACKAGES += runtime/perl-522
87 REQUIRED_PACKAGES += text/gawk
88 REQUIRED_PACKAGES += text/gnu-grep