lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-0a64d7091efde161a7d0fa385ed5c3bdb72ecdf9@git.kernel.org>
Date:   Tue, 30 Jul 2019 12:00:51 -0700
From:   tip-bot for Jiri Olsa <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     ak@...ux.intel.com, namhyung@...nel.org, mingo@...nel.org,
        alexey.budankov@...ux.intel.com, linux-kernel@...r.kernel.org,
        hpa@...or.com, tglx@...utronix.de, mpetlan@...hat.com,
        peterz@...radead.org, acme@...hat.com,
        alexander.shishkin@...ux.intel.com, jolsa@...nel.org
Subject: [tip:perf/core] libperf: Add install targets

Commit-ID:  0a64d7091efde161a7d0fa385ed5c3bdb72ecdf9
Gitweb:     https://git.kernel.org/tip/0a64d7091efde161a7d0fa385ed5c3bdb72ecdf9
Author:     Jiri Olsa <jolsa@...nel.org>
AuthorDate: Sun, 21 Jul 2019 13:24:58 +0200
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Mon, 29 Jul 2019 18:34:46 -0300

libperf: Add install targets

Add install targets (mostly copied from tools/lib/bpf), it's now
possible to install libperf with:

  $ make DESTDIR=/tmp/krava  install
    INSTALL  libperf.a
    INSTALL  libperf.so
    INSTALL  libperf.so.0
    INSTALL  libperf.so.0.0.1
    INSTALL  headers
    INSTALL  libperf.pc

  $ find /tmp/krava/
  /tmp/krava/
  /tmp/krava/include
  /tmp/krava/include/perf
  /tmp/krava/include/perf/evsel.h
  /tmp/krava/include/perf/evlist.h
  /tmp/krava/include/perf/threadmap.h
  /tmp/krava/include/perf/cpumap.h
  /tmp/krava/include/perf/core.h
  /tmp/krava/lib64
  /tmp/krava/lib64/pkgconfig
  /tmp/krava/lib64/pkgconfig/libperf.pc
  /tmp/krava/lib64/libperf.so.0.0.1
  /tmp/krava/lib64/libperf.so.0
  /tmp/krava/lib64/libperf.so
  /tmp/krava/lib64/libperf.a

Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Michael Petlan <mpetlan@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20190721112506.12306-72-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/perf/lib/Makefile                            | 69 +++++++++++++++++++++-
 .../lib/libperf.pc.template}                       |  7 +--
 2 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/tools/perf/lib/Makefile b/tools/perf/lib/Makefile
index cd571ec648ad..f1b3d4c6d5f0 100644
--- a/tools/perf/lib/Makefile
+++ b/tools/perf/lib/Makefile
@@ -14,9 +14,31 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
+INSTALL = install
+
+# Use DESTDIR for installing into a different root directory.
+# This is useful for building a package. The program will be
+# installed in this directory as if it was the root directory.
+# Then the build tool can move it later.
+DESTDIR ?=
+DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
+
 include $(srctree)/tools/scripts/Makefile.include
 include $(srctree)/tools/scripts/Makefile.arch
 
+ifeq ($(LP64), 1)
+  libdir_relative = lib64
+else
+  libdir_relative = lib
+endif
+
+prefix ?=
+libdir = $(prefix)/$(libdir_relative)
+
+# Shell quotes
+libdir_SQ = $(subst ','\'',$(libdir))
+libdir_relative_SQ = $(subst ','\'',$(libdir_relative))
+
 ifeq ("$(origin V)", "command line")
   VERBOSE = $(V)
 endif
@@ -49,6 +71,8 @@ override CFLAGS += -fvisibility=hidden
 all:
 
 export srctree OUTPUT CC LD CFLAGS V
+export DESTDIR DESTDIR_SQ
+
 include $(srctree)/tools/build/Makefile.include
 
 VERSION_SCRIPT := libperf.map
@@ -60,6 +84,9 @@ VERSION       = $(LIBPERF_VERSION).$(LIBPERF_PATCHLEVEL).$(LIBPERF_EXTRAVERSION)
 LIBPERF_SO := $(OUTPUT)libperf.so.$(VERSION)
 LIBPERF_A  := $(OUTPUT)libperf.a
 LIBPERF_IN := $(OUTPUT)libperf-in.o
+LIBPERF_PC := $(OUTPUT)libperf.pc
+
+LIBPERF_ALL := $(LIBPERF_A) $(OUTPUT)libperf.so*
 
 $(LIBPERF_IN): FORCE
 	$(Q)$(MAKE) $(build)=libperf
@@ -74,14 +101,52 @@ $(LIBPERF_SO): $(LIBPERF_IN)
 	@ln -sf $(@F) $(OUTPUT)libperf.so.$(LIBPERF_VERSION)
 
 
-libs: $(LIBPERF_A) $(LIBPERF_SO)
+libs: $(LIBPERF_A) $(LIBPERF_SO) $(LIBPERF_PC)
 
 all: fixdep
 	$(Q)$(MAKE) libs
 
 clean:
 	$(call QUIET_CLEAN, libperf) $(RM) $(LIBPERF_A) \
-                *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd LIBPERF-CFLAGS
+                *.o *~ *.a *.so *.so.$(VERSION) *.so.$(LIBPERF_VERSION) .*.d .*.cmd LIBPERF-CFLAGS $(LIBPERF_PC)
+
+$(LIBPERF_PC):
+	$(QUIET_GEN)sed -e "s|@...FIX@|$(prefix)|" \
+		-e "s|@...DIR@|$(libdir_SQ)|" \
+		-e "s|@...SION@|$(VERSION)|" \
+		< libperf.pc.template > $@
+
+define do_install_mkdir
+	if [ ! -d '$(DESTDIR_SQ)$1' ]; then             \
+		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1'; \
+	fi
+endef
+
+define do_install
+	if [ ! -d '$(DESTDIR_SQ)$2' ]; then             \
+		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$2'; \
+	fi;                                             \
+	$(INSTALL) $1 $(if $3,-m $3,) '$(DESTDIR_SQ)$2'
+endef
+
+install_lib: libs
+	$(call QUIET_INSTALL, $(LIBPERF_ALL)) \
+		$(call do_install_mkdir,$(libdir_SQ)); \
+		cp -fpR $(LIBPERF_ALL) $(DESTDIR)$(libdir_SQ)
+
+install_headers:
+	$(call QUIET_INSTALL, headers) \
+		$(call do_install,include/perf/core.h,$(prefix)/include/perf,644); \
+		$(call do_install,include/perf/cpumap.h,$(prefix)/include/perf,644); \
+		$(call do_install,include/perf/threadmap.h,$(prefix)/include/perf,644); \
+		$(call do_install,include/perf/evlist.h,$(prefix)/include/perf,644); \
+		$(call do_install,include/perf/evsel.h,$(prefix)/include/perf,644);
+
+install_pkgconfig: $(LIBPERF_PC)
+	$(call QUIET_INSTALL, $(LIBPERF_PC)) \
+		$(call do_install,$(LIBPERF_PC),$(libdir_SQ)/pkgconfig,644)
+
+install: install_lib install_headers install_pkgconfig
 
 FORCE:
 
diff --git a/tools/lib/bpf/libbpf.pc.template b/tools/perf/lib/libperf.pc.template
similarity index 64%
copy from tools/lib/bpf/libbpf.pc.template
copy to tools/perf/lib/libperf.pc.template
index ac17fcef2108..117e4a237b55 100644
--- a/tools/lib/bpf/libbpf.pc.template
+++ b/tools/perf/lib/libperf.pc.template
@@ -4,9 +4,8 @@ prefix=@...FIX@
 libdir=@...DIR@
 includedir=${prefix}/include
 
-Name: libbpf
-Description: BPF library
+Name: libperf
+Description: perf library
 Version: @VERSION@
-Libs: -L${libdir} -lbpf
-Requires.private: libelf
+Libs: -L${libdir} -lperf
 Cflags: -I${includedir}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ