This repository was archived by the owner on Aug 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplan.sh
132 lines (117 loc) · 3.48 KB
/
plan.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
pkg_name=openssl-musl
_distname="openssl"
pkg_origin=core
pkg_version="1.1.1j"
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_description="\
OpenSSL is an open source project that provides a robust, commercial-grade, \
and full-featured toolkit for the Transport Layer Security (TLS) and Secure \
Sockets Layer (SSL) protocols. It is also a general-purpose cryptography \
library.\
"
pkg_upstream_url="https://www.openssl.org"
pkg_license=('OpenSSL')
pkg_source="https://www.openssl.org/source/${_distname}-${pkg_version}.tar.gz"
pkg_shasum="aaf2fcb575cdf6491b98ab4829abf78a3dec8402b8b81efc8f23c00d443981bf"
pkg_dirname="${_distname}-${pkg_version}"
pkg_deps=(
core/musl
core/zlib-musl
core/cacerts
)
pkg_build_deps=(
core/coreutils
core/diffutils
core/patch
core/make
core/gcc
core/sed
core/grep
core/perl
)
pkg_bin_dirs=(bin)
pkg_include_dirs=(include)
pkg_lib_dirs=(lib)
pkg_pconfig_dirs=(lib/pkgconfig)
_common_prepare() {
do_default_prepare
# The openssl build process hard codes /bin/rm in many places. Unfortunately
# we cannot modify the contents of the build scripts to fix this or else we
# risk violating the sanctity of the official fips build process.
# Instead, we link rm to maintain integrity.
# Reference: https://www.openssl.org/docs/fips/UserGuide-2.0.pdf
if [[ ! -f "/bin/rm" ]]; then
hab pkg binlink core/coreutils rm --dest /bin
BINLINKED_RM=true
fi
}
do_prepare() {
PLAN_CONTEXT="$(abspath "$PLAN_CONTEXT")" _common_prepare
# dynamic_linker="$(pkg_path_for musl)/lib/ld-musl-x86_64.so.1"
dynamic_linker="$(pkg_path_for musl)/lib/libc.so"
LDFLAGS="$LDFLAGS -Wl,--dynamic-linker=$dynamic_linker"
export BUILD_CC=musl-gcc
build_line "Setting BUILD_CC=$BUILD_CC"
}
do_build() {
# Set PERL var for scripts in `do_check` that use Perl
PERL=$(pkg_path_for core/perl)/bin/perl
export PERL
"$(pkg_path_for core/perl)/bin/perl" ./Configure \
no-idea \
no-mdc2 \
no-rc5 \
no-comp \
no-zlib \
shared \
disable-gost \
--prefix="${pkg_prefix}" \
--openssldir=ssl \
linux-x86_64
make CC= depend
make --jobs="$(nproc)" CC="$BUILD_CC"
}
do_check() {
# Flip back to the original sources to satisfy the test suite, but keep the
# final version for packaging.
for f in apps/CA.pl.in apps/CA.sh apps/openssl.cnf; do
cp -fv $f ${f}.final
cp -fv ${f}.orig $f
done
make test
# Finally, restore the final sources to their original locations.
for f in apps/CA.pl.in apps/CA.sh apps/openssl.cnf; do
cp -fv ${f}.final $f
done
}
do_install() {
do_default_install
# Remove dependency on Perl at runtime
rm -rfv "$pkg_prefix/ssl/misc" "$pkg_prefix/bin/c_rehash"
}
do_end() {
do_default_end
# Clean up binlinked rm if we made it
if [[ $BINLINKED_RM == true ]]; then
rm -f /bin/rm
fi
}
# ----------------------------------------------------------------------------
# **NOTICE:** What follows are implementation details required for building a
# first-pass, "stage1" toolchain and environment. It is only used when running
# in a "stage1" Studio and can be safely ignored by almost everyone. Having
# said that, it performs a vital bootstrapping process and cannot be removed or
# significantly altered. Thank you!
# ----------------------------------------------------------------------------
if [[ "$STUDIO_TYPE" = "stage1" ]]; then
pkg_build_deps=(
core/gcc
core/coreutils
core/sed
core/grep
core/perl
core/diffutils
core/make
core/patch
)
fi