-
Notifications
You must be signed in to change notification settings - Fork 252
/
plan.sh
123 lines (110 loc) · 3.16 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
pkg_name=openssl
_distname="$pkg_name"
pkg_origin=core
pkg_version=1.0.2n
pkg_maintainer="The Habitat Maintainers <humans@habitat.sh>"
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="370babb75f278c39e0c50e8c4e7493bc0f18db6867478341a832a982fd15a8fe"
pkg_dirname="${_distname}-${pkg_version}"
pkg_deps=(
core/glibc
core/zlib
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
# Set CA dir to `$pkg_prefix/ssl` by default and use the cacerts from the
# `cacerts` package. Note that `patch(1)` is making backups because
# we need an original for the test suite.
sed -e "s,@prefix@,$pkg_prefix,g" \
-e "s,@cacerts_prefix@,$(pkg_path_for cacerts),g" \
"$PLAN_CONTEXT/ca-dir.patch" \
| patch -p1 --backup
# Purge the codebase (mostly tests) of the hardcoded reliance on `/bin/rm`.
grep -lr '/bin/rm' . | while read -r f; do
sed -e 's,/bin/rm,rm,g' -i "$f"
done
}
do_prepare() {
_common_prepare
export BUILD_CC=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
# shellcheck disable=SC2086
./config \
--prefix="${pkg_prefix}" \
--openssldir=ssl \
no-idea \
no-mdc2 \
no-rc5 \
zlib \
shared \
disable-gost \
$CFLAGS \
$LDFLAGS
env CC= make depend
make 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"
}
# ----------------------------------------------------------------------------
# **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