From 2557dd7439806448ad41b7bc5f175f4ed4f74d9c Mon Sep 17 00:00:00 2001 From: d3x0r Date: Thu, 6 Jul 2017 02:09:44 -0700 Subject: [PATCH 1/9] Add option LIBRESSL_SKIP_INSTALL Internally LIBRESSL_SKIP_INSTALL, if not set becomes ENABLE_LIBRESSL_INSTALL so this by default is enabled. defining LIBRESSL_SKIP_INSTALL before hand will disable all install() rules. This is useful if another project includes and links to this statically. I chose to add a prefix to avoid potential name collision because the options are cached globally. If the installation is skipped, maybe it should also disable building apps? I didn't do that. --- CMakeLists.txt | 6 ++++++ apps/nc/CMakeLists.txt | 6 ++++-- apps/ocspcheck/CMakeLists.txt | 6 ++++-- apps/openssl/CMakeLists.txt | 12 ++++++++---- crypto/CMakeLists.txt | 8 ++++++-- include/CMakeLists.txt | 12 +++++++----- man/CMakeLists.txt | 18 ++++++++++-------- ssl/CMakeLists.txt | 8 ++++++-- tls/CMakeLists.txt | 8 ++++++-- 9 files changed, 57 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 570e0ef..bfd1363 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,12 +26,18 @@ string(STRIP ${TLS_VERSION} TLS_VERSION) string(REPLACE ":" "." TLS_VERSION ${TLS_VERSION}) string(REGEX REPLACE "\\..*" "" TLS_MAJOR_VERSION ${TLS_VERSION}) +option(LIBRESSL_SKIP_INSTALL "Skip installation" ${LIBRESSL_SKIP_INSTALL}) option(ENABLE_ASM "Enable assembly" ON) option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some platforms" OFF) option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) option(ENABLE_VSTEST "Enable test on Visual Studio" OFF) set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) +if(NOT LIBRESSL_SKIP_INSTALL) + set( ENABLE_LIBRESSL_INSTALL ON ) +endif(NOT LIBRESSL_SKIP_INSTALL) + + set(BUILD_NC true) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") diff --git a/apps/nc/CMakeLists.txt b/apps/nc/CMakeLists.txt index c8757a6..424c676 100644 --- a/apps/nc/CMakeLists.txt +++ b/apps/nc/CMakeLists.txt @@ -53,8 +53,10 @@ add_executable(nc ${NC_SRC}) target_link_libraries(nc tls ${OPENSSL_LIBS}) if(ENABLE_NC) - install(TARGETS nc DESTINATION bin) - install(FILES nc.1 DESTINATION share/man/man1) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS nc DESTINATION bin) + install(FILES nc.1 DESTINATION share/man/man1) + endif(ENABLE_LIBRESSL_INSTALL) endif() endif() diff --git a/apps/ocspcheck/CMakeLists.txt b/apps/ocspcheck/CMakeLists.txt index a14485e..064c367 100644 --- a/apps/ocspcheck/CMakeLists.txt +++ b/apps/ocspcheck/CMakeLists.txt @@ -36,7 +36,9 @@ endif() add_executable(ocspcheck ${OCSPCHECK_SRC}) target_link_libraries(ocspcheck tls ${OPENSSL_LIBS}) -install(TARGETS ocspcheck DESTINATION bin) -install(FILES ocspcheck.8 DESTINATION share/man/man8) +if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS ocspcheck DESTINATION bin) + install(FILES ocspcheck.8 DESTINATION share/man/man8) +endif(ENABLE_LIBRESSL_INSTALL) endif() diff --git a/apps/openssl/CMakeLists.txt b/apps/openssl/CMakeLists.txt index 9512065..cf5c852 100644 --- a/apps/openssl/CMakeLists.txt +++ b/apps/openssl/CMakeLists.txt @@ -76,13 +76,17 @@ endif() add_executable(openssl ${OPENSSL_SRC}) target_link_libraries(openssl ${OPENSSL_LIBS}) -install(TARGETS openssl DESTINATION bin) -install(FILES openssl.1 DESTINATION share/man/man1) +if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS openssl DESTINATION bin) + install(FILES openssl.1 DESTINATION share/man/man1) +endif(ENABLE_LIBRESSL_INSTALL) if(NOT "${OPENSSLDIR}" STREQUAL "") set(CONF_DIR "${OPENSSLDIR}") else() set(CONF_DIR "${CMAKE_INSTALL_PREFIX}/etc/ssl") endif() -install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR}) -install(DIRECTORY DESTINATION ${CONF_DIR}/cert) +if(ENABLE_LIBRESSL_INSTALL) + install(FILES cert.pem openssl.cnf x509v3.cnf DESTINATION ${CONF_DIR}) + install(DIRECTORY DESTINATION ${CONF_DIR}/cert) +endif(ENABLE_LIBRESSL_INSTALL) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index f8c5684..a2b4817 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -829,9 +829,13 @@ if (BUILD_SHARED) ARCHIVE_OUTPUT_NAME crypto${CRYPTO_POSTFIX}) set_target_properties(crypto-shared PROPERTIES VERSION ${CRYPTO_VERSION} SOVERSION ${CRYPTO_MAJOR_VERSION}) - install(TARGETS crypto crypto-shared DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS crypto crypto-shared DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) else() add_library(crypto STATIC ${CRYPTO_SRC}) - install(TARGETS crypto DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS crypto DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) endif() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 110caa5..870c740 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,5 +1,7 @@ -install(DIRECTORY . - DESTINATION include - PATTERN "CMakeLists.txt" EXCLUDE - PATTERN "compat" EXCLUDE - PATTERN "Makefile*" EXCLUDE) +if(ENABLE_LIBRESSL_INSTALL) + install(DIRECTORY . + DESTINATION include + PATTERN "CMakeLists.txt" EXCLUDE + PATTERN "compat" EXCLUDE + PATTERN "Makefile*" EXCLUDE) +endif(ENABLE_LIBRESSL_INSTALL) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 5923f58..f08091c 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,9 +1,11 @@ -install(DIRECTORY . - DESTINATION share/man/man3 - FILES_MATCHING PATTERN "*.3" - ) +if(ENABLE_LIBRESSL_INSTALL) + install(DIRECTORY . + DESTINATION share/man/man3 + FILES_MATCHING PATTERN "*.3" + ) -install(DIRECTORY . - DESTINATION share/man/man1 - FILES_MATCHING PATTERN "*.1" - ) + install(DIRECTORY . + DESTINATION share/man/man1 + FILES_MATCHING PATTERN "*.1" + ) +endif(ENABLE_LIBRESSL_INSTALL) diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index bc2fea4..0e1c326 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -60,8 +60,12 @@ if (BUILD_SHARED) ARCHIVE_OUTPUT_NAME ssl${SSL_POSTFIX}) set_target_properties(ssl-shared PROPERTIES VERSION ${SSL_VERSION} SOVERSION ${SSL_MAJOR_VERSION}) - install(TARGETS ssl ssl-shared DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS ssl ssl-shared DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) else() add_library(ssl STATIC ${SSL_SRC}) - install(TARGETS ssl DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS ssl DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) endif() diff --git a/tls/CMakeLists.txt b/tls/CMakeLists.txt index b71fb37..ab73460 100644 --- a/tls/CMakeLists.txt +++ b/tls/CMakeLists.txt @@ -39,9 +39,13 @@ if (BUILD_SHARED) ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX}) set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION} SOVERSION ${TLS_MAJOR_VERSION}) - install(TARGETS tls tls-shared DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS tls tls-shared DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) else() add_library(tls STATIC ${TLS_SRC}) - install(TARGETS tls DESTINATION lib) + if(ENABLE_LIBRESSL_INSTALL) + install(TARGETS tls DESTINATION lib) + endif(ENABLE_LIBRESSL_INSTALL) endif() From 360a67cd348ff9396af94cf25277b3abf69e6dda Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 00:59:05 -0700 Subject: [PATCH 2/9] Add documentation about available CMake options. --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 9b3c540..0b7baf2 100644 --- a/README.md +++ b/README.md @@ -131,3 +131,15 @@ install CMake, enter the LibreSSL source directory and run: 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 +| ------------ | -----: | ------ +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using -DLIBRESSL_SKIP_INSTALL=ON +| ENABLE_ASM | ON | builds assembly optimized rules. +| ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms +| ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) +| ENABLE_VSTEST | OFF | Enable test on Visual Studio +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using -DOPENSSLDIR= + From a61122ef6c4d9aa1e2d5db3049d2d134ce19aa08 Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:01:08 -0700 Subject: [PATCH 3/9] Fix formatting for description of openssldir and skip install --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b7baf2..c0e7e1d 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using -DLIBRESSL_SKIP_INSTALL=ON +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```-DLIBRESSL_SKIP_INSTALL=ON``` | ENABLE_ASM | ON | builds assembly optimized rules. | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using -DOPENSSLDIR= +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using -DOPENSSLDIR=```dirname``` From 3471d201421e3a2a5ba8e361b783c3d237f82e96 Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:04:34 -0700 Subject: [PATCH 4/9] Fix formatting for description of openssldir and skip install; add to prevent option hyphen wrapping --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c0e7e1d..d4e3800 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```-DLIBRESSL_SKIP_INSTALL=ON``` +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```-DLIBRESSL_SKIP_INSTALL=ON``` | ENABLE_ASM | ON | builds assembly optimized rules. | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using -DOPENSSLDIR=```dirname``` +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```-DOPENSSLDIR=``` From a8cd9fdbd674d45d09cec8792b5241febcb1699c Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:07:05 -0700 Subject: [PATCH 5/9] use ‑ option hyphen wrapping --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4e3800..f2fb7d6 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```-DLIBRESSL_SKIP_INSTALL=ON``` +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```‑DLIBRESSL_SKIP_INSTALL=ON``` | ENABLE_ASM | ON | builds assembly optimized rules. | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```-DOPENSSLDIR=``` +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```‑DOPENSSLDIR=``` From fc4e1b95724edc78d8955711133184adb8d87b1d Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:11:57 -0700 Subject: [PATCH 6/9] use ‑ to prevent hyphen wrapping --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f2fb7d6..45e0fec 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```‑DLIBRESSL_SKIP_INSTALL=ON``` +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```‑DLIBRESSL_SKIP_INSTALL=ON``` | ENABLE_ASM | ON | builds assembly optimized rules. | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```‑DOPENSSLDIR=``` +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```‑DOPENSSLDIR=``` From 08869b75db05c321fb629f07c63a1724c6ed1ffe Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:17:48 -0700 Subject: [PATCH 7/9] use \- to prevent hyphen wrapping --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45e0fec..ec936ed 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```‑DLIBRESSL_SKIP_INSTALL=ON``` +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```\-DLIBRESSL_SKIP_INSTALL=ON``` | ENABLE_ASM | ON | builds assembly optimized rules. | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```‑DOPENSSLDIR=``` +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```\-DOPENSSLDIR=``` From 9cad7f785b88c8597ece54ad74eb1136e8c43969 Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:20:21 -0700 Subject: [PATCH 8/9] Okay one more try. --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec936ed..cb14e65 100644 --- a/README.md +++ b/README.md @@ -136,10 +136,14 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using ```\-DLIBRESSL_SKIP_INSTALL=ON``` -| ENABLE_ASM | ON | builds assembly optimized rules. -| ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms -| ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) -| ENABLE_VSTEST | OFF | Enable test on Visual Studio -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using ```\-DOPENSSLDIR=``` +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using + +```-DLIBRESSL_SKIP_INSTALL=ON``` | +| ENABLE_ASM | ON | builds assembly optimized rules. | +| ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | +| ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | +| ENABLE_VSTEST | OFF | Enable test on Visual Studio | +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using + +```-DOPENSSLDIR=``` | From 0e82f22d16dc4c45bd45f9a994a30fc7435d430b Mon Sep 17 00:00:00 2001 From: d3x0r Date: Fri, 7 Jul 2017 01:21:16 -0700 Subject: [PATCH 9/9] Okay really one more try. --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb14e65..33e68f4 100644 --- a/README.md +++ b/README.md @@ -136,14 +136,10 @@ projects or build by itself. | Option Name | Default | Description | ------------ | -----: | ------ -| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using - -```-DLIBRESSL_SKIP_INSTALL=ON``` | +| LIBRESSL_SKIP_INSTALL | OFF | allows skipping install() rules. Can be specified from command line using
```-DLIBRESSL_SKIP_INSTALL=ON``` | | ENABLE_ASM | ON | builds assembly optimized rules. | | ENABLE_EXTRATESTS | OFF | Enable extra tests that may be unreliable on some platforms | | ENABLE_NC | OFF | Enable installing TLS-enabled nc(1) | | ENABLE_VSTEST | OFF | Enable test on Visual Studio | -| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using - -```-DOPENSSLDIR=``` | +| OPENSSLDIR | Blank | Set the default openssl directory. Can be specified from command line using
```-DOPENSSLDIR=``` |