Skip to content

Commit

Permalink
traditional make
Browse files Browse the repository at this point in the history
  • Loading branch information
goatgoose committed Jul 30, 2023
1 parent 02f9841 commit 2914950
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,11 @@ brew install cmake ninja go
# MacOS does not have a supported libcrypto preinstalled, but OpenSSL can be installed with brew
brew install openssl@3
# get the libcrypto install directory
openssl_dir=$(dirname $(dirname $(brew list openssl@3|grep libcrypto.dylib)))
# build s2n-tls
cmake . -Bbuild -GNinja \
-DCMAKE_PREFIX_PATH=$openssl_dir
ninja -C build
ninja -C build test
-DCMAKE_PREFIX_PATH=$(dirname $(dirname $(brew list openssl@3|grep libcrypto.dylib)))
ninja -C build -j $(sysctl -n hw.ncpu)
CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpu) ninja -C build test
```
</details>

Expand All @@ -46,14 +43,14 @@ ninja -C build test
```
</details>

s2n-tls can be configured with the following cmake options. Each option can be configured by passing a `-D<option>=<value>` flag to cmake.
s2n-tls can be configured with the following CMake options. Each option can be configured by passing a `-D<option>=<value>` flag to CMake.
- [**`CMAKE_INSTALL_PREFIX`**](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html): Specifies where the s2n-tls library and binary artifacts are placed when installing s2n-tls via `ninja -C build install`.
- [**`CMAKE_PREFIX_PATH`**](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html): Specifies install locations used by cmake to search for library dependencies. This option can be used to link s2n-tls to a specific libcrypto. See the [Using a specific libcrypto](#using-a-specific-libcrypto) section for more information on building with different libcryptos.
- [**`CMAKE_PREFIX_PATH`**](https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html): Specifies install locations used by CMake to search for library dependencies. This option can be used to link s2n-tls to a specific libcrypto. See the [Using a specific libcrypto](#using-a-specific-libcrypto) section for more information on building with different libcryptos.
- [**`CMAKE_BUILD_TYPE`**](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html): Sets the build type. Some of the possible build types are as follows:
- `Release`: Produce an optimized s2n-tls library artifact with no debug info. This option should be used when building s2n-tls for use in production.
- `Debug`: Produce an unoptimized library artifact with debug info. This option can be used when developing for or with s2n-tls. The debug symbols produced with this build can be used with GDB or to generate more informative stack traces.

The entire list of s2n-tls cmake options can be viewed with `cmake . -LH`.
The entire list of s2n-tls CMake options can be viewed with `cmake . -LH`.

## Building with a specific libcrypto

Expand Down Expand Up @@ -103,3 +100,28 @@ ninja -C build install
</details>

For more information on building AWS-LC, see the [Building AWS-LC documentation](https://github.com/aws/aws-lc/blob/main/BUILDING.md)

## Other build methods

### Non-ninja CMake

s2n-tls can be built via CMake without a dependency on Ninja:

<details open>
<summary>Ubuntu</summary>

```
cmake . -Bbuild \
-DCMAKE_PREFIX_PATH=$(dirname $(dirname $(brew list openssl@3|grep libcrypto.dylib)))
cmake --build build -j $(sysctl -n hw.ncpu)
CTEST_PARALLEL_LEVEL=$(sysctl -n hw.ncpu) ctest --test-dir build
```
</details>

### Traditional make

CMake is the preferred s2n-tls build system, and includes updated build features and supports the most platforms. However, building s2n-tls with a traditional Makefile is also supported. With make, the desired libcrypto install path must be set with the `LIBCRYPTO_ROOT` environment variable.

```
LIBCRYPTO_ROOT=/usr/local/ssl make
```

0 comments on commit 2914950

Please sign in to comment.