From 7397e1f325f606710ca5cc3f7fd19eb2e0baf4bb Mon Sep 17 00:00:00 2001 From: Jonathan Calmels Date: Wed, 23 Aug 2017 00:34:02 -0700 Subject: [PATCH] Add deb and rpm packaging --- Dockerfile.centos | 41 ++++++ Dockerfile.ubuntu | 40 ++++++ Makefile | 132 ++++++++++-------- mk/common.mk | 10 +- mk/cuda.repo | 6 + mk/elftoolchain.mk | 1 + mk/libnvidia-container.pc.in | 20 +++ mk/libnvidia-container.pc.m4 | 19 --- mk/libtirpc.mk | 2 +- pkg/deb/changelog | 5 + pkg/deb/compat | 1 + pkg/deb/control | 57 ++++++++ pkg/deb/copyright | 32 +++++ pkg/deb/libnvidia-container-dev.install | 4 + .../libnvidia-container-dev.lintian-overrides | 1 + pkg/deb/libnvidia-container-tools.install | 1 + ...ibnvidia-container-tools.lintian-overrides | 2 + .../libnvidia-container@MAJOR@-dbg.install | 1 + ...dia-container@MAJOR@-dbg.lintian-overrides | 1 + pkg/deb/libnvidia-container@MAJOR@.install | 1 + ...bnvidia-container@MAJOR@.lintian-overrides | 1 + pkg/deb/libnvidia-container@MAJOR@.symbols | 21 +++ pkg/deb/prepare | 30 ++++ pkg/deb/rules | 8 ++ pkg/rpm/SPECS/libnvidia-container.spec | 91 ++++++++++++ 25 files changed, 443 insertions(+), 85 deletions(-) create mode 100644 Dockerfile.centos create mode 100644 Dockerfile.ubuntu create mode 100644 mk/cuda.repo create mode 100755 mk/libnvidia-container.pc.in delete mode 100644 mk/libnvidia-container.pc.m4 create mode 100644 pkg/deb/changelog create mode 100644 pkg/deb/compat create mode 100644 pkg/deb/control create mode 100644 pkg/deb/copyright create mode 100644 pkg/deb/libnvidia-container-dev.install create mode 100644 pkg/deb/libnvidia-container-dev.lintian-overrides create mode 100644 pkg/deb/libnvidia-container-tools.install create mode 100644 pkg/deb/libnvidia-container-tools.lintian-overrides create mode 100644 pkg/deb/libnvidia-container@MAJOR@-dbg.install create mode 100644 pkg/deb/libnvidia-container@MAJOR@-dbg.lintian-overrides create mode 100644 pkg/deb/libnvidia-container@MAJOR@.install create mode 100644 pkg/deb/libnvidia-container@MAJOR@.lintian-overrides create mode 100644 pkg/deb/libnvidia-container@MAJOR@.symbols create mode 100755 pkg/deb/prepare create mode 100755 pkg/deb/rules create mode 100644 pkg/rpm/SPECS/libnvidia-container.spec diff --git a/Dockerfile.centos b/Dockerfile.centos new file mode 100644 index 00000000..10028fbb --- /dev/null +++ b/Dockerfile.centos @@ -0,0 +1,41 @@ +FROM centos:7 + +RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \ + curl -fsSL http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/7fa2af80.pub | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \ + echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict - + +COPY mk/cuda.repo /etc/yum.repos.d/cuda.repo + +RUN yum install -y \ + bzip2 \ + cuda-misc-headers-8-0-8.0.61-1 \ + cuda-nvml-dev-8-0-8.0.61-1 \ + gcc \ + git \ + libcap-devel \ + libseccomp-devel \ + m4 \ + redhat-lsb-core \ + rpm-build \ + rpmlint \ + which && \ + rm -rf /var/cache/yum/* + +RUN cd $(mktemp -d) && \ + curl -fsSL -O https://mirrors.kernel.org/mageia/distrib/6/x86_64/media/core/release/pmake-1.45-16.mga6.x86_64.rpm && \ + curl -fsSL -O https://mirrors.kernel.org/mageia/distrib/6/x86_64/media/core/release/bmake-20161212-1.mga6.x86_64.rpm && \ + rpm -i *.rpm && \ + rm -rf $PWD + +ARG USERSPEC=0:0 + +WORKDIR /tmp/libnvidia-container +COPY . . +RUN chown -R $USERSPEC $PWD +USER $USERSPEC + +RUN make distclean && make -j"$(nproc)" + +ENV DIST_DIR /mnt +VOLUME $DIST_DIR +CMD make dist && make rpm diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu new file mode 100644 index 00000000..964fec52 --- /dev/null +++ b/Dockerfile.ubuntu @@ -0,0 +1,40 @@ +FROM ubuntu:16.04 + +RUN NVIDIA_GPGKEY_SUM=d1be581509378368edeec8c1eb2958702feedf3bc3d17011adbf24efacce4ab5 && \ + NVIDIA_GPGKEY_FPR=ae09fe4bbd223a84b2ccfce3f60f4b3d7fa2af80 && \ + apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub && \ + apt-key adv --export --no-emit-version -a $NVIDIA_GPGKEY_FPR | tail -n +5 > cudasign.pub && \ + echo "$NVIDIA_GPGKEY_SUM cudasign.pub" | sha256sum -c --strict - && rm cudasign.pub && \ + echo "deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64 /" > /etc/apt/sources.list.d/cuda.list + +RUN apt-get update && apt-get install -y --no-install-recommends \ + bmake \ + build-essential \ + bzip2 \ + ca-certificates \ + cuda-misc-headers-8-0=8.0.61-1 \ + cuda-nvml-dev-8-0=8.0.61-1 \ + curl \ + devscripts \ + dh-make \ + fakeroot \ + git \ + libcap-dev \ + libseccomp-dev \ + lintian \ + lsb-release \ + m4 && \ + rm -rf /var/lib/apt/lists/* + +ARG USERSPEC=0:0 + +WORKDIR /tmp/libnvidia-container +COPY . . +RUN chown -R $USERSPEC $PWD +USER $USERSPEC + +RUN make distclean && make -j"$(nproc)" + +ENV DIST_DIR /mnt +VOLUME $DIST_DIR +CMD make dist && make deb diff --git a/Makefile b/Makefile index ebcbfda5..6d4b9aa9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. # -.PHONY: all utils shared static deps install uninstall dist depsclean mostlyclean clean distclean +.PHONY: all tools shared static deps install uninstall dist depsclean mostlyclean clean distclean .DEFAULT_GOAL := all ##### Global variables ##### @@ -12,12 +12,21 @@ WITH_SECCOMP ?= 1 ##### Global definitions ##### -export CUDA_DIR ?= /usr/local/cuda-8.0 -export SRCS_DIR ?= $(CURDIR)/src -export DEPS_DIR ?= $(CURDIR)/deps -export DIST_DIR ?= $(CURDIR)/dist -export MAKE_DIR ?= $(CURDIR)/mk -export DEBUG_DIR ?= $(CURDIR)/.debug +export prefix = /usr/local +export exec_prefix = $(prefix) +export bindir = $(exec_prefix)/bin +export libdir = $(exec_prefix)/lib +export libdbgdir = $(prefix)/lib/debug$(libdir) +export includedir = $(prefix)/include +export pkgconfdir = $(libdir)/pkgconfig + +export CUDA_DIR ?= /usr/local/cuda-8.0 +export PKG_DIR ?= $(CURDIR)/pkg +export SRCS_DIR ?= $(CURDIR)/src +export DEPS_DIR ?= $(CURDIR)/deps +export DIST_DIR ?= $(CURDIR)/dist +export MAKE_DIR ?= $(CURDIR)/mk +export DEBUG_DIR ?= $(CURDIR)/.debug include $(MAKE_DIR)/common.mk @@ -66,11 +75,15 @@ BIN_SRCS := $(SRCS_DIR)/nvc_cli.c \ $(SRCS_DIR)/utils.c LIB_SCRIPT = $(SRCS_DIR)/$(LIB_NAME).lds -BIN_SCRIPT = $(SRCS_DIR)/$(BIN_UTILS).lds +BIN_SCRIPT = $(SRCS_DIR)/$(BIN_NAME).lds ##### Target definitions ##### -ARCH := x86_64 +ifneq ($(wildcard /etc/debian_version),) +ARCH ?= amd64 +else +ARCH ?= x86_64 +endif MAJOR := $(call getdef,NVC_MAJOR,$(LIB_INCS)) MINOR := $(call getdef,NVC_MINOR,$(LIB_INCS)) PATCH := $(call getdef,NVC_PATCH,$(LIB_INCS)) @@ -86,7 +99,7 @@ ifeq ($(PATCH),) $(error Invalid patch version) endif -BIN_UTILS := nvidia-container-cli +BIN_NAME := nvidia-container-cli LIB_NAME := libnvidia-container LIB_STATIC := $(LIB_NAME).a LIB_SHARED := $(LIB_NAME).so.$(VERSION) @@ -97,7 +110,6 @@ LIB_PKGCFG := $(LIB_NAME).pc ##### Flags definitions ##### # Common flags -ARFLAGS := -rU CPPFLAGS := -D_GNU_SOURCE -D_FORTIFY_SOURCE=2 $(CPPFLAGS) CFLAGS := -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fstack-protector -fno-strict-aliasing -fvisibility=hidden \ -Wall -Wextra -Wcast-align -Wpointer-arith -Wmissing-prototypes -Wnonnull \ @@ -105,41 +117,35 @@ CFLAGS := -std=gnu11 -O2 -g -fdata-sections -ffunction-sections -fstack-protec -Wstrict-prototypes -Wunreachable-code -Wconversion -Wsign-conversion \ -Wno-unknown-warning-option -Wno-format-extra-args -Wno-gnu-alignof-expression $(CFLAGS) LDFLAGS := -Wl,-zrelro -Wl,-znow -Wl,-zdefs -Wl,--gc-sections $(LDFLAGS) - -# Library flags -_LIB_CPPFLAGS := -DNV_LINUX -isystem $(CUDA_DIR)/include -isystem $(DEPS_DIR)/usr/local/include -include $(BUILD_DEFS) -_LIB_CFLAGS := -fPIC -_LIB_LDFLAGS := -L$(DEPS_DIR)/usr/local/lib -shared -Wl,-soname=$(LIB_SONAME) -_LIB_LDLIBS_STATIC := -l:libelf.a -l:libnvidia-modprobe-utils.a -_LIB_LDLIBS_SHARED := -ldl -lcap +LDLIBS := $(LDLIBS) + +# Library flags (recursively expanded to handle target-specific flags) +LIB_CPPFLAGS = -DNV_LINUX -isystem $(CUDA_DIR)/include -isystem $(DEPS_DIR)$(includedir) -include $(BUILD_DEFS) +LIB_CFLAGS = -fPIC +LIB_LDFLAGS = -L$(DEPS_DIR)$(libdir) -shared -Wl,-soname=$(LIB_SONAME) +LIB_LDLIBS_STATIC = -l:libelf.a -l:libnvidia-modprobe-utils.a +LIB_LDLIBS_SHARED = -ldl -lcap ifeq ($(WITH_TIRPC), 1) -_LIB_CPPFLAGS += -isystem $(DEPS_DIR)/usr/local/include/tirpc -DWITH_TIRPC -_LIB_LDLIBS_STATIC += -l:libtirpc.a -_LIB_LDLIBS_SHARED += -lpthread +LIB_CPPFLAGS += -isystem $(DEPS_DIR)$(includedir)/tirpc -DWITH_TIRPC +LIB_LDLIBS_STATIC += -l:libtirpc.a +LIB_LDLIBS_SHARED += -lpthread endif ifeq ($(WITH_SECCOMP), 1) -_LIB_CPPFLAGS += -DWITH_SECCOMP -_LIB_LDLIBS_SHARED += -lseccomp +LIB_CPPFLAGS += -DWITH_SECCOMP +LIB_LDLIBS_SHARED += -lseccomp endif -_LIB_LDLIBS := $(_LIB_LDLIBS_STATIC) $(_LIB_LDLIBS_SHARED) -# Library flags + common flags (recursively expanded to handle target-specific flags) -LIB_CPPFLAGS = $(_LIB_CPPFLAGS) $(CPPFLAGS) -LIB_CFLAGS = $(_LIB_CFLAGS) $(CFLAGS) -LIB_LDFLAGS = $(_LIB_LDFLAGS) $(LDFLAGS) -LIB_LDLIBS_STATIC = $(_LIB_LDLIBS_STATIC) -LIB_LDLIBS_SHARED = $(_LIB_LDLIBS_SHARED) $(LDLIBS) -LIB_LDLIBS = $(_LIB_LDLIBS) $(LDLIBS) - -# Binary flags -_BIN_CPPFLAGS := -include $(BUILD_DEFS) -_BIN_CFLAGS := -fPIE -flto -_BIN_LDFLAGS := -L. -pie -_BIN_LDLIBS := -l:$(LIB_SHARED) -lcap -# Binary flags + common flags (recursively expanded to handle target-specific flags) -BIN_CPPFLAGS = $(_BIN_CPPFLAGS) $(CPPFLAGS) -BIN_CFLAGS = $(_BIN_CFLAGS) $(CFLAGS) -BIN_LDFLAGS = $(_BIN_LDFLAGS) $(LDFLAGS) -BIN_LDLIBS = $(_BIN_LDLIBS) $(LDLIBS) +LIB_CPPFLAGS += $(CPPFLAGS) +LIB_CFLAGS += $(CFLAGS) +LIB_LDFLAGS += $(LDFLAGS) +LIB_LDLIBS_STATIC += +LIB_LDLIBS_SHARED += $(LDLIBS) +LIB_LDLIBS = $(LIB_LDLIBS_STATIC) $(LIB_LDLIBS_SHARED) + +# Binary flags (recursively expanded to handle target-specific flags) +BIN_CPPFLAGS = -include $(BUILD_DEFS) $(CPPFLAGS) +BIN_CFLAGS = -fPIE -flto $(CFLAGS) +BIN_LDFLAGS = -L. -pie $(LDFLAGS) +BIN_LDLIBS = -l:$(LIB_SHARED) -lcap $(LDLIBS) $(word 1,$(LIB_RPC_SRCS)): RPCGENFLAGS=-h $(word 2,$(LIB_RPC_SRCS)): RPCGENFLAGS=-c @@ -181,33 +187,31 @@ $(LIB_SHARED): $(LIB_OBJS) $(LIB_STATIC_OBJ): $(LIB_OBJS) # FIXME Handle user-defined LDFLAGS and LDLIBS - $(LD) -d -r --exclude-libs ALL -L$(DEPS_DIR)/usr/local/lib $(OUTPUT_OPTION) $^ $(LIB_LDLIBS_STATIC) + $(LD) -d -r --exclude-libs ALL -L$(DEPS_DIR)$(libdir) $(OUTPUT_OPTION) $^ $(LIB_LDLIBS_STATIC) $(OBJCPY) --localize-hidden $@ $(STRIP) --strip-unneeded -R .comment $@ -$(BIN_UTILS): $(BIN_OBJS) +$(BIN_NAME): $(BIN_OBJS) $(CC) $(BIN_CFLAGS) $(BIN_CPPFLAGS) $(BIN_LDFLAGS) $(OUTPUT_OPTION) $^ $(BIN_SCRIPT) $(BIN_LDLIBS) $(STRIP) --strip-unneeded -R .comment $@ ##### Public rules ##### -all: release +all: CPPFLAGS += -DNDEBUG +all: shared static tools debug: CFLAGS += -pedantic -fsanitize=undefined -fno-omit-frame-pointer -fno-common debug: LDLIBS += -lubsan debug: STRIP := @echo skipping: strip -debug: shared static utils - -release: CPPFLAGS += -DNDEBUG -release: shared static utils +debug: shared static tools -utils: $(BIN_UTILS) +tools: $(BIN_NAME) shared: $(LIB_SHARED) static: $(LIB_STATIC)($(LIB_STATIC_OBJ)) -deps: export DESTDIR=$(DEPS_DIR) +deps: export DESTDIR:=$(DEPS_DIR) deps: $(LIB_RPC_SRCS) $(BUILD_DEFS) $(MKDIR) -p $(DEPS_DIR) $(MAKE) -f $(MAKE_DIR)/elftoolchain.mk install @@ -228,9 +232,9 @@ install: all # Install debugging symbols $(INSTALL) -m 644 $(DEBUG_DIR)/$(LIB_SONAME) $(DESTDIR)$(libdbgdir) # Install configuration files - $(M4) -D'$$VERSION=$(strip $(VERSION))' -D'$$PRIVATE_LIBS=$(strip $(LIB_LDLIBS_SHARED))' $(MAKE_DIR)/$(LIB_PKGCFG).m4 > $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG) + $(MAKE_DIR)/$(LIB_PKGCFG).in "$(strip $(VERSION))" "$(strip $(LIB_LDLIBS_SHARED))" > $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG) # Install binary files - $(INSTALL) -m 755 $(BIN_UTILS) $(DESTDIR)$(bindir) + $(INSTALL) -m 755 $(BIN_NAME) $(DESTDIR)$(bindir) uninstall: # Uninstall header files @@ -242,9 +246,9 @@ uninstall: # Uninstall configuration files $(RM) $(DESTDIR)$(pkgconfdir)/$(LIB_PKGCFG) # Uninstall binary files - $(RM) $(DESTDIR)$(bindir)/$(BIN_UTILS) + $(RM) $(DESTDIR)$(bindir)/$(BIN_NAME) -dist: DESTDIR=$(DIST_DIR)/$(LIB_NAME)_$(VERSION) +dist: DESTDIR:=$(DIST_DIR)/$(LIB_NAME)_$(VERSION)$(addprefix -,$(TAG)) dist: install $(TAR) -C $(dir $(DESTDIR)) -caf $(DESTDIR)_$(ARCH).tar.xz $(notdir $(DESTDIR)) $(RM) -r $(DESTDIR) @@ -264,4 +268,20 @@ clean: mostlyclean depsclean distclean: clean $(RM) -r $(DEPS_DIR) $(DIST_DIR) $(DEBUG_DIR) - $(RM) $(LIB_RPC_SRCS) $(LIB_STATIC) $(LIB_SHARED) $(BIN_UTILS) + $(RM) $(LIB_RPC_SRCS) $(LIB_STATIC) $(LIB_SHARED) $(BIN_NAME) + +deb: DESTDIR:=$(DIST_DIR)/$(LIB_NAME)_$(VERSION)_$(ARCH) +deb: prefix:=/usr +deb: libdir:=/usr/lib/@DEB_HOST_MULTIARCH@ +deb: install + $(CP) -T $(PKG_DIR)/deb $(DESTDIR)/debian + cd $(DESTDIR) && debuild -eDISTRIB -eSECTION --dpkg-buildpackage-hook='debian/prepare %v' -a $(ARCH) -us -uc -B + cd $(DESTDIR) && debuild clean + +rpm: DESTDIR:=$(DIST_DIR)/$(LIB_NAME)_$(VERSION)_$(ARCH) +rpm: all + $(CP) -T $(PKG_DIR)/rpm $(DESTDIR) + $(LN) -nsf $(CURDIR) $(DESTDIR)/BUILD + $(MKDIR) -p $(DESTDIR)/RPMS && $(LN) -nsf $(DIST_DIR) $(DESTDIR)/RPMS/$(ARCH) + cd $(DESTDIR) && rpmbuild --clean --target=$(ARCH) -bb -D"_topdir $(DESTDIR)" -D"_version $(VERSION)" -D"_tag $(TAG)" -D"_major $(MAJOR)" SPECS/* + -cd $(DESTDIR) && rpmlint RPMS/* diff --git a/mk/common.mk b/mk/common.mk index 9f0e9510..bdaaab2e 100644 --- a/mk/common.mk +++ b/mk/common.mk @@ -2,17 +2,9 @@ # Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. # -export prefix ?= /usr/local -export exec_prefix ?= $(prefix) -export bindir ?= $(exec_prefix)/bin -export libdir ?= $(exec_prefix)/lib -export libdbgdir ?= $(libdir)/debug/$(libdir) -export includedir ?= $(prefix)/include -export pkgconfdir ?= $(libdir)/pkgconfig - MV ?= mv -f +CP ?= cp -a LN ?= ln -M4 ?= m4 TAR ?= tar CURL ?= curl MKDIR ?= mkdir diff --git a/mk/cuda.repo b/mk/cuda.repo new file mode 100644 index 00000000..61d858ba --- /dev/null +++ b/mk/cuda.repo @@ -0,0 +1,6 @@ +[cuda] +name=cuda +baseurl=http://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64 +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA \ No newline at end of file diff --git a/mk/elftoolchain.mk b/mk/elftoolchain.mk index 939725f5..a7a92115 100644 --- a/mk/elftoolchain.mk +++ b/mk/elftoolchain.mk @@ -8,6 +8,7 @@ include $(MAKE_DIR)/common.mk export MKSHARE := no export MKPROFILE := no +export LORDER := echo export INSTALL := $(INSTALL) -D export BINOWN := $(shell id -u) export BINGRP := $(shell id -g) diff --git a/mk/libnvidia-container.pc.in b/mk/libnvidia-container.pc.in new file mode 100755 index 00000000..316e17b3 --- /dev/null +++ b/mk/libnvidia-container.pc.in @@ -0,0 +1,20 @@ +#! /bin/sh + +set -u + +VERSION="$1" +PRIVATE_LIBS="$2" + +cat < Tue, 05 Sep 2017 14:31:33 -0700 diff --git a/pkg/deb/compat b/pkg/deb/compat new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/pkg/deb/compat @@ -0,0 +1 @@ +9 diff --git a/pkg/deb/control b/pkg/deb/control new file mode 100644 index 00000000..f24dec54 --- /dev/null +++ b/pkg/deb/control @@ -0,0 +1,57 @@ +Source: libnvidia-container +Build-Depends: debhelper (>=9) +Standards-Version: 3.9.6 +Maintainer: NVIDIA CORPORATION +Homepage: https://github.com/NVIDIA/libnvidia-container + +Package: libnvidia-container@MAJOR@ +Section: @SECTION@libs +Priority: optional +Architecture: any +Multi-Arch: same +Pre-Depends: ${misc:Pre-Depends} +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: NVIDIA container runtime library + The nvidia-container library provides an interface to configure GNU/Linux + containers leveraging NVIDIA hardware. The implementation relies on several + kernel subsystems and is designed to be agnostic of the container runtime. + . + This package requires the NVIDIA driver (>= 340.29) to be installed separately. + +Package: libnvidia-container-dev +Section: @SECTION@libdevel +Priority: optional +Architecture: any +Multi-Arch: same +Depends: libnvidia-container@MAJOR@ (= ${binary:Version}), ${misc:Depends} +Description: NVIDIA container runtime library (development files) + The nvidia-container library provides an interface to configure GNU/Linux + containers leveraging NVIDIA hardware. The implementation relies on several + kernel subsystems and is designed to be agnostic of the container runtime. + . + This package contains the files required to compile programs with the library. + +Package: libnvidia-container@MAJOR@-dbg +Section: @SECTION@debug +Priority: extra +Architecture: any +Multi-Arch: same +Depends: libnvidia-container@MAJOR@ (= ${binary:Version}), ${misc:Depends} +Description: NVIDIA container runtime library (debugging symbols) + The nvidia-container library provides an interface to configure GNU/Linux + containers leveraging NVIDIA hardware. The implementation relies on several + kernel subsystems and is designed to be agnostic of the container runtime. + . + This package contains the debugging symbols for the library. + +Package: libnvidia-container-tools +Section: @SECTION@utils +Priority: optional +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: NVIDIA container runtime library (command-line tools) + The nvidia-container library provides an interface to configure GNU/Linux + containers leveraging NVIDIA hardware. The implementation relies on several + kernel subsystems and is designed to be agnostic of the container runtime. + . + This package contains command-line tools that facilitate using the library. diff --git a/pkg/deb/copyright b/pkg/deb/copyright new file mode 100644 index 00000000..ac82fdb2 --- /dev/null +++ b/pkg/deb/copyright @@ -0,0 +1,32 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: libnvidia-container +Source: https://github.com/NVIDIA/libnvidia-container + +Files: * +Copyright: 2017 NVIDIA CORPORATION +License: BSD-3-Clause + +License: BSD-3-Clause +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 NVIDIA 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 ``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. diff --git a/pkg/deb/libnvidia-container-dev.install b/pkg/deb/libnvidia-container-dev.install new file mode 100644 index 00000000..3445e65c --- /dev/null +++ b/pkg/deb/libnvidia-container-dev.install @@ -0,0 +1,4 @@ +usr/include/*.h +usr/lib/@DEB_HOST_MULTIARCH@/lib*.so +usr/lib/@DEB_HOST_MULTIARCH@/lib*.a +usr/lib/@DEB_HOST_MULTIARCH@/pkgconfig/*.pc diff --git a/pkg/deb/libnvidia-container-dev.lintian-overrides b/pkg/deb/libnvidia-container-dev.lintian-overrides new file mode 100644 index 00000000..b5de7f67 --- /dev/null +++ b/pkg/deb/libnvidia-container-dev.lintian-overrides @@ -0,0 +1 @@ +new-package-should-close-itp-bug diff --git a/pkg/deb/libnvidia-container-tools.install b/pkg/deb/libnvidia-container-tools.install new file mode 100644 index 00000000..1df36c61 --- /dev/null +++ b/pkg/deb/libnvidia-container-tools.install @@ -0,0 +1 @@ +usr/bin/* diff --git a/pkg/deb/libnvidia-container-tools.lintian-overrides b/pkg/deb/libnvidia-container-tools.lintian-overrides new file mode 100644 index 00000000..52373fbc --- /dev/null +++ b/pkg/deb/libnvidia-container-tools.lintian-overrides @@ -0,0 +1,2 @@ +new-package-should-close-itp-bug +binary-without-manpage diff --git a/pkg/deb/libnvidia-container@MAJOR@-dbg.install b/pkg/deb/libnvidia-container@MAJOR@-dbg.install new file mode 100644 index 00000000..3eac1f1d --- /dev/null +++ b/pkg/deb/libnvidia-container@MAJOR@-dbg.install @@ -0,0 +1 @@ +usr/lib/debug/usr/lib/@DEB_HOST_MULTIARCH@/lib*.so.* diff --git a/pkg/deb/libnvidia-container@MAJOR@-dbg.lintian-overrides b/pkg/deb/libnvidia-container@MAJOR@-dbg.lintian-overrides new file mode 100644 index 00000000..b5de7f67 --- /dev/null +++ b/pkg/deb/libnvidia-container@MAJOR@-dbg.lintian-overrides @@ -0,0 +1 @@ +new-package-should-close-itp-bug diff --git a/pkg/deb/libnvidia-container@MAJOR@.install b/pkg/deb/libnvidia-container@MAJOR@.install new file mode 100644 index 00000000..2bbe7b17 --- /dev/null +++ b/pkg/deb/libnvidia-container@MAJOR@.install @@ -0,0 +1 @@ +usr/lib/@DEB_HOST_MULTIARCH@/lib*.so.* diff --git a/pkg/deb/libnvidia-container@MAJOR@.lintian-overrides b/pkg/deb/libnvidia-container@MAJOR@.lintian-overrides new file mode 100644 index 00000000..b5de7f67 --- /dev/null +++ b/pkg/deb/libnvidia-container@MAJOR@.lintian-overrides @@ -0,0 +1 @@ +new-package-should-close-itp-bug diff --git a/pkg/deb/libnvidia-container@MAJOR@.symbols b/pkg/deb/libnvidia-container@MAJOR@.symbols new file mode 100644 index 00000000..8961b961 --- /dev/null +++ b/pkg/deb/libnvidia-container@MAJOR@.symbols @@ -0,0 +1,21 @@ +libnvidia-container.so.1 libnvidia-container1 #MINVER# + NVC_1.0@NVC_1.0 1.0.0~alpha.1 + nvc_config_free@NVC_1.0 1.0.0~alpha.1 + nvc_config_new@NVC_1.0 1.0.0~alpha.1 + nvc_container_config_free@NVC_1.0 1.0.0~alpha.1 + nvc_container_config_new@NVC_1.0 1.0.0~alpha.1 + nvc_container_free@NVC_1.0 1.0.0~alpha.1 + nvc_container_new@NVC_1.0 1.0.0~alpha.1 + nvc_context_free@NVC_1.0 1.0.0~alpha.1 + nvc_context_new@NVC_1.0 1.0.0~alpha.1 + nvc_device_info_free@NVC_1.0 1.0.0~alpha.1 + nvc_device_info_new@NVC_1.0 1.0.0~alpha.1 + nvc_device_mount@NVC_1.0 1.0.0~alpha.1 + nvc_driver_info_free@NVC_1.0 1.0.0~alpha.1 + nvc_driver_info_new@NVC_1.0 1.0.0~alpha.1 + nvc_driver_mount@NVC_1.0 1.0.0~alpha.1 + nvc_error@NVC_1.0 1.0.0~alpha.1 + nvc_init@NVC_1.0 1.0.0~alpha.1 + nvc_ldcache_update@NVC_1.0 1.0.0~alpha.1 + nvc_shutdown@NVC_1.0 1.0.0~alpha.1 + nvc_version@NVC_1.0 1.0.0~alpha.1 diff --git a/pkg/deb/prepare b/pkg/deb/prepare new file mode 100755 index 00000000..9f521545 --- /dev/null +++ b/pkg/deb/prepare @@ -0,0 +1,30 @@ +#! /bin/bash + +set -e + +# Replace templated files/contents according to the package version and architecture. +# Also set the package distribution and section area if the environment specifies it. + +VERSION=${1%%[-~+]*} +MAJOR=${1%%.*} + +if [ -z "$VERSION" ] || [ -z "$MAJOR" ] || [ -z "$DEB_HOST_MULTIARCH" ]; then + echo "Error: invalid package version or architecture" + exit 1 +fi + +find . -type d -name '*@DEB_HOST_MULTIARCH@*' | sed "p;s;@DEB_HOST_MULTIARCH@;$DEB_HOST_MULTIARCH;" | \ + xargs -r -n2 sh -c 'rm -rf $1 && mv -T $0 $1' + +find . -type f -name '*@MAJOR@*' | sed "p;s;@MAJOR@;$MAJOR;" | \ + xargs -r -n2 sh -c 'rm -f $1 && mv -T $0 $1' + +grep -rIlE '@(SECTION|VERSION|MAJOR|DEB_HOST_MULTIARCH)@' . | \ + xargs -r sed -i "s;@SECTION@;${SECTION:+$SECTION/}; + s;@VERSION@;$VERSION; + s;@MAJOR@;$MAJOR; + s;@DEB_HOST_MULTIARCH@;$DEB_HOST_MULTIARCH;" + +if [ -n "$DISTRIB" ]; then + sed -i "s;UNRELEASED;$DISTRIB;" debian/changelog +fi diff --git a/pkg/deb/rules b/pkg/deb/rules new file mode 100755 index 00000000..f330c2a7 --- /dev/null +++ b/pkg/deb/rules @@ -0,0 +1,8 @@ +#!/usr/bin/make -f +#export DH_VERBOSE = 1 + +override_dh_fixperms: + dh_fixperms -X libnvidia-container.so.@VERSION@ + +%: + dh $@ diff --git a/pkg/rpm/SPECS/libnvidia-container.spec b/pkg/rpm/SPECS/libnvidia-container.spec new file mode 100644 index 00000000..1ea7e638 --- /dev/null +++ b/pkg/rpm/SPECS/libnvidia-container.spec @@ -0,0 +1,91 @@ +Name: libnvidia-container +License: BSD +Vendor: NVIDIA CORPORATION +Packager: NVIDIA CORPORATION +URL: https://github.com/NVIDIA/libnvidia-container +BuildRequires: make bmake +Version: %{_version} +Release: 0.1%{?_tag:.%_tag} +Summary: NVIDIA container runtime library +%description +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +%install +DESTDIR=%{buildroot} %{__make} install prefix=%{_prefix} exec_prefix=%{_exec_prefix} bindir=%{_bindir} libdir=%{_libdir} includedir=%{_includedir} +install -d -m 755 %{buildroot}%{_licensedir}/%{name}-%{version} +install -m 644 LICENSE %{buildroot}%{_licensedir}/%{name}-%{version} + +%package -n %{name}%{_major} +Summary: NVIDIA container runtime library +%description -n %{name}%{_major} +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +This package requires the NVIDIA driver (>= 340.29) to be installed separately. +%post -n %{name}%{_major} -p /sbin/ldconfig +%postun -n %{name}%{_major} -p /sbin/ldconfig +%files -n %{name}%{_major} +%license %{_licensedir}/* +%{_libdir}/lib*.so.* + +%package devel +Requires: %{name}%{_major}%{?_isa} = %{version}-%{release} +Summary: NVIDIA container runtime library (development files) +%description devel +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +This package contains the files required to compile programs with the library. +%files devel +%license %{_licensedir}/* +%{_includedir}/*.h +%{_libdir}/lib*.so +%{_libdir}/pkgconfig/*.pc + +%package static +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Summary: NVIDIA container runtime library (static library) +%description static +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +This package requires the NVIDIA driver (>= 340.29) to be installed separately. +%files static +%license %{_licensedir}/* +%{_libdir}/lib*.a + +%define debug_package %{nil} +%package -n %{name}%{_major}-debuginfo +Requires: %{name}%{_major}%{?_isa} = %{version}-%{release} +Summary: NVIDIA container runtime library (debugging symbols) +%description -n %{name}%{_major}-debuginfo +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +This package contains the debugging symbols for the library. +%files -n %{name}%{_major}-debuginfo +%license %{_licensedir}/* +%{_prefix}/lib/debug%{_libdir}/lib*.so.* + +%package tools +Requires: %{name}%{_major}%{?_isa} >= %{version}-%{release} +Summary: NVIDIA container runtime library (command-line tools) +%description tools +The nvidia-container library provides an interface to configure GNU/Linux +containers leveraging NVIDIA hardware. The implementation relies on several +kernel subsystems and is designed to be agnostic of the container runtime. + +This package contains command-line tools that facilitate using the library. +%files tools +%license %{_licensedir}/* +%{_bindir}/* + +%changelog +* Tue Sep 05 2017 NVIDIA CORPORATION 1.0.0-0.1.alpha.1 +- Initial release