forked from omniosorg/omnios-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-3.sh
executable file
·148 lines (126 loc) · 4.12 KB
/
build-3.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/usr/bin/bash
#
# {{{ CDDL HEADER
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# }}}
#
# Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
# Copyright 2025 OmniOS Community Edition (OmniOSce) Association.
#
. ../../lib/build.sh
. common.sh
PROG=openssl
VER=3.3.3
PKG=library/security/openssl-3
SUMMARY="Cryptography and SSL/TLS Toolkit"
DESC="A toolkit for Secure Sockets Layer and Transport Layer protocols "
DESC+="and general purpose cryptographic library"
# Required for the testsuite - not yet in ooce/omnios-build-tools
BUILD_DEPENDS_IPS+=" ooce/file/lsof"
MAJVER=${VER%%.*}
XFORM_ARGS+="
-DMAJVER=$MAJVER
-DLIBVER=${VER%%.*}
-DLICENCEFILE=LICENSE.txt -DLICENCE=Apache2
"
set_builddir $PROG-$VER
set_patchdir patches-${VER%%.*}
# Generic options for all architectures
LDFLAGS[base]="-shared -Wl,-z,text,-z,aslr,-z,ignore"
declare -A OPENSSL_CONFIG_OPTS
OPENSSL_CONFIG_OPTS="shared threads zlib"
OPENSSL_CONFIG_OPTS+=" --prefix=$PREFIX"
# Build with support for the previous 1.1.1 API
OPENSSL_CONFIG_OPTS+=" --api=1.1.1"
# Configure options specific to a particular arch.
OPENSSL_CONFIG_OPTS[i386]="--libdir=$PREFIX/lib"
OPENSSL_CONFIG_OPTS[amd64]="--libdir=$PREFIX/lib/amd64"
OPENSSL_CONFIG_OPTS[amd64]+=" enable-ec_nistp_64_gcc_128"
OPENSSL_CONFIG_OPTS[aarch64]="--libdir=$PREFIX/lib"
OPENSSL_CONFIG_OPTS[aarch64]+=" --cross-compile-prefix=${TRIPLETS[aarch64]}-"
OPENSSL_CONFIG_OPTS[aarch64]+=" enable-ec_nistp_64_gcc_128"
OPENSSL_CONFIG_OPTS[aarch64]+=" no-asm"
typeset -A OPENSSL_PLATFORM=(
[i386]=solaris-x86-gcc
[amd64]=solaris64-x86_64-gcc
[aarch64]=solaris-aarch64-gcc
)
# The 'install' target installs html documentation too
MAKE_INSTALL_TARGET="install_sw install_ssldirs install_man_docs"
TESTSUITE_SED="
s/pid=[0-9]*/pid=/g
s/[0-9]* wallclock secs.*//
"
build_init() {
declare -g DUH=$DESTDIR$PREFIX/include/openssl/configuration.h
declare -Ag OPENSSL_CFLAGS
for arch in i386 amd64 aarch64; do
OPENSSL_CFLAGS[$arch]="$CFLAGS ${CFLAGS[$arch]}"
done
OPENSSL_CFLAGS[aarch64]+=" --sysroot=${SYSROOT[aarch64]}"
unset CFLAGS
}
configure_arch() {
typeset arch=${1:?arch}
SSLPLAT=${OPENSSL_PLATFORM[$arch]}
logmsg -n "--- Configure $arch ($SSLPLAT)"
export __CNF_CFLAGS="${OPENSSL_CFLAGS[$arch]}"
logcmd ./Configure $SSLPLAT \
${OPENSSL_CONFIG_OPTS} ${OPENSSL_CONFIG_OPTS[$arch]} \
|| logerr "Failed to run configure"
MAKE_ARGS_WS="
SHARED_LDFLAGS=\"${LDFLAGS[$arch]} ${LDFLAGS[base]}\"
LIB_LDFLAGS=\"${LDFLAGS[$arch]} ${LDFLAGS[base]}\"
"
}
# Preserve the opensslconf.h file from each build since there will be
# differences due to the architecture.
post_install() {
typeset arch=$1
logcmd cp ${DUH}{,.$1}
patch_pc $MAJVER $DESTDIR$PREFIX/lib || logerr "patch_pc failed"
[ $arch = amd64 ] || return
RUN_DEPENDS_IPS+=" library/security/oqs-provider"
logcmd $SED -i '
# Add "oqsprovider" to the list of providers in [provider_sect]
/^\[provider_sect\]/,/^$/ {
/^default *=/a\
oqsprovider = oqsprovider_sect
}
/^\[default_sect\]/,/^$/ {
# Activate [default_sect]
/# *activate/ {
s/# *//
# Add the new [oqsprovider_sect]
a\
\
[oqsprovider_sect]\
activate = 1
}
}
' $DESTDIR$PREFIX/ssl/$PROG.cnf \
|| logerr "activating oqsprovider failed"
}
build_fini() {
if [ -f ${DUH}.i386 -a -f ${DUH}.amd64 ]; then
logcmd -p diff -D __x86_64 ${DUH}.{i386,amd64} > $DUH
fi
}
init
download_source $PROG $PROG $VER
patch_source
prep_build
build
PATH=$OOCEBIN:$PATH run_testsuite test "" testsuite-${VER%%.*}.log
make_package
clean_up
# Vim hints
# vim:ts=4:sw=4:et:fdm=marker