From ca9acfd18556bbcf3b4af50bf9129694ca1f6a02 Mon Sep 17 00:00:00 2001 From: Alex Ozdemir Date: Fri, 8 Jan 2021 23:53:18 -0800 Subject: [PATCH] Scripts for vendoring deps --- contrib/get-cryptopp.sh | 6 ++++++ contrib/get-hiredis.sh | 5 +++++ contrib/get-openssl.sh | 7 +++++++ contrib/get-protobuf.sh | 15 +++++++++++++++ contrib/hiredis-not-shared.patch | 13 +++++++++++++ fetch-deps.sh | 5 +++++ third_party/.gitignore | 5 +++++ 7 files changed, 56 insertions(+) create mode 100755 contrib/get-cryptopp.sh create mode 100755 contrib/get-hiredis.sh create mode 100755 contrib/get-openssl.sh create mode 100755 contrib/get-protobuf.sh create mode 100644 contrib/hiredis-not-shared.patch create mode 100755 fetch-deps.sh create mode 100644 third_party/.gitignore diff --git a/contrib/get-cryptopp.sh b/contrib/get-cryptopp.sh new file mode 100755 index 00000000..8e80977a --- /dev/null +++ b/contrib/get-cryptopp.sh @@ -0,0 +1,6 @@ +set -e +cd third_party +git clone --depth 1 -b CRYPTOPP_8_2_0 https://github.com/weidai11/cryptopp.git +cd cryptopp +make libcryptopp.a -j $(nproc) +make install -j $(nproc) PREFIX=../install diff --git a/contrib/get-hiredis.sh b/contrib/get-hiredis.sh new file mode 100755 index 00000000..c1d99f3f --- /dev/null +++ b/contrib/get-hiredis.sh @@ -0,0 +1,5 @@ +cd third_party +git clone --depth 1 -b v1.0.0 https://github.com/redis/hiredis.git +cd hiredis +git apply ../../contrib/hiredis-not-shared.patch + diff --git a/contrib/get-openssl.sh b/contrib/get-openssl.sh new file mode 100755 index 00000000..00d98f9d --- /dev/null +++ b/contrib/get-openssl.sh @@ -0,0 +1,7 @@ +set -e +cd third_party +git clone --depth 1 -b OpenSSL_1_1_1g https://github.com/openssl/openssl.git +cd openssl +./config --prefix=$(pwd)/../install +make -j $(nproc) +make install -j $(nproc) diff --git a/contrib/get-protobuf.sh b/contrib/get-protobuf.sh new file mode 100755 index 00000000..c06737fa --- /dev/null +++ b/contrib/get-protobuf.sh @@ -0,0 +1,15 @@ +set -xe +cd third_party +version=3.12.0 +if [[ -a protobuf-${version} ]]; then + echo "Protobuf already there" +else + wget https://github.com/protocolbuffers/protobuf/releases/download/v${version}/protobuf-cpp-${version}.tar.gz + tar xvf protobuf-cpp-${version}.tar.gz + rm protobuf-cpp-${version}.tar.gz + cd protobuf-${version} + ./autogen.sh + ./configure --prefix=$(pwd)/../install + make -j$(nproc) + make install +fi diff --git a/contrib/hiredis-not-shared.patch b/contrib/hiredis-not-shared.patch new file mode 100644 index 00000000..ad7d5697 --- /dev/null +++ b/contrib/hiredis-not-shared.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1beccc6..e073075 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,7 +40,7 @@ IF(WIN32) + ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN) + ENDIF() + +-ADD_LIBRARY(hiredis SHARED ${hiredis_sources}) ++ADD_LIBRARY(hiredis ${hiredis_sources}) + + SET_TARGET_PROPERTIES(hiredis + PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE diff --git a/fetch-deps.sh b/fetch-deps.sh new file mode 100755 index 00000000..60dd5e8f --- /dev/null +++ b/fetch-deps.sh @@ -0,0 +1,5 @@ +#!/bin/sh -ex +[[ -a third_party/openssl ]] || ./contrib/get-openssl.sh +[[ -a third_party/cryptopp ]] || ./contrib/get-cryptopp.sh +[[ -a third_party/hiredis ]] || ./contrib/get-hiredis.sh +[[ -a third_party/protobuf-3.12.0 ]] || ./contrib/get-protobuf.sh diff --git a/third_party/.gitignore b/third_party/.gitignore new file mode 100644 index 00000000..ef482ee1 --- /dev/null +++ b/third_party/.gitignore @@ -0,0 +1,5 @@ +install +protobuf* +openssl* +cryptopp* +hiredis*