Try to simplify build instruction.

In particular simplify the Windows build instructions,
by only having a short CMake section about it. While
mentioning that bash shell is required also on Windows
up-front.

Splits the build section into a section for configure
and one for CMake so it is easier to pick one of them.
Moves the additional CMake options into the CMake section.
Moves dist.sh text into the configure section as it is
configure specific.
This commit is contained in:
Christian Andersen
2024-04-09 22:14:04 +02:00
parent ad6e77ca9f
commit 937a3d920e
2 changed files with 52 additions and 60 deletions

View File

@@ -49,7 +49,7 @@ LibreSSL also supports the following Windows environments:
* Microsoft Windows (Windows 7 / Windows Server 2008r2 or later, x86 and x64) * Microsoft Windows (Windows 7 / Windows Server 2008r2 or later, x86 and x64)
* Wine (32-bit and 64-bit) * Wine (32-bit and 64-bit)
* Mingw-w64, Cygwin, and Visual Studio * MinGW-w64, Cygwin, and Visual Studio
Official release tarballs are available at your friendly neighborhood Official release tarballs are available at your friendly neighborhood
OpenBSD mirror in directory OpenBSD mirror in directory
@@ -68,27 +68,24 @@ sent to the core team at libressl-security@openbsd.org.
# Building LibreSSL # Building LibreSSL
## Prerequisites when building from a Git checkout ## Building from a Git checkout
If you have checked this source using Git, or have downloaded a source tarball If you have checked out this source using Git, or have downloaded a source
from GitHub, follow these initial steps to prepare the source tree for tarball from GitHub, follow these initial steps to prepare the source tree for
building. _Note: Your build will fail if you do not follow these instructions! building. _Note: Your build will fail if you do not follow these instructions!
If you cannot follow these instructions (e.g. Windows system using CMake) or If you cannot follow these instructions or cannot meet these prerequisites,
cannot meet these prerequistes, please download an official release distribution please download an official release distribution from
from https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official
releases is strongly advised if you are not a developer._ releases is strongly advised if you are not a developer._
1. Ensure you have the following packages installed: 1. Ensure that you have a bash shell. This is also required on Windows.
automake, autoconf, git, libtool, perl 2. Ensure that you have the following packages installed:
2. Run `./autogen.sh` to prepare the source tree for building or automake, autoconf, git, libtool, perl.
run `./dist.sh` to prepare a tarball. 3. Run `./autogen.sh` to prepare the source tree for building.
## Steps that apply to all builds ## Build steps using configure
Once you have a source tree, either by downloaded using git and having Once you have the source tree prepared, run these commands to build and install:
run the `autogen.sh` script above, or by downloading a release distribution from
an OpenBSD mirror, run these commands to build and install the package on most
systems:
```sh ```sh
./configure # see ./configure --help for configuration options ./configure # see ./configure --help for configuration options
@@ -96,7 +93,11 @@ make check # runs builtin unit tests
make install # set DESTDIR= to install to an alternate location make install # set DESTDIR= to install to an alternate location
``` ```
If you wish to use the CMake build system, use these commands: Alternatively, it is possible to run `./dist.sh` to prepare a tarball.
## Build steps using CMake
Once you have the source tree prepared, run these commands to build and install:
```sh ```sh
mkdir build mkdir build
@@ -106,7 +107,7 @@ make
make test make test
``` ```
For faster builds, you can use Ninja as well: For faster builds, you can use Ninja:
```sh ```sh
mkdir build-ninja mkdir build-ninja
@@ -116,44 +117,15 @@ ninja
ninja test ninja test
``` ```
### OS specific build information Or another supported build system like Visual Studio:
#### HP-UX (11i)
Set the UNIX_STD environment variable to `2003` before running `configure`
in order to build with the HP C/aC++ compiler. See the "standards(5)" man
page for more details.
```sh ```sh
export UNIX_STD=2003 mkdir build-vs2022
./configure cd build-vs2022
make cmake -G"Visual Studio 17 2022" ..
``` ```
#### Windows - Mingw-w64 #### Additional CMake Options
LibreSSL builds against relatively recent versions of Mingw-w64, not to be
confused with the original mingw.org project. Mingw-w64 3.2 or later
should work. See README.mingw.md for more information.
#### Windows - Visual Studio
LibreSSL builds using the CMake target "Visual Studio 12 2013" and newer. To
generate a Visual Studio project, install CMake, enter the LibreSSL source
directory and run:
```sh
./update.sh
mkdir build-vs2013
cd build-vs2013
cmake -G"Visual Studio 12 2013" ..
```
Replace "Visual Studio 12 2013" with whatever version of Visual Studio you
have installed. This will generate a LibreSSL.sln file that you can incorporate
into other projects or build by itself.
#### CMake - Additional Options
| Option Name | Default | Description | | Option Name | Default | Description |
|-------------------------|--------:|-----------------------------------------------------------------------------------------------------------------| |-------------------------|--------:|-----------------------------------------------------------------------------------------------------------------|
@@ -166,6 +138,26 @@ into other projects or build by itself.
| `ENABLE_NC` | `OFF` | Enable installing TLS-enabled nc(1) | | `ENABLE_NC` | `OFF` | Enable installing TLS-enabled nc(1) |
| `OPENSSLDIR` | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` | | `OPENSSLDIR` | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` |
## Build information for specific systems
### HP-UX (11i)
Set the UNIX_STD environment variable to `2003` before running `configure`
in order to build with the HP C/aC++ compiler. See the "standards(5)" man
page for more details.
```sh
export UNIX_STD=2003
./configure
make
```
### MinGW-w64 - Windows
LibreSSL builds against relatively recent versions of [MinGW-w64](https://www.mingw-w64.org/), not to be
confused with the original mingw.org project. MinGW-w64 3.2 or later
should work. See [README.mingw.md](README.mingw.md) for more information.
# Using LibreSSL # Using LibreSSL
## CMake ## CMake

View File

@@ -1,13 +1,13 @@
## Building with mingw-w64 for 32- and 64-bit ## Building with MinGW-w64 for 32- and 64-bit
For Windows systems, LibreSSL supports the mingw-w64 toolchain, which can use For Windows systems, LibreSSL supports the MinGW-w64 toolchain, which can use
GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both GCC or Clang as the compiler. Contrary to its name, MinGW-w64 supports both
32-bit and 64-bit build environments. If your project already uses mingw-w64, 32-bit and 64-bit build environments. If your project already uses MinGW-w64,
then LibreSSL should integrate very nicely. Old versions of the mingw-w64 then LibreSSL should integrate very nicely. Old versions of the MinGW-w64
toolchain, such as the one packaged with Ubuntu 12.04, may have trouble toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
building LibreSSL. Please try it with a recent toolchain if you encounter building LibreSSL. Please try it with a recent toolchain if you encounter
troubles. Cygwin provides an easy method of installing the latest mingw-w64 troubles. Cygwin provides an easy method of installing the latest MinGW-w64
cross compilers on Windows. cross-compilers on Windows.
To configure and build LibreSSL for a 32-bit system, use the following To configure and build LibreSSL for a 32-bit system, use the following
build steps: build steps:
@@ -36,7 +36,7 @@ expiry date is set past 19 January 2038, it will be unable to tell if the
certificate has expired or not, and thus take the safe stance and reject it. certificate has expired or not, and thus take the safe stance and reject it.
In order to avoid this, you need to build LibreSSL (and everything that links In order to avoid this, you need to build LibreSSL (and everything that links
with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells mingw-w64 to with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells MinGW-w64 to
use the new ABI. use the new ABI.
64-bit systems always have a 64-bit time_t and are not affected by this 64-bit systems always have a 64-bit time_t and are not affected by this