diff --git a/.gitignore b/.gitignore index e69de29..a93eb47 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/crash-trace-command-3.0.tar.gz diff --git a/0001-Makefile-set-DT_SONAME-to-trace.so.patch b/0001-Makefile-set-DT_SONAME-to-trace.so.patch new file mode 100644 index 0000000..dff068d --- /dev/null +++ b/0001-Makefile-set-DT_SONAME-to-trace.so.patch @@ -0,0 +1,36 @@ +From 153629a96b07a8ae96b0b28cce100fde9ea1398d Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke +Date: Thu, 28 Jan 2021 00:08:35 -0500 +Subject: [PATCH 1/2] Makefile: set DT_SONAME to trace.so + +Fedora never requires SONAME versioning for plugins according to the +Packaging Guidelines: + + https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning + + In cases where upstream ships unversioned .so library (so this is + not needed for plugins, drivers, etc.), the packager MUST try to + convince upstream to start versioning it. + +On the other hand, fedpkg lint still prints warning if the shared +library doesn't have DT_SONAME. To surpress this, we set DT_SONAME +field to trace.so for in case. + +Signed-off-by: HATAYAMA Daisuke +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index a9e0a21..b4573b4 100755 +--- a/Makefile ++++ b/Makefile +@@ -28,4 +28,4 @@ INCDIR=/usr/include/crash + all: trace.so + + trace.so: $(INCDIR)/defs.h trace.c +- gcc $(RPM_OPT_FLAGS) -Wall -I$(INCDIR) -nostartfiles -shared -rdynamic -o trace.so trace.c -fPIC -D$(TARGET) $(TARGET_CFLAGS) ++ gcc $(RPM_OPT_FLAGS) -Wall -I$(INCDIR) -nostartfiles -shared -rdynamic -Wl,-soname,trace.so -o trace.so trace.c -fPIC -D$(TARGET) $(TARGET_CFLAGS) +-- +2.29.2 + diff --git a/0002-Makefile-fix-build-failure-on-aarch64-and-ppc64le.patch b/0002-Makefile-fix-build-failure-on-aarch64-and-ppc64le.patch new file mode 100644 index 0000000..14d4767 --- /dev/null +++ b/0002-Makefile-fix-build-failure-on-aarch64-and-ppc64le.patch @@ -0,0 +1,50 @@ +From 17c35d075f067d80fee112ae18365b8defa2ca5a Mon Sep 17 00:00:00 2001 +From: HATAYAMA Daisuke +Date: Fri, 19 Feb 2021 11:38:59 +0900 +Subject: [PATCH 2/2] Makefile: fix build failure on aarch64 and ppc64le + +Currently, there is build failure on aarch64 and ppc64le as follows: + + gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection -Wall -I/usr/include/crash -nostartfiles -shared -rdynamic -o trace.so trace.c -fPIC -D + gcc: error: macro name missing after '-D' + +The failure is caused by missing arguments for -D option because +TARGET variable is empty. + +This commit fixes the issue by defining TARGET variable properly +according to aarch64 and ppc64le. + +Signed-off-by: HATAYAMA Daisuke +--- + Makefile | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/Makefile b/Makefile +index b4573b4..0d35d4f 100755 +--- a/Makefile ++++ b/Makefile +@@ -6,6 +6,10 @@ ifeq ($(shell arch), ppc64) + TARGET=PPC64 + TARGET_CFLAGS=-m64 + endif ++ifeq ($(shell arch), ppc64le) ++ TARGET=PPC64 ++ TARGET_CFLAGS=-m64 ++endif + ifeq ($(shell arch), ia64) + TARGET=IA64 + TARGET_CFLAGS= +@@ -22,6 +26,10 @@ ifeq ($(shell arch), s390) + TARGET=S390 + TARGET_CFLAGS= + endif ++ifeq ($(shell arch), aarch64) ++ TARGET=ARM64 ++ TARGET_CFLAGS= ++endif + + INCDIR=/usr/include/crash + +-- +2.29.2 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..de9c267 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# crash-trace-command + +The crash-trace-command package diff --git a/crash-trace-command.spec b/crash-trace-command.spec new file mode 100644 index 0000000..e930b7d --- /dev/null +++ b/crash-trace-command.spec @@ -0,0 +1,44 @@ +%global reponame crash-trace + +Summary: Trace extension module for the crash utility +Name: crash-trace-command +Version: 3.0 +Release: 2%{?dist} +License: GPLv2 +Source: https://github.com/fujitsu/crash-trace/archive/v%{version}/%{name}-%{version}.tar.gz +URL: https://github.com/fujitsu/crash-trace +ExclusiveOS: Linux +ExclusiveArch: aarch64 ppc64le s390x x86_64 +BuildRequires: crash-devel >= 7.2.0-2 +BuildRequires: gcc +Requires: trace-cmd +Requires: crash >= 7.2.0-2 + +Patch0001: 0001-Makefile-set-DT_SONAME-to-trace.so.patch +Patch0002: 0002-Makefile-fix-build-failure-on-aarch64-and-ppc64le.patch + +%description +Command for reading ftrace data from a dump file. + +%prep +%autosetup -n %{reponame}-%{version} + +%build +%make_build + +%install +install -m 0755 -d %{buildroot}%{_libdir}/crash/extensions +install -m 0755 -t %{buildroot}%{_libdir}/crash/extensions %{_builddir}/%{reponame}-%{version}/trace.so + +%files +%dir %{_libdir}/crash +%dir %{_libdir}/crash/extensions +%{_libdir}/crash/extensions/trace.so +%license COPYING + +%changelog +* Fri Feb 19 2021 HATAYAMA Daisuke - 3.0-2 +- Makefile: set DT_SONAME to trace.so +- Makefile: fix build failure on aarch64 and ppc64le +* Fri Jan 22 2021 HATAYAMA Daisuke - 3.0-1 +- Initial crash-trace-command package diff --git a/sources b/sources new file mode 100644 index 0000000..f9350ef --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (crash-trace-command-3.0.tar.gz) = 1158b276684f664b94e0a1075341331c3f043b4d452c4c05f3e91f3e81c822033b1d6a478d816c8e0d6c995faa2c1f303929cb4d7d9ff3cb891929d3067eba7d