Skip to content

Commit

Permalink
ci: use clang to build awslc (aws#4794)
Browse files Browse the repository at this point in the history
  • Loading branch information
dougch authored Oct 1, 2024
1 parent 5f6bb25 commit 7c584e0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
23 changes: 17 additions & 6 deletions codebuild/bin/install_awslc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

set -e
set -eu
pushd "$(pwd)"

usage() {
Expand All @@ -28,7 +28,10 @@ BUILD_DIR=$1
INSTALL_DIR=$2
IS_FIPS=$3

source codebuild/bin/jobs.sh
if [[ ! -f "$(which clang)" ]]; then
echo "Could not find clang"
exit 1
fi

# These tags represents the latest versions that S2N is compatible
# with. It prevents our build system from breaking when AWS-LC
Expand All @@ -46,10 +49,18 @@ echo "Checking out tag=$AWSLC_VERSION"
git clone https://github.com/awslabs/aws-lc.git --branch "$AWSLC_VERSION" --depth 1

install_awslc() {
echo "Building with shared library=$1"
cmake ./aws-lc -Bbuild -GNinja -DBUILD_SHARED_LIBS=$1 -DCMAKE_BUILD_TYPE=relwithdebinfo -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" -DFIPS="${IS_FIPS}"
ninja -j "${JOBS}" -C build install
ninja -C build clean
echo "Building with shared library=$1"
cmake ./aws-lc \
-Bbuild \
-GNinja \
-DBUILD_SHARED_LIBS=$1 \
-DCMAKE_BUILD_TYPE=relwithdebinfo \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DFIPS="${IS_FIPS}"
ninja -j "$(nproc)" -C build install
ninja -C build clean
}

if [ "$IS_FIPS" != "1" ]; then
Expand Down
19 changes: 15 additions & 4 deletions codebuild/bin/install_awslc_fips_2022.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

set -e
set -eu
pushd "$(pwd)"

usage() {
Expand All @@ -27,7 +27,10 @@ fi
BUILD_DIR=$1
INSTALL_DIR=$2

source codebuild/bin/jobs.sh
if [[ ! -f "$(which clang)" ]]; then
echo "Could not find clang"
exit 1
fi

# There are currently no AWSLC release tags for the 2022 FIPS branch. The
# following is the latest commit in this branch as of 8/19/24:
Expand All @@ -42,8 +45,16 @@ git checkout "${AWSLC_VERSION}"

build() {
shared=$1
cmake . -Bbuild -GNinja -DBUILD_SHARED_LIBS="${shared}" -DCMAKE_BUILD_TYPE=relwithdebinfo -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" -DFIPS=1
ninja -j "${JOBS}" -C build install
cmake . \
-Bbuild \
-GNinja \
-DBUILD_SHARED_LIBS="${shared}" \
-DCMAKE_BUILD_TYPE=relwithdebinfo \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DCMAKE_C_COMPILER=$(which clang) \
-DCMAKE_CXX_COMPILER=$(which clang++) \
-DFIPS=1
ninja -j "$(nproc)" -C build install
ninja -C build clean
}

Expand Down

0 comments on commit 7c584e0

Please sign in to comment.