summaryrefslogtreecommitdiff
blob: 70c605ae913df9de5973bfcc9048d274e43c8962 (plain)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
From 225a5f5b9f40c1f335146ec882bd5517e4573f62 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20K=2E=20H=C3=BCttel?= <dilfridge@gentoo.org>
Date: Sat, 24 Jul 2021 15:20:16 +0200
Subject: [PATCH 3/5] Gentoo: Give also libctf optionally a gentoo-specific
 soversion

---
 libctf/Makefile.am  | 14 +++++++++++++-
 libctf/Makefile.in  |  9 ++++++++-
 libctf/configure    | 31 +++++++++++++++++++++++++++++++
 libctf/configure.ac | 10 ++++++++++
 4 files changed, 62 insertions(+), 2 deletions(-)

diff --git a/libctf/Makefile.am b/libctf/Makefile.am
index fb1a306c888..5fcc73bd04e 100644
--- a/libctf/Makefile.am
+++ b/libctf/Makefile.am
@@ -31,6 +31,9 @@ info_TEXINFOS =
 DISTCLEANFILES =
 MAINTAINERCLEANFILES =
 
+EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
+BFD_VERSION = @BFD_VERSION@
+
 # This is where we get zlib from.  zlibdir is -L../zlib and zlibinc is
 # -I../zlib, unless we were configured with --with-system-zlib, in which
 # case both are empty.
@@ -51,8 +54,17 @@ include_HEADERS =
 noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
 endif
 
+# libctf by default uses libtool versioning. Unfortunately that keeps us from adding
+# a supplement to the soversion. So we need to switch tracks and be creative.
+
+if HAVE_EXTRA_SOVERSION_SUFFIX
+gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
+else
+gentoo_ctf_soversion = 0.0.0
+endif
+
 libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
-libctf_ldflags_nover = -version-info 0:0:0 @SHARED_LDFLAGS@
+libctf_ldflags_nover = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@
 libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@
 libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
 libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c ctf-decl.c ctf-error.c \
diff --git a/libctf/Makefile.in b/libctf/Makefile.in
index 54f5daa79ee..b7a80edfab6 100644
--- a/libctf/Makefile.in
+++ b/libctf/Makefile.in
@@ -430,6 +430,7 @@ AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
+BFD_VERSION = @BFD_VERSION@
 CATALOGS = @CATALOGS@
 CATOBJEXT = @CATOBJEXT@
 CC = @CC@
@@ -452,6 +453,7 @@ EXEEXT = @EXEEXT@
 
 # Setup the testing framework, if you have one
 EXPECT = expect
+EXTRA_SOVERSION_SUFFIX = @EXTRA_SOVERSION_SUFFIX@
 FGREP = @FGREP@
 GENCAT = @GENCAT@
 GMSGFMT = @GMSGFMT@
@@ -603,8 +605,13 @@ AM_CFLAGS = -std=gnu99 @ac_libctf_warn_cflags@ @warn@ @c_warn@ @WARN_PEDANTIC@ @
 @INSTALL_LIBBFD_FALSE@include_HEADERS = 
 @INSTALL_LIBBFD_TRUE@include_HEADERS = $(INCDIR)/ctf.h $(INCDIR)/ctf-api.h
 @INSTALL_LIBBFD_FALSE@noinst_LTLIBRARIES = libctf.la libctf-nobfd.la
+@HAVE_EXTRA_SOVERSION_SUFFIX_FALSE@gentoo_ctf_soversion = 0.0.0
+
+# libctf by default uses libtool versioning. Unfortunately that keeps us from adding
+# a supplement to the soversion. So we need to switch tracks and be creative.
+@HAVE_EXTRA_SOVERSION_SUFFIX_TRUE@gentoo_ctf_soversion = "$(BFD_VERSION).$(EXTRA_SOVERSION_SUFFIX)"
 libctf_nobfd_la_LIBADD = @CTF_LIBADD@ $(ZLIB)
-libctf_ldflags_nover = -version-info 0:0:0 @SHARED_LDFLAGS@
+libctf_ldflags_nover = -release $(gentoo_ctf_soversion) @SHARED_LDFLAGS@
 libctf_nobfd_la_LDFLAGS = $(libctf_ldflags_nover) @VERSION_FLAGS_NOBFD@
 libctf_nobfd_la_CPPFLAGS = $(AM_CPPFLAGS) -DNOBFD=1
 libctf_nobfd_la_SOURCES = ctf-archive.c ctf-dump.c ctf-create.c \
diff --git a/libctf/configure b/libctf/configure
index 7466d56a18b..54c86592b70 100755
--- a/libctf/configure
+++ b/libctf/configure
@@ -646,6 +646,10 @@ BUILD_INFO_FALSE
 BUILD_INFO_TRUE
 NEED_CTF_QSORT_R_FALSE
 NEED_CTF_QSORT_R_TRUE
+BFD_VERSION
+HAVE_EXTRA_SOVERSION_SUFFIX_FALSE
+HAVE_EXTRA_SOVERSION_SUFFIX_TRUE
+EXTRA_SOVERSION_SUFFIX
 ENABLE_LIBCTF_HASH_DEBUGGING_FALSE
 ENABLE_LIBCTF_HASH_DEBUGGING_TRUE
 zlibinc
@@ -821,6 +825,7 @@ enable_maintainer_mode
 enable_install_libbfd
 with_system_zlib
 enable_libctf_hash_debugging
+with_extra_soversion_suffix
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1487,6 +1492,8 @@ Optional Packages:
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-system-zlib      use installed libz
+  --with-extra-soversion-suffix=SUFFIX
+                          Append '.SUFFIX' to SONAME [[default=]]
 
 Some influential environment variables:
   CC          C compiler command
@@ -16274,6 +16281,26 @@ else
 fi
 
 
+EXTRA_SOVERSION_SUFFIX=
+
+# Check whether --with-extra-soversion-suffix was given.
+if test "${with_extra_soversion_suffix+set}" = set; then :
+  withval=$with_extra_soversion_suffix; EXTRA_SOVERSION_SUFFIX="${withval}"
+fi
+
+
+ if test -n "${with_extra_soversion_suffix}"; then
+  HAVE_EXTRA_SOVERSION_SUFFIX_TRUE=
+  HAVE_EXTRA_SOVERSION_SUFFIX_FALSE='#'
+else
+  HAVE_EXTRA_SOVERSION_SUFFIX_TRUE='#'
+  HAVE_EXTRA_SOVERSION_SUFFIX_FALSE=
+fi
+
+
+BFD_VERSION=$(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p')
+
+
 # Similar to GDB_AC_CHECK_BFD.
 OLD_CFLAGS=$CFLAGS
 OLD_LDFLAGS=$LDFLAGS
@@ -17177,6 +17204,10 @@ if test -z "${ENABLE_LIBCTF_HASH_DEBUGGING_TRUE}" && test -z "${ENABLE_LIBCTF_HA
   as_fn_error $? "conditional \"ENABLE_LIBCTF_HASH_DEBUGGING\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${HAVE_EXTRA_SOVERSION_SUFFIX_TRUE}" && test -z "${HAVE_EXTRA_SOVERSION_SUFFIX_FALSE}"; then
+  as_fn_error $? "conditional \"HAVE_EXTRA_SOVERSION_SUFFIX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 
 if test -z "${NEED_CTF_QSORT_R_TRUE}" && test -z "${NEED_CTF_QSORT_R_FALSE}"; then
   as_fn_error $? "conditional \"NEED_CTF_QSORT_R\" was never defined.
diff --git a/libctf/configure.ac b/libctf/configure.ac
index 64544b83a9f..1ce43327c25 100644
--- a/libctf/configure.ac
+++ b/libctf/configure.ac
@@ -76,6 +76,16 @@ if test "${enable_libctf_hash_debugging}" = yes; then
 fi
 AM_CONDITIONAL(ENABLE_LIBCTF_HASH_DEBUGGING, test "${enable_libctf_hash_debugging}" = yes)
 
+EXTRA_SOVERSION_SUFFIX=
+AC_ARG_WITH(extra-soversion-suffix,
+  AS_HELP_STRING([--with-extra-soversion-suffix=SUFFIX],
+                 [Append '.SUFFIX' to SONAME [[default=]]]),
+[EXTRA_SOVERSION_SUFFIX="${withval}"])
+AC_SUBST(EXTRA_SOVERSION_SUFFIX)
+AM_CONDITIONAL([HAVE_EXTRA_SOVERSION_SUFFIX], [test -n "${with_extra_soversion_suffix}"])
+
+AC_SUBST(BFD_VERSION, $(${srcdir}/../bfd/configure --version | sed -n -e '1s,.* ,,p'), [Version of the accompanying bfd linker])
+
 # Similar to GDB_AC_CHECK_BFD.
 OLD_CFLAGS=$CFLAGS
 OLD_LDFLAGS=$LDFLAGS
-- 
2.44.2