From 72723c1e8275a4f7caafdae0f16148403eedc3e0 Mon Sep 17 00:00:00 2001 From: Timm Bäder Date: Jan 29 2024 13:31:59 +0000 Subject: [PATCH 1/3] spec: Remove unnecessarily setting CC=gcc %set_build_flags sets an appropriate CC value already --- diff --git a/infinipath-psm.spec b/infinipath-psm.spec index 9cd6bc1..373e6ab 100644 --- a/infinipath-psm.spec +++ b/infinipath-psm.spec @@ -64,7 +64,7 @@ find libuuid -type f -not -name 'psm_uuid.[c|h]' -not -name Makefile -delete %define _lto_cflags %{nil} %{set_build_flags} -%make_build PSM_USE_SYS_UUID=1 %{MAKEARG} CC=gcc +%make_build PSM_USE_SYS_UUID=1 %{MAKEARG} %install %make_install %{MAKEARG} From 4d4415da5ea23fcefa33253b136907bd99fc139b Mon Sep 17 00:00:00 2001 From: Timm Bäder Date: Jan 29 2024 13:31:59 +0000 Subject: [PATCH 2/3] Remove adjust-base-cflags patch It doesn't really make sense for downstream packaging to add flags like this and the patch does not check whether the compiler in use even supports these flags. --- diff --git a/adjust-base-cflags.patch b/adjust-base-cflags.patch deleted file mode 100644 index 22a7d6b..0000000 --- a/adjust-base-cflags.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/buildflags.mak b/buildflags.mak.old -index 34fdf1c..2c229cb 100644 ---- a/buildflags.mak -+++ b/buildflags.mak.old -@@ -94,5 +94,6 @@ ifeq (1,${PSM_USE_SYS_UUID}) - endif - - CFLAGS += $(BASECFLAGS) $(if $(filter $(CC),gcc),-Wno-strict-aliasing) \ -- $(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND) -+ $(if $(PSM_VALGRIND:0=),-DPSM_VALGRIND,-DNVALGRIND) \ -+ -Wno-maybe-uninitialized -Wno-implicit-function-declaration - diff --git a/infinipath-psm.spec b/infinipath-psm.spec index 373e6ab..188c7ab 100644 --- a/infinipath-psm.spec +++ b/infinipath-psm.spec @@ -15,7 +15,6 @@ URL: https://github.com/01org/psm Source0: %{name}-%{version}-%{git_version}.tar.gz Source1: ipath.rules Patch1: 0001-fix-a-compilation-issue.patch -Patch2: adjust-base-cflags.patch Patch3: remove-executable-permissions-for-header-files.patch Patch4: 0001-Include-sysmacros.h.patch Patch5: 0001-Extend-buffer-for-uvalue-and-pvalue.patch @@ -48,7 +47,6 @@ Development files for the %{name} library. %prep %setup -q -n %{name}-%{version}-%{git_version} %patch1 -p1 -%patch2 -p1 %patch3 -p1 %patch4 -p1 %patch5 -p1 From 6dfb4d262b6cfe40bc8887d00ec1bfb01678a94b Mon Sep 17 00:00:00 2001 From: Timm Bäder Date: Jan 29 2024 13:31:59 +0000 Subject: [PATCH 3/3] Add a patch to fix the clang build There are a few shortcomings in the source code that gcc does not detect. Fix these so the package builds with clang (or non-gcc). --- diff --git a/fix-clang-build.patch b/fix-clang-build.patch new file mode 100644 index 0000000..d52ae9f --- /dev/null +++ b/fix-clang-build.patch @@ -0,0 +1,44 @@ +diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_proto.c infinipath-psm-3.3-26_g604758e_open/ipath/ipath_proto.c +--- infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_proto.c 2020-12-09 09:34:06.556378925 +0100 ++++ infinipath-psm-3.3-26_g604758e_open/ipath/ipath_proto.c 2020-12-09 10:03:27.225580369 +0100 +@@ -37,11 +37,8 @@ + // level infinipath protocol code. + + #include +-#if __GNUC__ <= 6 + #include +-#else + #include +-#endif + #include + #include + #include +diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_time.c infinipath-psm-3.3-26_g604758e_open/ipath/ipath_time.c +--- infinipath-psm-3.3-26_g604758e_open.orig/ipath/ipath_time.c 2019-02-12 05:02:37.000000000 +0100 ++++ infinipath-psm-3.3-26_g604758e_open/ipath/ipath_time.c 2020-12-09 09:34:41.897301872 +0100 +@@ -279,7 +279,7 @@ + #endif + + /* If there's no change (within a small range), just return the old one */ +- if (abs(new_pico_per_cycle - old_pico_per_cycle) < 5) ++ if (new_pico_per_cycle - old_pico_per_cycle < 5) + return old_pico_per_cycle; + + if (ipath_timebase_isvalid(new_pico_per_cycle)) { +diff -ruN infinipath-psm-3.3-26_g604758e_open.orig/ptl_ips/ptl.c infinipath-psm-3.3-26_g604758e_open/ptl_ips/ptl.c +--- infinipath-psm-3.3-26_g604758e_open.orig/ptl_ips/ptl.c 2019-02-12 05:02:38.000000000 +0100 ++++ infinipath-psm-3.3-26_g604758e_open/ptl_ips/ptl.c 2020-12-09 09:43:19.585179426 +0100 +@@ -536,13 +536,6 @@ + + PSMI_INLINE( + void +-ips_lock_shared_context (struct ptl_shared *recvshc)) +-{ +- pthread_spin_lock(recvshc->context_lock); +-} +- +-PSMI_INLINE( +-void + ips_unlock_shared_context (struct ptl_shared *recvshc)) + { + pthread_spin_unlock(recvshc->context_lock); diff --git a/infinipath-psm.spec b/infinipath-psm.spec index 188c7ab..4177ec4 100644 --- a/infinipath-psm.spec +++ b/infinipath-psm.spec @@ -21,9 +21,14 @@ Patch5: 0001-Extend-buffer-for-uvalue-and-pvalue.patch Patch6: extend-fdesc-array.patch Patch7: psm-multiple-definition.patch Patch8: infinipath-psm-gcc11.patch +Patch9: fix-clang-build.patch Requires: udev +%if "%{toolchain}" == "clang" +BuildRequires: clang +%else BuildRequires: gcc +%endif BuildRequires: libuuid-devel BuildRequires: systemd-rpm-macros BuildRequires: make @@ -53,6 +58,7 @@ Development files for the %{name} library. %patch6 -p0 %patch7 -p1 %patch8 -p1 +%patch9 -p1 find libuuid -type f -not -name 'psm_uuid.[c|h]' -not -name Makefile -delete %build