Skip to content

Commit 2e31b96

Browse files
ngie-eigncperciva
authored andcommitted
crypto/openssl: apply polish to new vendor import process
This change does the following 2 things: - Makes the build more repeatable by isolating the environment. This prevents bmake from leaking variables into gmake and makes the overall process a bit more robust. - Add debug printouts to make the process more straightforward to the reader and whoever is executing doing the current vendor import. Approved by: re (cperciva) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D52420 (cherry picked from commit d18058b) (cherry picked from commit 22382d9)
1 parent 8b1dd80 commit 2e31b96

File tree

1 file changed

+45
-28
lines changed

1 file changed

+45
-28
lines changed

crypto/openssl/BSDmakefile

Lines changed: 45 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ LCRYPTO_SRC= ${SRCTOP}/crypto/openssl
1212
LCRYPTO_DOC= ${LCRYPTO_SRC}/doc
1313

1414
CAT?= /bin/cat
15+
GMAKE?= gmake
1516
MV?= /bin/mv
1617
PERL?= perl
18+
SETENVI= /usr/bin/env -i
1719

1820
BN_CONF_H= include/crypto/bn_conf.h
1921
BN_CONF_H_ORIG= ${BN_CONF_H}.orig
@@ -23,8 +25,11 @@ CONFIGURATION_H_ORIG= ${CONFIGURATION_H}.orig
2325
.PHONY: configure patch all
2426
.ORDER: configure patch all
2527

28+
LOCALBASE= /usr/local
29+
WRK_ENV= PATH=${LOCALBASE}/bin:/bin:/usr/bin
30+
2631
configure:
27-
@cd ${.CURDIR} && \
32+
@(cd ${.CURDIR} && ${SETENVI} \
2833
${PERL} ./Configure \
2934
disable-aria \
3035
disable-egd \
@@ -37,34 +42,45 @@ configure:
3742
enable-ktls \
3843
enable-sctp \
3944
--openssldir=etc \
40-
--prefix=/usr
41-
@cd ${.CURDIR} && gmake configdata.pm
42-
@cd ${LCRYPTO_SRC} && ${PERL} \
43-
${LCRYPTO_SRC}/freebsd/dump_version_from_configdata.pl > \
44-
${SRCTOP}/secure/lib/libcrypto/Makefile.version
45+
--prefix=/usr)
46+
@echo "Building configdata.pm for later use."
47+
@(cd ${.CURDIR} && \
48+
${SETENVI} ${WRK_ENV} ${GMAKE} -j ${.MAKE.JOBS} configdata.pm)
4549

46-
all: patch
47-
# Passing `-j ${.MAKE.JOBS}` doesn't work here for some reason.
48-
@cd ${.CURDIR} && gmake build_all_generated
50+
@echo "Populating Makefile.version with release information"
51+
@(cd ${LCRYPTO_SRC} && ${SETENVI} ${WRK_ENV} ${PERL} \
52+
${LCRYPTO_SRC}/freebsd/dump_version_from_configdata.pl > \
53+
${SRCTOP}/secure/lib/libcrypto/Makefile.version)
4954

50-
# Clean the pkgconfig files:
51-
# 1. Fix --prefix (not sure why configure --prefix isn't honored properly).
55+
all: patch
56+
@echo "==> Building generated files (headers, manpages, etc)"
57+
@(cd ${.CURDIR} && \
58+
${SETENVI} ${WRK_ENV} ${GMAKE} -j ${.MAKE.JOBS} build_all_generated)
59+
60+
# 1. Fix --prefix.
61+
# a. Not sure why --prefix isn't honored properly, even though it's
62+
# passed to Configure; the files might be getting rebuilt
63+
# post-Configure, somehow.
5264
# 2. Remove duplicate path in CFLAGS.
5365
# 3. Remove duplicate path in includedir(s).
66+
@echo "==> Fixing pkgconfig files"
5467
@find . -name \*.pc -print -exec sed -i '' -E \
5568
-e 's,^prefix=.+,prefix=/usr,' \
5669
-e 's,[[:space:]]+(\-I)?\$\{prefix\}/\./include[[:space:]]*,,g' \
5770
{} +
5871

59-
@cd ${SRCTOP}/secure/lib/libcrypto && \
60-
${MAKE} cleanasm && \
61-
${MAKE} buildasm
72+
@echo "==> Cleaning / rebuilding ASM"
73+
@(cd ${SRCTOP}/secure/lib/libcrypto && \
74+
${SETENVI} ${WRK_ENV} ${MAKE} cleanasm && \
75+
${SETENVI} ${WRK_ENV} ${MAKE} buildasm)
6276

77+
@echo "==> Syncing manpages (section 1)"
6378
@rsync -a --delete \
6479
--exclude 'Makefile*' --exclude '*.1' \
6580
${LCRYPTO_DOC}/man/ \
6681
${SRCTOP}/secure/lib/libcrypto/man
6782

83+
@echo "==> Syncing manpages (sections {3,5,7})"
6884
@rsync -a --delete \
6985
--exclude 'Makefile*' --exclude '*.[357]' \
7086
${LCRYPTO_DOC}/man/man1/ \
@@ -75,25 +91,26 @@ all: patch
7591
# depending on the host architecture.
7692
patch: configure
7793
# Spam arch-specific overrides to config files.
94+
@echo "==> Patching headers"
95+
@(cd ${.CURDIR} && ${SETENVI} ${WRK_ENV} ${GMAKE} ${BN_CONF_H} && \
96+
${MV} ${BN_CONF_H} ${BN_CONF_H_ORIG} && \
97+
${CAT} ${BN_CONF_H}.orig \
98+
${LCRYPTO_SRC}/freebsd/${BN_CONF_H} >> \
99+
${BN_CONF_H})
78100

79-
@cd ${.CURDIR} && gmake ${BN_CONF_H} && \
80-
${MV} ${BN_CONF_H} ${BN_CONF_H_ORIG} && \
81-
${CAT} ${BN_CONF_H}.orig \
82-
${LCRYPTO_SRC}/freebsd/${BN_CONF_H} >> \
83-
${BN_CONF_H}
84-
85-
@cd ${.CURDIR} && \
86-
${MV} ${CONFIGURATION_H} ${CONFIGURATION_H_ORIG} && \
87-
${CAT} ${CONFIGURATION_H_ORIG} \
88-
${LCRYPTO_SRC}/freebsd/${CONFIGURATION_H} >> \
89-
${CONFIGURATION_H}
101+
@(cd ${.CURDIR} && \
102+
${MV} ${CONFIGURATION_H} ${CONFIGURATION_H_ORIG} && \
103+
${CAT} ${CONFIGURATION_H_ORIG} \
104+
${LCRYPTO_SRC}/freebsd/${CONFIGURATION_H} >> \
105+
${CONFIGURATION_H})
90106

91107

92108
clean: .PHONY
93-
@cd ${.CURDIR} && rm -f ${BN_CONF_H_ORIG} ${CONFIGURATION_H_ORIG}
109+
@(cd ${.CURDIR} && rm -f ${BN_CONF_H_ORIG} ${CONFIGURATION_H_ORIG})
94110

95-
@cd ${SRCTOP}/secure/lib/libcrypto && ${MAKE} cleanasm
111+
@(cd ${SRCTOP}/secure/lib/libcrypto && \
112+
${SETENVI} ${WRK_ENV} ${MAKE} cleanasm)
96113

97-
-@cd ${.CURDIR} && gmake ${.TARGET}
114+
-@(cd ${.CURDIR} && ${GMAKE} ${.TARGET})
98115

99116
.include <sys.mk>

0 commit comments

Comments
 (0)