Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 55 additions & 6 deletions tools/build_h3_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
set -e

# Update this as the draft we support updates.
OPENSSL_BRANCH=${OPENSSL_BRANCH:-"OpenSSL_1_1_1q+quic"}
OPENSSL_BRANCH=${OPENSSL_BRANCH:-"OpenSSL_1_1_1t+quic"}

# Set these, if desired, to change these to your preferred installation
# directory
Expand All @@ -43,7 +43,9 @@ if [ -e /etc/redhat-release ]; then
echo "| |"
echo "| sudo yum -y install libev-devel jemalloc-devel python2-devel |"
echo "| sudo yum -y install libxml2-devel c-ares-devel libevent-devel |"
echo "| sudo yum -y install jansson-devel zlib-devel systemd-devel |"
echo "| sudo yum -y install jansson-devel zlib-devel systemd-devel cargo |"
echo "| |"
echo "| Rust may be needed too, see https://rustup.rs for the details |"
echo "+-------------------------------------------------------------------------+"
echo
echo
Expand All @@ -53,7 +55,9 @@ elif [ -e /etc/debian_version ]; then
echo "| |"
echo "| sudo apt -y install libev-dev libjemalloc-dev python2-dev libxml2-dev |"
echo "| sudo apt -y install libpython2-dev libc-ares-dev libsystemd-dev |"
echo "| sudo apt -y install libevent-dev libjansson-dev zlib1g-dev |"
echo "| sudo apt -y install libevent-dev libjansson-dev zlib1g-dev cargo |"
echo "| |"
echo "| Rust may be needed too, see https://rustup.rs for the details |"
echo "+-------------------------------------------------------------------------+"
echo
echo
Expand All @@ -68,13 +72,57 @@ else
num_threads=$(sysctl -n hw.logicalcpu)
fi

# boringssl
echo "Building boringssl..."

# We need this go version.
sudo mkdir -p ${BASE}/go

if [ `uname -m` = "arm64" -o `uname -m` = "aarch64" ]; then
ARCH="arm64"
else
ARCH="amd64"
fi

if [ `uname -s` = "Darwin" ]; then
OS="darwin"
else
OS="linux"
fi

wget https://go.dev/dl/go1.20.1.${OS}-${ARCH}.tar.gz
sudo rm -rf ${BASE}/go && sudo tar -C ${BASE} -xf go1.20.1.${OS}-${ARCH}.tar.gz
rm go1.20.1.${OS}-${ARCH}.tar.gz

GO_BINARY_PATH=${BASE}/go/bin/go
if [ ! -d boringssl ]; then
git clone https://boringssl.googlesource.com/boringssl
cd boringssl
git checkout 31bad2514d21f6207f3925ba56754611c462a873
cd ..
fi
cd boringssl
if [ ! -d build ]; then
mkdir -p build
fi
cd build
cmake \
-DGO_EXECUTABLE=${GO_BINARY_PATH} \
-DCMAKE_INSTALL_PREFIX=${BASE}/boringssl \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=1 ../

${MAKE} -j ${num_threads}
sudo ${MAKE} install
cd ..

# Build quiche
# Steps borrowed from: https://github.com/apache/trafficserver-ci/blob/main/docker/rockylinux8/Dockerfile
echo "Building quiche"
QUICHE_BASE=${BASE:-"/opt/quiche"}
QUICHE_BASE="${BASE:-/opt}/quiche"
[ ! -d quiche ] && git clone --recursive https://github.com/cloudflare/quiche.git
cd quiche
cargo build -j4 --package quiche --release --features ffi,pkg-config-meta,qlog
QUICHE_BSSL_PATH=${BASE}/boringssl QUICHE_BSSL_LINK_KIND=dylib cargo build -j4 --package quiche --release --features ffi,pkg-config-meta,qlog
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use the libs from the boringssl we just built.

sudo mkdir -p ${QUICHE_BASE}/lib/pkgconfig
sudo mkdir -p ${QUICHE_BASE}/include
sudo cp target/release/libquiche.a ${QUICHE_BASE}/lib/
Expand Down Expand Up @@ -167,7 +215,7 @@ ${MAKE} -j ${num_threads}
sudo ${MAKE} install
cd ..

# And finally curl
# Then curl
echo "Building curl ..."
[ ! -d curl ] && git clone --branch curl-7_88_1 https://github.com/curl/curl.git
cd curl
Expand All @@ -185,3 +233,4 @@ autoreconf -fi || autoreconf -fi
LDFLAGS="${LDFLAGS}"
${MAKE} -j ${num_threads}
sudo ${MAKE} install
cd ..