File 0001-add-soversion-option.patch of Package boringssl
From e23b950bc30e196937861b7b167a5f520c8b2118 Mon Sep 17 00:00:00 2001
From: Michal Rostecki <mrostecki@suse.de>
Date: Tue, 6 Nov 2018 20:29:25 +0100
Subject: [PATCH] cmake: Add SOVERSION option
The SOVERSION option allows to version the shared library. Version
defined there is 0 and the versioned library files have extension
`so.0`. Optional soversion is helpful for packaging and making a
difference between `lib*` package (which contains `.so.0` file)
and `*-devel` package (which contains `.so` file).
Change-Id: If52a0657de0f524a2c40cb51a6e9c36aac87024d
---
BUILDING.md | 3 +++
CMakeLists.txt | 8 ++++++++
crypto/CMakeLists.txt | 6 ++++++
decrepit/CMakeLists.txt | 6 ++++++
ssl/CMakeLists.txt | 6 ++++++
5 files changed, 29 insertions(+)
Index: boringssl-20190916/BUILDING.md
===================================================================
--- boringssl-20190916.orig/BUILDING.md
+++ boringssl-20190916/BUILDING.md
@@ -78,6 +78,9 @@ Windows, where functions need to be tagg
shared library, define `BORINGSSL_SHARED_LIBRARY` in any code which `#include`s
the BoringSSL headers.
+If you want to build a shared library with versioned `.so` files (`.so.0`), pass
+`-DSOVERSION=1`.
+
In order to serve environments where code-size is important as well as those
where performance is the overriding concern, `OPENSSL_SMALL` can be defined to
remove some code that is especially large.
Index: boringssl-20190916/CMakeLists.txt
===================================================================
--- boringssl-20190916.orig/CMakeLists.txt
+++ boringssl-20190916/CMakeLists.txt
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.0)
+set(boringssl_SOVERSION 1)
+
# Defer enabling C and CXX languages.
project(BoringSSL NONE)
@@ -536,6 +538,12 @@ endif()
# Add minimal googletest targets. The provided one has many side-effects, and
# googletest has a very straightforward build.
add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
+if(BUILD_SHARED_LIBS AND SOVERSION)
+ set_target_properties(
+ boringssl_gtest PROPERTIES
+ SOVERSION ${boringssl_SOVERSION}
+ )
+endif()
target_include_directories(boringssl_gtest PRIVATE third_party/googletest)
include_directories(third_party/googletest/include)
Index: boringssl-20190916/crypto/CMakeLists.txt
===================================================================
--- boringssl-20190916.orig/crypto/CMakeLists.txt
+++ boringssl-20190916/crypto/CMakeLists.txt
@@ -420,6 +420,12 @@ add_library(
${CRYPTO_ARCH_SOURCES}
${CRYPTO_FIPS_OBJECTS}
)
+if(BUILD_SHARED_LIBS AND SOVERSION)
+ set_target_properties(
+ crypto PROPERTIES
+ SOVERSION ${boringssl_SOVERSION}
+ )
+endif()
if(FIPS_SHARED)
# Rewrite libcrypto.so to inject the correct module hash value. This assumes
Index: boringssl-20190916/decrepit/CMakeLists.txt
===================================================================
--- boringssl-20190916.orig/decrepit/CMakeLists.txt
+++ boringssl-20190916/decrepit/CMakeLists.txt
@@ -21,6 +21,12 @@ add_library(
x509/x509_decrepit.c
xts/xts.c
)
+if(BUILD_SHARED_LIBS AND SOVERSION)
+ set_target_properties(
+ decrepit PROPERTIES
+ SOVERSION ${boringssl_SOVERSION}
+ )
+endif()
add_dependencies(decrepit global_target)
Index: boringssl-20190916/ssl/CMakeLists.txt
===================================================================
--- boringssl-20190916.orig/ssl/CMakeLists.txt
+++ boringssl-20190916/ssl/CMakeLists.txt
@@ -40,6 +40,12 @@ add_library(
tls13_enc.cc
tls13_server.cc
)
+if(BUILD_SHARED_LIBS AND SOVERSION)
+ set_target_properties(
+ ssl PROPERTIES
+ SOVERSION ${boringssl_SOVERSION}
+ )
+endif()
add_dependencies(ssl global_target)