Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 52b2506

Browse files
Merge pull request #7322 from livecodeian/prebuilts-openssl-1.1.1f
[[ OpenSSL ]] Update prebuilt OpenSSL library to version 1.1.1g
2 parents f1e673b + fd28a88 commit 52b2506

4 files changed

Lines changed: 46 additions & 28 deletions

File tree

prebuilt/scripts/android.inc

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,29 @@ if [ ! -z "${OBJCOPY}" ] ; then
6060
else
6161
# Attempt to set up the toolchain automatically
6262
if [ -z "${ANDROID_TOOLCHAIN}" ] ; then
63-
ANDROID_TOOLCHAIN="${HOME}/android/toolchain/${ANDROID_STANDALONE_TOOLCHAIN_DIRNAME}/bin/${ANDROID_TRIPLE}-"
64-
# OpenSSL requires this to be set when cross-compiling for Android
65-
export CROSS_SYSROOT="${HOME}/android/toolchain/${ANDROID_STANDALONE_TOOLCHAIN_DIRNAME}/sysroot"
63+
ANDROID_TOOLCHAIN_BASE="${HOME}/android/toolchain/${ANDROID_STANDALONE_TOOLCHAIN_DIRNAME}"
64+
ANDROID_TOOLCHAIN="${ANDROID_TOOLCHAIN_BASE}/bin/${ANDROID_TRIPLE}-"
6665
else
67-
# if not defined, derive CROSS_ROOT from ANDROID_TOOLCHAIN
68-
if [ -z "${CROSS_SYSROOT}" ] ; then
69-
export CROSS_SYSROOT="${ANDROID_TOOLCHAIN%/*/*}/sysroot"
70-
fi
66+
# derive ANDROID_TOOLCHAIN_BASE from ANDROID_TOOLCHAIN
67+
ANDROID_TOOLCHAIN_BASE="${ANDROID_TOOLCHAIN%/*/*}"
7168
fi
7269
7370
ANDROID_CC_NAME=${ANDROID_CC_NAME:-clang}
7471
ANDROID_CXX_NAME=${ANDROID_CXX_NAME:-clang++}
7572
76-
export ANDROID_CC="${ANDROID_TOOLCHAIN}${ANDROID_CC_NAME} ${ANDROID_TARGET_FLAGS}"
77-
export ANDROID_CXX="${ANDROID_TOOLCHAIN}${ANDROID_CXX_NAME} ${ANDROID_TARGET_FLAGS}"
78-
export ANDROID_LINK="${ANDROID_TOOLCHAIN}${ANDROID_CXX_NAME} ${ANDROID_TARGET_FLAGS}"
73+
export ANDROID_CC="${ANDROID_TOOLCHAIN}${ANDROID_CC_NAME}"
74+
export ANDROID_CFLAGS="${ANDROID_TARGET_FLAGS}"
75+
export ANDROID_CXX="${ANDROID_TOOLCHAIN}${ANDROID_CXX_NAME}"
76+
export ANDROID_CXXFLAGS="${ANDROID_TARGET_FLAGS}"
77+
export ANDROID_LINK="${ANDROID_TOOLCHAIN}${ANDROID_CXX_NAME}"
78+
export ANDROID_LDFLAGS="${ANDROID_TARGET_FLAGS}"
7979
export ANDROID_AR="${ANDROID_TOOLCHAIN}ar"
8080
export ANDROID_OBJCOPY="${ANDROID_TOOLCHAIN}objcopy"
8181
export ANDROID_RANLIB="${ANDROID_TOOLCHAIN}ranlib"
8282
export ANDROID_STRIP="${ANDROID_TOOLCHAIN}strip"
8383
84+
export ANDROID_TOOLCHAIN_BASE
85+
8486
# ICU needs to know the Android triple being targeted.
8587
export ANDROID_TRIPLE
8688
fi

prebuilt/scripts/build-openssl.sh

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ function buildOpenSSL {
3535
local ARCH=$2
3636
local SUBPLATFORM=$3
3737

38+
# Boolean flag: if non-zero then configure CC/LD/CFLAGS/LDFLAGS etc.
39+
local CONFIGURE_CC_FOR_TARGET=1
40+
3841
# Each target type in OpenSSL is given a name
3942
case "${PLATFORM}" in
4043
mac)
@@ -58,24 +61,29 @@ function buildOpenSSL {
5861
fi
5962
;;
6063
android)
64+
configureAndroidToolchain "${ARCH}"
65+
export ANDROID_NDK_HOME="${ANDROID_TOOLCHAIN_BASE}"
66+
export PATH="${ANDROID_NDK_HOME}/bin:${PATH}"
67+
CONFIGURE_CC_FOR_TARGET=0
68+
6169
if [ "${ARCH}" == "x86_64" ] ; then
62-
SPEC="android64"
70+
SPEC="android-x86_64"
6371
elif [[ "${ARCH}" =~ (x|i[3-6])86 ]] ; then
6472
# Work around a linker crash using the i686 gold linker in Android NDK r14
65-
EXTRA_CFLAGS="-fuse-ld=bfd"
73+
export CFLAGS="-fuse-ld=bfd"
6674
SPEC="android-x86"
6775
elif [ "${ARCH}" == "arm64" ] ; then
6876
# Clang's integrated assembler is a bit broken so we need to force the use of GAS instead
69-
EXTRA_CFLAGS="-fno-integrated-as"
70-
SPEC="android64-aarch64"
77+
export CFLAGS="-fno-integrated-as"
78+
SPEC="android-arm64"
7179
elif [[ "${ARCH}" =~ armv(6|7) ]] ; then
7280
# Clang's integrated assembler is a bit broken so we need to force the use of GAS instead
73-
EXTRA_CFLAGS="-fno-integrated-as -U__clang__"
81+
export CFLAGS="-fno-integrated-as"
7482

7583
# When compiling with -mthumb, we need to link to libatomic
7684
EXTRA_OPTIONS="-latomic"
7785

78-
SPEC="android-armeabi"
86+
SPEC="android-arm"
7987
elif [[ "${ARCH}" =~ .*64 ]] ; then
8088
SPEC="android64"
8189
else
@@ -100,20 +108,19 @@ function buildOpenSSL {
100108
local PLATFORM_NAME=${PLATFORM}
101109
fi
102110

103-
CUSTOM_SPEC="${SPEC}-livecode"
111+
# The android-* targets derive the arch from the last portion of the target name
112+
# so this needs to be a prefix instead of suffix.
113+
CUSTOM_SPEC="livecode_${SPEC}"
104114

105115
OPENSSL_ARCH_SRC="${OPENSSL_SRC}-${PLATFORM_NAME}-${ARCH}"
106-
OPENSSL_ARCH_CONFIG="no-rc5 no-hw shared -DOPENSSL_NO_ASYNC=1 --prefix=${INSTALL_DIR}/${NAME} ${CUSTOM_SPEC} ${EXTRA_OPTIONS}"
116+
OPENSSL_ARCH_CONFIG="no-rc5 no-hw no-threads shared -DOPENSSL_NO_ASYNC=1 --prefix=${INSTALL_DIR}/${NAME} ${CUSTOM_SPEC} ${EXTRA_OPTIONS}"
107117

108118
# Copy the source to a target-specific directory
109119
if [ ! -d "${OPENSSL_ARCH_SRC}" ] ; then
110120
echo "Duplicating OpenSSL source directory for ${NAME}"
111121
cp -r "${OPENSSL_SRC}" "${OPENSSL_ARCH_SRC}"
112122
fi
113123

114-
# Patch the main OpenSSL configuration script to remove a '-mandroid' flag that is incompatible with clang.
115-
sed -i.bak -e "s/-mandroid//g" "${OPENSSL_ARCH_SRC}/Configurations/10-main.conf"
116-
117124
# Get the command used to build a previous copy, if any
118125
if [ -e "${OPENSSL_ARCH_SRC}/config.cmd" ] ; then
119126
OPENSSL_ARCH_CURRENT_CONFIG=`cat ${OPENSSL_ARCH_SRC}/config.cmd`
@@ -127,17 +134,19 @@ function buildOpenSSL {
127134

128135
# Customise the OpenSSL configuration to ensure variables are exported as functions
129136
cat > Configurations/99-livecode.conf << EOF
130-
%targets = (
137+
my %targets = (
131138
"${CUSTOM_SPEC}" => {
132139
inherit_from => [ "${SPEC}" ],
133-
bn_ops => sub { join(" ",(@_,"EXPORT_VAR_AS_FN")) },
140+
bn_ops => add("EXPORT_VAR_AS_FN"),
134141
},
135142
);
136143
EOF
137144

145+
if [ $CONFIGURE_CC_FOR_TARGET != 0 ] ; then
146+
setCCForTarget "${PLATFORM}" "${ARCH}" "${SUBPLATFORM}"
147+
fi
148+
138149
echo "Configuring OpenSSL for ${NAME}"
139-
140-
setCCForTarget "${PLATFORM}" "${ARCH}" "${SUBPLATFORM}"
141150
./Configure ${OPENSSL_ARCH_CONFIG}
142151

143152
# iOS requires some tweaks to the source when building for devices

prebuilt/scripts/platform.inc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,18 @@ function setCCForTarget {
130130
;;
131131
android)
132132
configureAndroidToolchain ${ARCH}
133+
# if not defined, derive CROSS_ROOT from ANDROID_TOOLCHAIN_BASE
134+
if [ -z "${CROSS_SYSROOT}" ] ; then
135+
export CROSS_SYSROOT="${ANDROID_TOOLCHAIN_BASE}/sysroot"
136+
fi
133137

134-
CC="${ANDROID_CC} ${EXTRA_CFLAGS}"
135-
CXX="${ANDROID_CXX} ${EXTRA_CXXFLAGS}"
138+
CC="${ANDROID_CC}"
139+
CFLAGS="${ANDROID_CFLAGS} ${EXTRA_CFLAGS}"
140+
CXX="${ANDROID_CXX}"
141+
CXXFLAGS="${ANDROID_CXXFLAGS} ${EXTRA_CXXFLAGS}"
136142
LINK="${ANDROID_LINK}"
137143
LD="${LINK}"
144+
LDFLAGS="${ANDROID_LDFLAGS}"
138145
AR="${ANDROID_AR}"
139146
OBJCOPY="${ANDROID_OBJCOPY}"
140147
RANLIB="${ANDROID_RANLIB}"

prebuilt/versions/openssl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0g
1+
1.1.1g

0 commit comments

Comments
 (0)