Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 0 additions & 52 deletions 40-psm.rules

This file was deleted.

61 changes: 13 additions & 48 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion compat/40-psm-compat.rules
Original file line number Diff line number Diff line change
Expand Up @@ -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"
10 changes: 0 additions & 10 deletions libpsm2.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down