diff --git a/40-psm.rules b/40-psm.rules deleted file mode 100644 index ba8d494..0000000 --- a/40-psm.rules +++ /dev/null @@ -1,52 +0,0 @@ -# -# This file is provided under a dual BSD/GPLv2 license. When using or -# redistributing this file, you may do so under either license. -# -# GPL LICENSE SUMMARY -# -# Copyright(c) 2015 Intel Corporation. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of version 2 of the GNU General Public License as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# Contact Information: -# Intel Corporation, www.intel.com -# -# BSD LICENSE -# -# Copyright(c) 2015 Intel Corporation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in -# the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Intel Corporation nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -KERNEL=="hfi1", MODE="0666" -KERNEL=="hfi1_[0-9]", MODE="0666" diff --git a/Makefile b/Makefile index 9faeb73..ca98929 100644 --- a/Makefile +++ b/Makefile @@ -157,45 +157,24 @@ MINOR := $(PSM2_LIB_MINOR) nthreads := $(shell echo $$(( `nproc` * 2 )) ) -# The following line sets the DISTRO variable to: -# 'rhel' if the host is running RHEL. -# 'suse' if the host is running SUSE. -# 'fedora' if the host is running Fedora. -# 'ubuntu' if the host is running Ubuntu. -# -# The DISTRO variable is used subsequently for variable -# behaviors of the 3 distros. - -DISTRO := $(shell . /etc/os-release; if [ "$$ID" = "sle_hpc" ]; then ID="sles"; fi; echo $$ID) - -# By default the following two variables have the following values: -LIBPSM2_COMPAT_CONF_DIR := /etc -LIBPSM2_COMPAT_SYM_CONF_DIR := /etc -# We can't set SPEC_FILE_RELEASE_DIST to an empty value, a space will result. -# It then messes up sed operations for PSM_CUDA=1. -# So leaving the commented out line here as documentation to NOT set it. -# SPEC_FILE_RELEASE_DIST := -UDEV_40_PSM_RULES := %{_udevrulesdir}/40-psm.rules - -ifeq (fedora,$(DISTRO)) - # On Fedora, we change these two variables to these values: - LIBPSM2_COMPAT_CONF_DIR := /usr/lib - LIBPSM2_COMPAT_SYM_CONF_DIR := %{_prefix}/lib - SPEC_FILE_RELEASE_DIST := %{?dist} - UDEV_40_PSM_RULES :=# -else ifeq (rhel,${DISTRO}) - # Insert code specific to RHEL here. -else ifeq (sles,${DISTRO}) - # Insert code specific to SLES here. -endif +PKG_CONFIG ?= pkg-config + +# Detect where kmod looks for packaged config files. +# If that fails, default to /lib, which should work on all distros since 2011, +# with or without /usr-merge. +LIBPSM2_COMPAT_CONF_DIR := $(or $(shell $(PKG_CONFIG) --variable=distconfdir kmod 2>/dev/null),/lib) +export LIBPSM2_COMPAT_CONF_DIR + +LIBPSM2_COMPAT_SYM_CONF_DIR := $(patsubst /usr%,\%{_prefix}%,$(LIBPSM2_COMPAT_CONF_DIR)) + +# Set %{?dist} on Fedora and Fedora-like distributions (ID or ID_LIKE contains "fedora"). +SPEC_FILE_RELEASE_DIST := $(shell . /etc/os-release; echo "$$ID $$ID_LIKE" | grep -qw fedora && echo '%{?dist}') ifdef PSM_CUDA #Value needs to be something without spaces or dashes '-' -SPEC_FILE_RELEASE_DIST += cuda +SPEC_FILE_RELEASE_DIST := $(SPEC_FILE_RELEASE_DIST)cuda endif -export LIBPSM2_COMPAT_CONF_DIR - # The desired version number comes from the most recent tag starting with "v" ifeq (true, $(shell git rev-parse --is-inside-work-tree 2>/dev/null)) ISGIT := 1 # Cache the result for later @@ -250,8 +229,6 @@ endif LDLIBS := -lrt -ldl -lnuma ${EXTRA_LIBS} -pthread -PKG_CONFIG ?= pkg-config - UDEVDIR := $(shell $(PKG_CONFIG) --variable=udevdir udev 2>/dev/null) ifndef UDEVDIR UDEVDIR = /lib/udev @@ -416,9 +393,6 @@ install: all install -m 0644 -D psm2.h ${DESTDIR}/usr/include/psm2.h install -m 0644 -D psm2_mq.h ${DESTDIR}/usr/include/psm2_mq.h install -m 0644 -D psm2_am.h ${DESTDIR}/usr/include/psm2_am.h -ifneq (fedora,${DISTRO}) - install -m 0644 -D 40-psm.rules ${DESTDIR}$(UDEVDIR)/rules.d/40-psm.rules -endif # The following files and dirs were part of the noship rpm: mkdir -p ${DESTDIR}/usr/include/hfi1diag mkdir -p ${DESTDIR}/usr/include/hfi1diag/linux-x86_64 @@ -451,21 +425,12 @@ specfile: specfile_clean | $(OUTDIR) sed -e 's/@TARGLIB@/'${TARGLIB}'/g' \ -e 's/@RPM_NAME@/'${RPM_NAME}'/g' \ -e 's/@RPM_NAME_BASEEXT@/'${RPM_NAME_BASEEXT}'/g' \ - -e 's/@COMPATLIB@/'${COMPATLIB}'/g' \ - -e 's/@COMPATMAJOR@/'${COMPATMAJOR}'/g' \ - -e 's;@UDEVDIR@;'${UDEVDIR}';g' \ -e 's/@MAJOR@/'${MAJOR}'/g' \ -e 's/@MINOR@/'${MINOR}'/g' \ - -e 's:@LIBPSM2_COMPAT_CONF_DIR@:'${LIBPSM2_COMPAT_CONF_DIR}':g' \ -e 's:@LIBPSM2_COMPAT_SYM_CONF_DIR@:'${LIBPSM2_COMPAT_SYM_CONF_DIR}':g' \ -e 's;@SPEC_FILE_RELEASE_DIST@;'${SPEC_FILE_RELEASE_DIST}';g' \ -e 's/@DIST_SHA@/'${DIST_SHA}'/g' > \ ${OUTDIR}/${RPM_NAME}.spec - if [ -f /etc/redhat-release ] && [ `grep -o "[0-9.]*" /etc/redhat-release | cut -d"." -f1` -lt 7 ]; then \ - sed -i 's;@40_PSM_RULES@;'${UDEVDIR}'/rules.d/40-psm.rules;g' ${OUTDIR}/${RPM_NAME}.spec; \ - else \ - sed -i 's;@40_PSM_RULES@;'${UDEV_40_PSM_RULES}';g' ${OUTDIR}/${RPM_NAME}.spec; \ - fi # We can't totally prevent two make dist calls in a row from packaging # the previous make dist, unless we switch to using a dedicated ./src folder diff --git a/compat/40-psm-compat.rules b/compat/40-psm-compat.rules index fc7c4b1..39a2dfd 100644 --- a/compat/40-psm-compat.rules +++ b/compat/40-psm-compat.rules @@ -49,4 +49,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # KERNEL=="hfi1", SYMLINK+="ipath" -KERNEL=="hfi1_[0-9]", MODE="0666", SYMLINK+="ipath" +KERNEL=="hfi1_[0-9]", SYMLINK+="ipath" diff --git a/libpsm2.spec.in b/libpsm2.spec.in index 51f683f..44d9b91 100644 --- a/libpsm2.spec.in +++ b/libpsm2.spec.in @@ -81,12 +81,10 @@ Provides: @RPM_NAME@%{_isa} = %{version}-%{release} BuildRequires: libnuma-devel Requires: libnuma1 %else -%if 0%{?rhel}==0 || 0%{?rhel} > 6 BuildRequires: systemd BuildRequires: numactl-devel Requires: numactl-libs %endif -%endif %package -n @RPM_NAME@-devel Summary: Development files for Cornelis PSM2 @@ -147,13 +145,9 @@ make %{?_smp_mflags} %postun -p /sbin/ldconfig %files -n @RPM_NAME@@RPM_NAME_BASEEXT@ -%if 0%{?rhel} && 0%{?rhel} < 7 -%{!?_licensedir:%global license %doc} -%endif %license COPYING %{_libdir}/@TARGLIB@.so.@MAJOR@.@MINOR@ %{_libdir}/@TARGLIB@.so.@MAJOR@ -@40_PSM_RULES@ %files -n @RPM_NAME@-devel %{_libdir}/@TARGLIB@.so @@ -165,11 +159,7 @@ make %{?_smp_mflags} %files -n @RPM_NAME@-compat %{_libdir}/psm2-compat -%if 0%{?rhel} && 0%{?rhel} < 7 -@UDEVDIR@/rules.d/40-psm-compat.rules -%else %{_udevrulesdir}/40-psm-compat.rules -%endif @LIBPSM2_COMPAT_SYM_CONF_DIR@/modprobe.d/libpsm2-compat.conf %{_prefix}/lib/libpsm2