forked from aws/aws-lambda-python-runtime-interface-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreinstall.sh
executable file
·54 lines (46 loc) · 1.47 KB
/
preinstall.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
#!/bin/sh
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
set -e
ARTIFACTS_DIR=$(pwd)/deps/artifacts
if [ "$(uname)" = "Darwin" ]; then
echo "aws-lambda-cpp does not build on OS X. Skipping the preinstall step."
else
if [ -x "$(command -v cmake3)" ]; then
CMAKE=cmake3
elif [ -x "$(command -v cmake)" ]; then
CMAKE=cmake
else
echo 'Error: cmake is not installed.' >&2
exit 1
fi
cd deps
. ./versions
rm -rf ./curl-$CURL_VERSION
rm -rf ./aws-lambda-cpp-$AWS_LAMBDA_CPP_RELEASE
# unpack dependencies
tar xzf ./curl-$CURL_VERSION.tar.gz --no-same-owner && \
tar xzf ./aws-lambda-cpp-$AWS_LAMBDA_CPP_RELEASE.tar.gz --no-same-owner
(
# Build Curl
cd curl-$CURL_VERSION && \
./buildconf && \
./configure \
--prefix "$ARTIFACTS_DIR" \
--disable-shared \
--without-ssl \
--without-zlib && \
make && \
make install
)
(
# Build aws-lambda-cpp
mkdir -p ./aws-lambda-cpp-$AWS_LAMBDA_CPP_RELEASE/build && \
cd ./aws-lambda-cpp-$AWS_LAMBDA_CPP_RELEASE/build
$CMAKE .. \
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_INSTALL_PREFIX="$ARTIFACTS_DIR" \
-DENABLE_LTO=$ENABLE_LTO \
-DCMAKE_MODULE_PATH="$ARTIFACTS_DIR"/lib/pkgconfig && \
make && make install
)
fi