aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am2
-rw-r--r--README.md96
-rw-r--r--README.mingw.md (renamed from README.windows)40
-rwxr-xr-xdist-win.sh48
-rw-r--r--m4/check-os-options.m42
5 files changed, 55 insertions, 133 deletions
diff --git a/Makefile.am b/Makefile.am
index 2edef0d..3f62cd9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,7 @@ if !ENABLE_LIBTLS_ONLY
10pkgconfig_DATA += libcrypto.pc libssl.pc openssl.pc 10pkgconfig_DATA += libcrypto.pc libssl.pc openssl.pc
11endif 11endif
12 12
13EXTRA_DIST = README.md README.windows VERSION config scripts 13EXTRA_DIST = README.md README.mingw.md VERSION config scripts
14EXTRA_DIST += CMakeLists.txt cmake_export_symbol.cmake cmake_uninstall.cmake.in FindLibreSSL.cmake LibreSSLConfig.cmake.in 14EXTRA_DIST += CMakeLists.txt cmake_export_symbol.cmake cmake_uninstall.cmake.in FindLibreSSL.cmake LibreSSLConfig.cmake.in
15EXTRA_DIST += cert.pem openssl.cnf x509v3.cnf 15EXTRA_DIST += cert.pem openssl.cnf x509v3.cnf
16 16
diff --git a/README.md b/README.md
index ab159ab..b4fff87 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ LibreSSL also supports the following Windows environments:
49 49
50* Microsoft Windows (Windows 7 / Windows Server 2008r2 or later, x86 and x64) 50* Microsoft Windows (Windows 7 / Windows Server 2008r2 or later, x86 and x64)
51* Wine (32-bit and 64-bit) 51* Wine (32-bit and 64-bit)
52* Mingw-w64, Cygwin, and Visual Studio 52* MinGW-w64, Cygwin, and Visual Studio
53 53
54Official release tarballs are available at your friendly neighborhood 54Official release tarballs are available at your friendly neighborhood
55OpenBSD mirror in directory 55OpenBSD mirror in directory
@@ -68,27 +68,24 @@ sent to the core team at libressl-security@openbsd.org.
68 68
69# Building LibreSSL 69# Building LibreSSL
70 70
71## Prerequisites when building from a Git checkout 71## Building from a Git checkout
72 72
73If you have checked this source using Git, or have downloaded a source tarball 73If you have checked out this source using Git, or have downloaded a source
74from GitHub, follow these initial steps to prepare the source tree for 74tarball from GitHub, follow these initial steps to prepare the source tree for
75building. _Note: Your build will fail if you do not follow these instructions! 75building. _Note: Your build will fail if you do not follow these instructions!
76If you cannot follow these instructions (e.g. Windows system using CMake) or 76If you cannot follow these instructions or cannot meet these prerequisites,
77cannot meet these prerequistes, please download an official release distribution 77please download an official release distribution from
78from https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official 78https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ instead. Using official
79releases is strongly advised if you are not a developer._ 79releases is strongly advised if you are not a developer._
80 80
811. Ensure you have the following packages installed: 811. Ensure that you have a bash shell. This is also required on Windows.
82 automake, autoconf, git, libtool, perl 822. Ensure that you have the following packages installed:
832. Run `./autogen.sh` to prepare the source tree for building or 83 automake, autoconf, git, libtool, perl.
84 run `./dist.sh` to prepare a tarball. 843. Run `./autogen.sh` to prepare the source tree for building.
85 85
86## Steps that apply to all builds 86## Build steps using configure
87 87
88Once you have a source tree, either by downloaded using git and having 88Once you have the source tree prepared, run these commands to build and install:
89run the `autogen.sh` script above, or by downloading a release distribution from
90an OpenBSD mirror, run these commands to build and install the package on most
91systems:
92 89
93```sh 90```sh
94./configure # see ./configure --help for configuration options 91./configure # see ./configure --help for configuration options
@@ -96,7 +93,11 @@ make check # runs builtin unit tests
96make install # set DESTDIR= to install to an alternate location 93make install # set DESTDIR= to install to an alternate location
97``` 94```
98 95
99If you wish to use the CMake build system, use these commands: 96Alternatively, it is possible to run `./dist.sh` to prepare a tarball.
97
98## Build steps using CMake
99
100Once you have the source tree prepared, run these commands to build and install:
100 101
101```sh 102```sh
102mkdir build 103mkdir build
@@ -106,7 +107,7 @@ make
106make test 107make test
107``` 108```
108 109
109For faster builds, you can use Ninja as well: 110For faster builds, you can use Ninja:
110 111
111```sh 112```sh
112mkdir build-ninja 113mkdir build-ninja
@@ -116,44 +117,15 @@ ninja
116ninja test 117ninja test
117``` 118```
118 119
119### OS specific build information 120Or another supported build system like Visual Studio:
120
121#### HP-UX (11i)
122
123Set the UNIX_STD environment variable to `2003` before running `configure`
124in order to build with the HP C/aC++ compiler. See the "standards(5)" man
125page for more details.
126
127```sh
128export UNIX_STD=2003
129./configure
130make
131```
132
133#### Windows - Mingw-w64
134
135LibreSSL builds against relatively recent versions of Mingw-w64, not to be
136confused with the original mingw.org project. Mingw-w64 3.2 or later
137should work. See README.windows for more information
138
139#### Windows - Visual Studio
140
141LibreSSL builds using the CMake target "Visual Studio 12 2013" and newer. To
142generate a Visual Studio project, install CMake, enter the LibreSSL source
143directory and run:
144 121
145```sh 122```sh
146./update.sh 123mkdir build-vs2022
147mkdir build-vs2013 124cd build-vs2022
148cd build-vs2013 125cmake -G"Visual Studio 17 2022" ..
149cmake -G"Visual Studio 12 2013" ..
150``` 126```
151 127
152Replace "Visual Studio 12 2013" with whatever version of Visual Studio you 128#### Additional CMake Options
153have installed. This will generate a LibreSSL.sln file that you can incorporate
154into other projects or build by itself.
155
156#### CMake - Additional Options
157 129
158| Option Name | Default | Description | 130| Option Name | Default | Description |
159|-------------------------|--------:|-----------------------------------------------------------------------------------------------------------------| 131|-------------------------|--------:|-----------------------------------------------------------------------------------------------------------------|
@@ -166,6 +138,26 @@ into other projects or build by itself.
166| `ENABLE_NC` | `OFF` | Enable installing TLS-enabled nc(1) | 138| `ENABLE_NC` | `OFF` | Enable installing TLS-enabled nc(1) |
167| `OPENSSLDIR` | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` | 139| `OPENSSLDIR` | Blank | Set the default openssl directory. Can be specified from command line using <br>```-DOPENSSLDIR=<dirname>``` |
168 140
141## Build information for specific systems
142
143### HP-UX (11i)
144
145Set the UNIX_STD environment variable to `2003` before running `configure`
146in order to build with the HP C/aC++ compiler. See the "standards(5)" man
147page for more details.
148
149```sh
150export UNIX_STD=2003
151./configure
152make
153```
154
155### MinGW-w64 - Windows
156
157LibreSSL builds against relatively recent versions of [MinGW-w64](https://www.mingw-w64.org/), not to be
158confused with the original mingw.org project. MinGW-w64 3.2 or later
159should work. See [README.mingw.md](README.mingw.md) for more information.
160
169# Using LibreSSL 161# Using LibreSSL
170 162
171## CMake 163## CMake
diff --git a/README.windows b/README.mingw.md
index 4d74a2e..a90de5f 100644
--- a/README.windows
+++ b/README.mingw.md
@@ -1,13 +1,13 @@
1# Building 1## Building with MinGW-w64 for 32- and 64-bit
2 2
3For Windows systems, LibreSSL supports the mingw-w64 toolchain, which can use 3For Windows systems, LibreSSL supports the MinGW-w64 toolchain, which can use
4GCC or Clang as the compiler. Contrary to its name, mingw-w64 supports both 4GCC or Clang as the compiler. Contrary to its name, MinGW-w64 supports both
532-bit and 64-bit build environments. If your project already uses mingw-w64, 532-bit and 64-bit build environments. If your project already uses MinGW-w64,
6then LibreSSL should integrate very nicely. Old versions of the mingw-w64 6then LibreSSL should integrate very nicely. Old versions of the MinGW-w64
7toolchain, such as the one packaged with Ubuntu 12.04, may have trouble 7toolchain, such as the one packaged with Ubuntu 12.04, may have trouble
8building LibreSSL. Please try it with a recent toolchain if you encounter 8building LibreSSL. Please try it with a recent toolchain if you encounter
9troubles. Cygwin provides an easy method of installing the latest mingw-w64 9troubles. Cygwin provides an easy method of installing the latest MinGW-w64
10cross compilers on Windows. 10cross-compilers on Windows.
11 11
12To configure and build LibreSSL for a 32-bit system, use the following 12To configure and build LibreSSL for a 32-bit system, use the following
13build steps: 13build steps:
@@ -23,7 +23,7 @@ For 64-bit builds, use these instead:
23 make 23 make
24 make check 24 make check
25 25
26# Why the -D__MINGW_USE_VC2005_COMPAT flag on 32-bit systems? 26### Why the -D__MINGW_USE_VC2005_COMPAT flag on 32-bit systems?
27 27
28An ABI change introduced with Microsoft Visual C++ 2005 (also known as 28An ABI change introduced with Microsoft Visual C++ 2005 (also known as
29Visual C++ 8.0) switched time_t from 32-bit to 64-bit. It is important to 29Visual C++ 8.0) switched time_t from 32-bit to 64-bit. It is important to
@@ -36,30 +36,8 @@ expiry date is set past 19 January 2038, it will be unable to tell if the
36certificate has expired or not, and thus take the safe stance and reject it. 36certificate has expired or not, and thus take the safe stance and reject it.
37 37
38In order to avoid this, you need to build LibreSSL (and everything that links 38In order to avoid this, you need to build LibreSSL (and everything that links
39with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells mingw-w64 to 39with it) with the -D__MINGW_USE_VC2005_COMPAT flag. This tells MinGW-w64 to
40use the new ABI. 40use the new ABI.
41 41
4264-bit systems always have a 64-bit time_t and are not affected by this 4264-bit systems always have a 64-bit time_t and are not affected by this
43problem. 43problem.
44
45# Using Libressl with Visual Studio
46
47A script for generating ready-to-use .DLL and static .LIB files is included in
48the source repository at
49https://github.com/libressl/portable/blob/master/dist-win.sh
50
51This script uses mingw-w64 to build LibreSSL and then uses Visual Studio tools
52to generate compatible library import files ready-to-use with Visual
53Studio projects. Static and dynamic libraries are included. The script uses
54cv2pdb to generate Visual Studio and windbg compatible debug files. cv2pdb is a
55tool developed for the D language and can be found here:
56https://github.com/rainers/cv2pdb
57
58The mingw-w64 code is largely, but not 100%, compatible with code built from
59Visual Studio. Notably, FILE * pointers cannot be shared between code built for
60Mingw-w64 and Visual Studio.
61
62As of LibreSSL 2.2.2, Visual Studio Native builds can also be produced using
63CMake. This produces ABI-compatible libraries for linking with native code
64generated by Visual Studio. Currently tested versions are VS 2019 and 2022,
65though earlier versions may work as well.
diff --git a/dist-win.sh b/dist-win.sh
deleted file mode 100755
index e4e0fd0..0000000
--- a/dist-win.sh
+++ /dev/null
@@ -1,48 +0,0 @@
1#!/bin/bash
2set -e
3#set -x
4
5export PATH=/cygdrive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio\ 12.0/VC/bin:$PATH
6VERSION=`cat VERSION`
7DIST=libressl-$VERSION-windows
8
9rm -fr $DIST
10mkdir -p $DIST
11autoreconf -i
12
13for ARCH in X86 X64; do
14
15 if [ $ARCH = X86 ]; then
16 HOST=i686-w64-mingw32
17 ARCHDIR=x86
18 else
19 HOST=x86_64-w64-mingw32
20 ARCHDIR=x64
21 fi
22
23 echo Building for $HOST
24
25 CC=$HOST-gcc ./configure --host=$HOST --with-openssldir=c:/libressl/ssl
26 make clean
27 PATH=$PATH:/usr/$HOST/sys-root/mingw/bin \
28 make -j 4 check
29 make -j 4 install DESTDIR=`pwd`/stage-$ARCHDIR
30
31 mkdir -p $DIST/$ARCHDIR
32 if [ ! -e $DIST/include ]; then
33 cp -r stage-$ARCHDIR/usr/local/include $DIST
34 fi
35
36 cp stage-$ARCHDIR/usr/local/bin/* $DIST/$ARCHDIR
37
38 for i in libcrypto libssl libtls; do
39 DLL=$(basename `ls -1 $DIST/$ARCHDIR/$i*.dll`|cut -d. -f1)
40 echo EXPORTS > $DLL.def
41 dumpbin /exports $DIST/$ARCHDIR/$DLL.dll | \
42 awk '{print $4}' | awk 'NF' |tail -n +9 >> $DLL.def
43 lib /MACHINE:$ARCH /def:$DLL.def /out:$DIST/$ARCHDIR/$DLL.lib
44 cv2pdb $DIST/$ARCHDIR/$DLL.dll
45 done
46done
47
48zip -r $DIST.zip $DIST
diff --git a/m4/check-os-options.m4 b/m4/check-os-options.m4
index a8c4904..91c3021 100644
--- a/m4/check-os-options.m4
+++ b/m4/check-os-options.m4
@@ -147,7 +147,7 @@ if test "$ac_cv_sizeof_time_t" = "4"; then
147 if test "$host_os" = "mingw32" ; then 147 if test "$host_os" = "mingw32" ; then
148 echo " **" 148 echo " **"
149 echo " ** You can solve this by adjusting the build flags in your" 149 echo " ** You can solve this by adjusting the build flags in your"
150 echo " ** mingw-w64 toolchain. Refer to README.windows for details." 150 echo " ** mingw-w64 toolchain. Refer to README.mingw.md for details."
151 fi 151 fi
152fi 152fi
153 153