From 116fd23b0c2ace210b3882f9e18053a673bc8bcb Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Thu, 13 Apr 2023 14:25:13 +0100 Subject: [PATCH 1/5] tools: H3 tools build script. Add go+boringssl --- tools/build_h3_tools.sh | 49 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index 915d371c07b..81124d4d92f 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -167,7 +167,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 @@ -185,3 +185,50 @@ autoreconf -fi || autoreconf -fi LDFLAGS="${LDFLAGS}" ${MAKE} -j ${num_threads} sudo ${MAKE} install + +# boringssl +echo "Building boringssl..." + +# We need this go version. +GO_BASE_PATH=/usr/local +if [ ! -d ${GO_BASE_PATH} ]; then + sudo mkdir ${GO_BASE_PATH} +fi + +if [ `uname -m` = "arm64" ]; 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 ${GO_BASE_PATH}/go && sudo tar -C ${GO_BASE_PATH} -xf go1.20.1.${OS}-${ARCH}.tar.gz +rm go1.20.1.${OS}-${ARCH}.tar.gz + +GO_BINARY_PATH=${GO_BASE_PATH}/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 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 .. From 9228cf141492d332e51c0754985161d7bbfb2005 Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Wed, 19 Apr 2023 10:35:16 +0100 Subject: [PATCH 2/5] Include cargo/rust notes. --- tools/build_h3_tools.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index 81124d4d92f..3c057b383be 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -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 @@ -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 From b4c9c7e690a4ff0adc40576fd3cc31d243894f9a Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Wed, 26 Apr 2023 17:40:37 +0100 Subject: [PATCH 3/5] Fix the order of the deps build. boringssl should be done before quiche. quiche should use the boringssl folder to link. --- tools/build_h3_tools.sh | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index 3c057b383be..c8db21beb51 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -72,13 +72,59 @@ else num_threads=$(sysctl -n hw.logicalcpu) fi +# boringssl +echo "Building boringssl..." + +# We need this go version. +if [ ! -d ${BASE}/go ]; then + sudo mkdir ${BASE}/go +fi + +if [ `uname -m` = "arm64" ]; 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 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"} +if [ -z ${BASE+x} ]; then QUICHE_BASE="/opt/quiche"; else QUICHE_BASE=${BASE}/quiche; fi [ ! -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 sudo mkdir -p ${QUICHE_BASE}/lib/pkgconfig sudo mkdir -p ${QUICHE_BASE}/include sudo cp target/release/libquiche.a ${QUICHE_BASE}/lib/ @@ -189,50 +235,4 @@ autoreconf -fi || autoreconf -fi LDFLAGS="${LDFLAGS}" ${MAKE} -j ${num_threads} sudo ${MAKE} install - -# boringssl -echo "Building boringssl..." - -# We need this go version. -GO_BASE_PATH=/usr/local -if [ ! -d ${GO_BASE_PATH} ]; then - sudo mkdir ${GO_BASE_PATH} -fi - -if [ `uname -m` = "arm64" ]; 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 ${GO_BASE_PATH}/go && sudo tar -C ${GO_BASE_PATH} -xf go1.20.1.${OS}-${ARCH}.tar.gz -rm go1.20.1.${OS}-${ARCH}.tar.gz - -GO_BINARY_PATH=${GO_BASE_PATH}/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 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 .. From 585ef20f32a2b25309bae7d38c73533b35f012ee Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Thu, 27 Apr 2023 10:55:15 +0100 Subject: [PATCH 4/5] Small tweaks --- tools/build_h3_tools.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index c8db21beb51..4cdacc68155 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -77,10 +77,10 @@ echo "Building boringssl..." # We need this go version. if [ ! -d ${BASE}/go ]; then - sudo mkdir ${BASE}/go + sudo mkdir -p ${BASE}/go fi -if [ `uname -m` = "arm64" ]; then +if [ `uname -m` = "arm64" -o `uname -m` = "aarch64" ]; then ARCH="arm64" else ARCH="amd64" @@ -105,7 +105,7 @@ if [ ! -d boringssl ]; then fi cd boringssl if [ ! -d build ]; then - mkdir build + mkdir -p build fi cd build cmake \ @@ -121,7 +121,7 @@ cd .. # Build quiche # Steps borrowed from: https://github.com/apache/trafficserver-ci/blob/main/docker/rockylinux8/Dockerfile echo "Building quiche" -if [ -z ${BASE+x} ]; then QUICHE_BASE="/opt/quiche"; else QUICHE_BASE=${BASE}/quiche; fi +QUICHE_BASE="${BASE:-/opt}/quiche" [ ! -d quiche ] && git clone --recursive https://github.com/cloudflare/quiche.git cd quiche QUICHE_BSSL_PATH=${BASE}/boringssl QUICHE_BSSL_LINK_KIND=dylib cargo build -j4 --package quiche --release --features ffi,pkg-config-meta,qlog From 79146c45c1b15528661bc1c581459d170e88f9b1 Mon Sep 17 00:00:00 2001 From: Damian Meden Date: Thu, 27 Apr 2023 15:50:22 +0100 Subject: [PATCH 5/5] update openssl version and some other minor tweak --- tools/build_h3_tools.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/build_h3_tools.sh b/tools/build_h3_tools.sh index 4cdacc68155..622043323c3 100755 --- a/tools/build_h3_tools.sh +++ b/tools/build_h3_tools.sh @@ -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 @@ -76,9 +76,7 @@ fi echo "Building boringssl..." # We need this go version. -if [ ! -d ${BASE}/go ]; then - sudo mkdir -p ${BASE}/go -fi +sudo mkdir -p ${BASE}/go if [ `uname -m` = "arm64" -o `uname -m` = "aarch64" ]; then ARCH="arm64"