lkml.org 
[lkml]   [2019]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 24/79] libperf: Add build version support
Date
Adding shared library version, generating following files:

$ ll toos/perf/lib/libperf.so*
libperf.so -> libperf.so.0.0.1
libperf.so.0 -> libperf.so.0.0.1
libperf.so.0.0.1

Link: http://lkml.kernel.org/n/tip-d2cnt8qoqc5nxiibvzvuw6ir@git.kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/perf/lib/Makefile | 20 +++++++++++++++++---
tools/perf/lib/libperf.map | 4 ++++
2 files changed, 21 insertions(+), 3 deletions(-)
create mode 100644 tools/perf/lib/libperf.map

diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
index e6f2eb702aaa..25a6476f8b12 100644
--- a/tools/perf/lib/Makefile
+++ b/tools/perf/lib/Makefile
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
# Most of this file is copied from tools/lib/bpf/Makefile

+LIBPERF_VERSION = 0
+LIBPERF_PATCHLEVEL = 0
+LIBPERF_EXTRAVERSION = 1
+
MAKEFLAGS += --no-print-directory

ifeq ($(srctree),)
@@ -47,7 +51,13 @@ all:
export srctree OUTPUT CC LD CFLAGS V
include $(srctree)/tools/build/Makefile.include

-LIBPERF_SO := $(OUTPUT)libperf.so
+VERSION_SCRIPT := libperf.map
+
+PATCHLEVEL = $(LIBPERF_PATCHLEVEL)
+EXTRAVERSION = $(LIBPERF_EXTRAVERSION)
+VERSION = $(LIBPERF_VERSION).$(LIBPERF_PATCHLEVEL).$(LIBPERF_EXTRAVERSION)
+
+LIBPERF_SO := $(OUTPUT)libperf.so.$(VERSION)
LIBPERF_A := $(OUTPUT)libperf.a
LIBPERF_IN := $(OUTPUT)libperf-in.o

@@ -58,7 +68,11 @@ $(LIBPERF_A): $(LIBPERF_IN)
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIBPERF_IN)

$(LIBPERF_SO): $(LIBPERF_IN)
- $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so $^ -o $@
+ $(QUIET_LINK)$(CC) --shared -Wl,-soname,libperf.so \
+ -Wl,--version-script=$(VERSION_SCRIPT) $^ -o $@
+ @ln -sf $(@F) $(OUTPUT)libperf.so
+ @ln -sf $(@F) $(OUTPUT)libperf.so.$(LIBPERF_VERSION)
+

libs: $(LIBPERF_A) $(LIBPERF_SO)

@@ -67,7 +81,7 @@ all: fixdep

clean:
$(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \
- *.o *~ *.a *.so .*.d .*.cmd LIBPERF-CFLAGS
+ *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd LIBPERF-CFLAGS

FORCE:

diff --git a/tools/perf/lib/libperf.map b/tools/perf/lib/libperf.map
new file mode 100644
index 000000000000..a8e913988edf
--- /dev/null
+++ b/tools/perf/lib/libperf.map
@@ -0,0 +1,4 @@
+LIBPERF_0.0.1 {
+ local:
+ *;
+};
--
2.21.0
\
 
 \ /
  Last update: 2019-07-21 13:29    [W:0.409 / U:3.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site