summaryrefslogtreecommitdiff
path: root/user/faad2/fix-ensure-libraries-versioned.patch
blob: ae0150f4685157222ef49a847e36991938e23b59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 3a593d3efc5cf1db5f4c8914768ea1ea70cbcde5 Mon Sep 17 00:00:00 2001
From: Eugene Kliuchnikov <eustas.ru@gmail.com>
Date: Fri, 13 Oct 2023 08:52:31 +0200
Subject: [PATCH] Add vesion to linked libraries (#181)

---
 CMakeLists.txt | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 31270436..6b4d4d84 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,11 +34,20 @@ endif()
 
 set(CAPTURE_PACKAGE_VERSION "[ \\t]*\"PACKAGE_VERSION\"[ \\t]*:[ \\t]\"(.*)\"")
 file(STRINGS "properties.json" _faad_version_line REGEX "${CAPTURE_PACKAGE_VERSION}")
-message("${_faad_version_line}")
 string(REGEX REPLACE "${CAPTURE_PACKAGE_VERSION}" "\\1" FAAD_VERSION "${_faad_version_line}")
+string(REPLACE "\." ";" FAAD_VERSION_PARTS ${FAAD_VERSION})
+list(GET FAAD_VERSION_PARTS 0 FAAD_VERSION_MAJOR)
+list(GET FAAD_VERSION_PARTS 1 FAAD_VERSION_MINOR)
+list(GET FAAD_VERSION_PARTS 2 FAAD_VERSION_PATCH)
+# Semantic -> library version
+# NB(eustas): likely that will be always OK; if not, we could read "overrides" from properties.json
+math(EXPR FAAD_ABI_VERSION_CURRENT "${FAAD_VERSION_MAJOR} + ${FAAD_VERSION_MINOR}")
+set(FAAD_ABI_VERSION_AGE "${FAAD_VERSION_MINOR}")
+set(FAAD_ABI_VERSION_REVISION "${FAAD_VERSION_PATCH}")
+set(FAAD_ABI_COMPATIBILITY "${FAAD_VERSION_MAJOR}")
 
 message(STATUS "FAAD PACKAGE_VERSION: ${FAAD_VERSION}")
-mark_as_advanced(FAAD_VERSION)
+mark_as_advanced(FAAD_VERSION FAAD_ABI_COMPATIBILITY FAAD_ABI_VERSION_AGE FAAD_ABI_VERSION_REVISION)
 
 file(READ include/faad.h.in FAAD_H_SRC)
 string(REGEX REPLACE "@VERSION@" "${FAAD_VERSION}" FAAD_H_SRC ${FAAD_H_SRC})
@@ -187,6 +196,13 @@ endfunction()
 
 transform_pc_file("libfaad/faad2.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/faad2.pc" "${FAAD_VERSION}")
 
+foreach(LIB faad faad_drm faad_fixed faad_drm_fixed)
+  set_target_properties(${LIB} PROPERTIES
+      VERSION "${FAAD_ABI_COMPATIBILITY}.${FAAD_ABI_VERSION_AGE}.${FAAD_ABI_VERSION_REVISION}"
+      SOVERSION "${FAAD_ABI_COMPATIBILITY}"
+  )
+endforeach()
+
 # CLI
 
 add_executable(faad_cli ${FAAD_SOURCES})