diff --git a/BUILDING.md b/BUILDING.md index 7ac7f8e98..cfe228a49 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -62,6 +62,8 @@ cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ ninja ``` +You can also use the `rebuild_boringssl.sh` script (see below) to automate this process. + ##### Building on macOS. When building Conscrypt on macOS it will build libraries for both x86 and ARM, and so BoringSSL must also be build for each of these. @@ -90,6 +92,7 @@ cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ ninja ``` +You can also use the `rebuild_boringssl.sh` script (see below) to automate this process. ##### Building on Windows This assumes that you have Microsoft Visual Studio 2017 installed along @@ -117,6 +120,26 @@ ninja 32-bit mode is no longer supported. +If running `bash`, you can use the `rebuild_boringssl` script (see below) +to automate this process. + +##### rebuild_boringssl.sh script + +The script `scripts/rebuild_boringssl.sh` will build or rebuild BoringSSL +with the correct configuration for the current host architecture. + +When run with no arguments, the script assumes that `BORINGSSL_HOME` is set +correctly and will re-run `cmake` and `ninja` with the correct arguments. + +The following arguments can be used to modify its behaviour: + +* `--clone` May only be used if `BORINGSSL_HOME` is set but does not +yet exist. Will clone BoringSSL from Github and build it. + +* `--clean` Delete the current build directly and rebuild from scratch. +* `--pull` or `--update` Updates the source tree to the latest revision and +then builds. Note will not clean old builds unless `--clean` is also specified. + Coverage -------- To see coverage numbers, run the tests and then execute the jacocoTestReport rule diff --git a/scripts/rebuild_boringssl.sh b/scripts/rebuild_boringssl.sh new file mode 100755 index 000000000..1479aba1d --- /dev/null +++ b/scripts/rebuild_boringssl.sh @@ -0,0 +1,122 @@ +#! /bin/bash +# +# Copyright (C) 2025 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Rebuilds BoringSSL from scratch for supported architectures, +# optionally performing a `git pull` first to update it. + + +UPSTREAM="https://github.com/google/boringssl.git" +MAIN="main" + +fail() { + echo "*** FAILED: " $@ + exit 1 +} + +usage() { + cat <