Skip to content

Commit

Permalink
Try to simplify build instruction.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RandomInEqualities committed May 25, 2024
1 parent ad6e77c commit 937a3d9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 60 deletions.
96 changes: 44 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ LibreSSL also supports the following Windows environments:

* Microsoft Windows (Windows 7 / Windows Server 2008r2 or later, x86 and x64)
* 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
OpenBSD mirror in directory
Expand All @@ -68,35 +68,36 @@ sent to the core team at [email protected].

# 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
from GitHub, follow these initial steps to prepare the source tree for
If you have checked out this source using Git, or have downloaded a source
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!
If you cannot follow these instructions (e.g. Windows system using CMake) or
cannot meet these prerequistes, please download an official release distribution
from https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official
If you cannot follow these instructions or cannot meet these prerequisites,
please download an official release distribution from
https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official
releases is strongly advised if you are not a developer._

1. Ensure you have the following packages installed:
automake, autoconf, git, libtool, perl
2. Run `./autogen.sh` to prepare the source tree for building or
run `./dist.sh` to prepare a tarball.
1. Ensure that you have a bash shell. This is also required on Windows.
2. Ensure that you have the following packages installed:
automake, autoconf, git, libtool, perl.
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
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:
Once you have the source tree prepared, run these commands to build and install:

```sh
./configure # see ./configure --help for configuration options
make check # runs builtin unit tests
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
mkdir build
Expand All @@ -106,7 +107,7 @@ make
make test
```

For faster builds, you can use Ninja as well:
For faster builds, you can use Ninja:

```sh
mkdir build-ninja
Expand All @@ -116,44 +117,15 @@ ninja
ninja test
```

### OS specific build information

#### 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
```

#### Windows - Mingw-w64

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:
Or another supported build system like Visual Studio:

```sh
./update.sh
mkdir build-vs2013
cd build-vs2013
cmake -G"Visual Studio 12 2013" ..
mkdir build-vs2022
cd build-vs2022
cmake -G"Visual Studio 17 2022" ..
```

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
#### Additional CMake Options

| Option Name | Default | Description |
|-------------------------|--------:|-----------------------------------------------------------------------------------------------------------------|
Expand All @@ -166,6 +138,26 @@ into other projects or build by itself.
| `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>``` |

## 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

## CMake
Expand Down
16 changes: 8 additions & 8 deletions README.mingw.md
Original file line number Diff line number Diff line change
@@ -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
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,
then LibreSSL should integrate very nicely. Old versions of the mingw-w64
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
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
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
troubles. Cygwin provides an easy method of installing the latest mingw-w64
cross compilers on Windows.
troubles. Cygwin provides an easy method of installing the latest MinGW-w64
cross-compilers on Windows.

To configure and build LibreSSL for a 32-bit system, use the following
build steps:
Expand Down Expand Up @@ -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.

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.

64-bit systems always have a 64-bit time_t and are not affected by this
Expand Down

0 comments on commit 937a3d9

Please sign in to comment.