#!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # cuda-gdb/README mentions --enable-targets="x86_64-unknown-linux-gnu,arm-elf-linux-gnu,m68k-unknown-linux-gnu" CUDA_GDB_FLAGS = CUDA_GDB_FLAGS += --program-prefix=cuda- CUDA_GDB_FLAGS += --with-gdb-datadir='$${prefix}/share/cuda-gdb' CUDA_GDB_FLAGS += --with-jit-reader-dir='$${libdir}/cuda-gdb' CUDA_GDB_FLAGS += --with-system-gdbinit='$${sysconfdir}/cuda-gdb/gdbinit' CUDA_GDB_FLAGS += --with-system-gdbinit-dir='$${sysconfdir}/cuda-gdb/gdbinit.d' CUDA_GDB_FLAGS += --enable-cuda CUDA_GDB_FLAGS += --enable-targets="$(DEB_HOST_GNU_TYPE),m68k-unknown-linux-gnu" CUDA_GDB_FLAGS += --disable-nls CUDA_GDB_FLAGS += --disable-inprocess-agent CUDA_GDB_FLAGS += --disable-rpath CUDA_GDB_FLAGS += --disable-gprofng # the following flags were taken from gdb 12.1 (snapshot.d.o) CUDA_GDB_FLAGS += --disable-gdbtk CUDA_GDB_FLAGS += --disable-shared CUDA_GDB_FLAGS += --disable-readline CUDA_GDB_FLAGS += --with-system-readline CUDA_GDB_FLAGS += --with-expat CUDA_GDB_FLAGS += --with-system-zlib CUDA_GDB_FLAGS += --without-guile CUDA_GDB_FLAGS += --with-debuginfod CUDA_GDB_FLAGS += --with-babeltrace ifneq (,$(filter $(DEB_HOST_ARCH),amd64)) CUDA_GDB_FLAGS += --with-intel-pt endif CUDA_GDB_FLAGS += --enable-tui CUDA_GDB_FLAGS += --with-lzma CUDA_GDB_FLAGS += --with-python=python3 CUDA_GDB_FLAGS += --with-xxhash CUDA_GDB_FLAGS += --with-mpfr CUDA_GDB_FLAGS += --enable-64-bit-bfd CUDA_GDB_FLAGS += --disable-sim CUDA_GDB_FLAGS += --enable-obsolete DEB_BUILD_MAINT_OPTIONS = hardening=+all DEB_CPPFLAGS_MAINT_APPEND = -I$(CURDIR)/nvidia-cuda-tree-$(DEB_HOST_ARCH)/cuda_cudart/include DEB_LDFLAGS_MAINT_APPEND = -pthread include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/pkg-info.mk VENDOR ?= $(call dpkg_late_eval,VENDOR,dpkg-vendor --derives-from Ubuntu && echo Ubuntu || echo Debian) aval = $(or $($(strip $1).$(or $(strip $2),$(DEB_HOST_ARCH))),$($(strip $1).default),$(error Not defined: $(strip $1)($(or $(strip $2),$(DEB_HOST_ARCH))))) -include debian/rules.version include debian/rules.soversion include debian/rules.version_prefix include debian/rules.defs CUDA_ARCH_LIST ?= amd64 CUDA_ARCH_LIST_NO_DRIVER ?= CUDA_ARCH_LIST_NO_OPENJDK ?= CUDA_VERSION_TOOLKIT ?= $(DEB_VERSION_UPSTREAM) CUDA_VERSION_MAJOR ?= $(word 1,$(subst ., ,$(CUDA_VERSION_TOOLKIT))) CUDA_VERSION_MINOR ?= $(word 2,$(subst ., ,$(CUDA_VERSION_TOOLKIT))) CUDA_VERSION ?= $(CUDA_VERSION_MAJOR).$(CUDA_VERSION_MINOR) version_driver = $(call aval,CUDA_VERSION_DRIVER_MINIMAL) PACKAGE_LIST := $(shell dh_listpackages) CUDA_GDB_VERSION ?= $(CUDA_VERSION_cuda_gdb) DEFAULT_GCC_VERSION ?= $(error Undefined DEFAULT_GCC_VERSION) THRUST_VERSION ?= $(or $(strip $(shell perl -ne 'if (/define\s+THRUST_VERSION\s+(\d*)/) { printf "%d.%d.%d\n", $$1 / 100000, $$1 / 100 % 1000, $$1 % 100; }' nvidia-cuda/cuda_cccl/include/thrust/version.h)),$(error empty THRUST_VERSION)) CUB_VERSION ?= $(THRUST_VERSION) LIBCUDACXX_VERSION ?= $(or $(strip $(shell perl -ne 'if (/define\s+_LIBCUDACXX_CUDA_API_VERSION\s+(\d*)/) { printf "%d.%d.%d\n", $$1 / 1000000, $$1 / 1000 % 1000, $$1 % 1000; }' nvidia-cuda/cuda_cccl/include/cuda/std/detail/__config)),$(error empty LIBCUDACXX_VERSION)) NVIDIA_FS_DKMS_VERSION ?= $(word 1,$(subst ., ,$(nvidia-fs-dkms.VERSION))).$(word 2,$(subst ., ,$(nvidia-fs-dkms.VERSION))) CUDA_JAVA_HOME ?= /usr/lib/jvm/java-8-openjdk-$(DEB_HOST_ARCH) libdir = usr/lib/$(DEB_HOST_MULTIARCH) jre_pkg ?= $(filter nvidia-openjdk-8-jre,$(PACKAGE_LIST)) nvidia_profiler_pkg ?= $(filter nvidia-profiler,$(PACKAGE_LIST)) visual_profiler_pkg ?= $(filter nvidia-visual-profiler,$(PACKAGE_LIST)) UPSTREAM_HOST_ARCH ?= $(call aval,UPSTREAM_HOST_ARCH) JAVA_HOST_ARCH ?= $(DEB_HOST_ARCH:ppc64el=ppc64le) export NSIGHT_COMPUTE_DESKTOP_DIR = $(NSIGHT_COMPUTE_DESKTOP_DIR.$(DEB_HOST_ARCH)) export NSIGHT_SYSTEMS_HOST_DIR = $(NSIGHT_SYSTEMS_HOST_DIR.$(DEB_HOST_ARCH)) export NSIGHT_SYSTEMS_TARGET_DIR = $(NSIGHT_SYSTEMS_TARGET_DIR.$(DEB_HOST_ARCH)) export NVIDIA_FS_DKMS_VERSION package_libcuda1 = $(package_libcuda1.$(VENDOR)) package_libcuda1 += libcuda.so.1 (>= $${nvidia:MinVersion}) | package_libcuda1 += libcuda-$(CUDA_VERSION_MAJOR).$(CUDA_VERSION_MINOR)-1 | package_libcuda1 += no-libcuda1 [$${cuda:arch:has-no-driver}] | package_libnvidia-ml1 = $(package_libnvidia-ml1.$(VENDOR)) package_libnvidia-ml1 += libnvidia-ml.so.1 (>= $${nvidia:MinVersion}) | package_libnvidia-ml1 += no-libcuda1 [$${cuda:arch:has-no-driver}] | package_driver = $(package_driver.$(VENDOR)) package_nvidia-kernel-dkms = $(package_nvidia-kernel-dkms.$(VENDOR)) package_nvidia-kernel-dkms += nvidia-kernel-dkms-any (>= $${nvidia:MinVersion}) | package_nvidia-kernel-dkms += nvidia-open-kernel-dkms-any (>= $${nvidia:MinVersion}) | # do not build nvidia-openjdk-8-jre on Ubuntu ifneq (,$(jre_pkg)) ifeq ($(VENDOR),Ubuntu) export DH_OPTIONS := $(DH_OPTIONS) -N$(jre_pkg) jre_pkg = endif endif OPENJDK_VERSION = $(call aval,OPENJDK_VERSION,$(DEB_HOST_ARCH)) make_component_version ?= $(subst -deb,-d,$(subst +,-,$(subst ~,-,$1))) get_openjdk_component ?= openjdk-8-$1-$(call make_component_version,$(call aval,OPENJDK_VERSION,$2)) get_openjdk_source_component ?= $(call get_openjdk_component,source,$1) get_openjdk_jre_component ?= $(call get_openjdk_component,jre-$1,$1) jre_pkg_dep ?= $(if $(jre_pkg),$(jre_pkg) (>= 9.+8u252)) jre_depends.Debian ?= $(if $(jre_pkg),$(jre_pkg_dep) |) openjdk-8-jre jre_depends.Ubuntu ?= openjdk-8-jre | $(jre_pkg_dep) ifneq (,$(jre_pkg)) $(jre_pkg).VERSION = $(subst ~,~~,$(OPENJDK_VERSION)) endif TEMPLATES := $(wildcard debian/*.in debian/patches/*.in) SOVERTEMPLATES := $(wildcard debian/*SOVER*) AUTOGEN += $(patsubst %.in,%,$(TEMPLATES)) AUTOGEN += $(foreach t,$(sort $(patsubst %.in,%,$(SOVERTEMPLATES))),$(subst SOVER,$(or $($(firstword $(subst SOVER, ,$(notdir $t))).SOVERSION),XXX),$t)) AUTOGEN += debian/g++ AUTOCLEAN = $(AUTOGEN) AUTOCLEAN += debian/shlibs.local .PHONY: autogen prepare autogen: $(AUTOGEN) prepare: autogen unpack-stamp compare-copyright-license prepare: update-version-prefix # deep copy, files will get irreversibly modified via hardlinks in the build target define nvidia-cuda-unpack-repack dh_testdir $(RM) -r $@ $@.tmp cp -a $1 $@ endef nvidia-cuda-tree-%: $(call nvidia-cuda-unpack-$(call aval,CUDA_TAR_TYPE,$*),$*) unpack-stamp: $(filter debian/patches%,$(AUTOGEN)) unpack-stamp: nvidia-cuda-tree-$(DEB_HOST_ARCH) $(RM) nvidia-cuda ln -sf nvidia-cuda-tree-$(DEB_HOST_ARCH) nvidia-cuda ifneq (amd64,$(DEB_HOST_ARCH)) # sync timestamps from amd64 for reproducible arch:all builds on all architectures cd nvidia-cuda && find -type f -exec sh -c 'f="{}"; test ! -f ../amd64/"$$f" || touch -r ../amd64/"$$f" "$$f"' \; cd nvidia-cuda && find -type d -exec sh -c 'd="{}"; test ! -d ../amd64/"$$d" || touch -r ../amd64/"$$d" "$$d"' \; endif $(RM) -r cuda-gdb-$(CUDA_GDB_VERSION) cuda-gdb ifneq (arm64,$(DEB_HOST_ARCH)) tar xf nvidia-cuda/cuda_gdb/extras/cuda-gdb-$(CUDA_GDB_VERSION).src.tar.gz else tar xf amd64/cuda_gdb/extras/cuda-gdb-$(CUDA_GDB_VERSION).src.tar.gz endif mv cuda-gdb-$(CUDA_GDB_VERSION) cuda-gdb ifeq (amd64,$(DEB_HOST_ARCH)) mv nvidia-cuda/nvidia_fs/usr/src/nvidia-fs-$(NVIDIA_FS_DKMS_VERSION) nvidia-cuda/nvidia_fs/usr/src/nvidia-fs endif ifneq (,$(jre_pkg)) $(RM) -r openjdk-8-jre dpkg -x $(call get_openjdk_jre_component,$(DEB_HOST_ARCH))/openjdk-8-jre-headless_$(OPENJDK_VERSION)_$(DEB_HOST_ARCH).deb openjdk-8-jre dpkg -x $(call get_openjdk_jre_component,$(DEB_HOST_ARCH))/openjdk-8-jre_$(OPENJDK_VERSION)_$(DEB_HOST_ARCH).deb openjdk-8-jre $(RM) -v openjdk-8-jre/usr/lib/jvm/java-8-openjdk-*/docs cp openjdk-8-jre/usr/share/doc/openjdk-8-jre-headless/copyright debian/$(jre_pkg).copyright endif QUILT_PATCHES=debian/patches QUILT_SERIES=series-postunpack quilt --quiltrc /dev/null push -a || test $$? = 2 touch $@ # Reformat the EULA to the format needed for debian/copyright. nvidia-cuda/EULA.txt: unpack-stamp EULA.fmt: nvidia-cuda/EULA.txt cat $< \ | fromdos | fromdos | expand \ | iconv -f UTF-8 -t latin1//TRANSLIT \ | fold -s -w 80 \ | sed -e 's/ *$$//;s/^$$/./;s/^/ /;' \ > $@ # Compare the license in debian/copyright with the EULA shipped in the archive. compare-copyright-license: EULA.fmt sed -e '1,/^License: other-NVIDIA-CUDA-TOOLKIT/d; /^$$/,$$d; /^ .$$/d' debian/copyright > copyright.tmp sed -e '/^ .$$/d' EULA.fmt > EULA.tmp diff -w copyright.tmp EULA.tmp rm -f copyright.tmp EULA.tmp dpkg-compare-versions = $(shell dpkg --compare-versions "$(1)" "$(2)" "$(3)" && echo "$(2)") # $1 = key, $2 = value, $3 = append_to_file define echokv echo '$(shell printf "%-39s" $(1)) = $(2)' >> $(3) endef define update-version-prefix $(if $($(1).VERSION_PREFIX),$(if $(call dpkg-compare-versions,$($(1).VERSION_PREFIX),le,$(call get-upstream-version,$(1),1)), : DROP PREFIX $(1) $($(1).VERSION_PREFIX) $(call get-upstream-version,$(1),1) $(eval $(1).VERSION_PREFIX =))) $(if $(call dpkg-compare-versions,$($(1).PREV_VERSION),le,$(call get-current-version,$(1))),, $(if $(call get-upstream-version,$(1),),,$(error MISSING VERSION FOR $(1))) : ADD PREFIX $(1) $($(1).PREV_VERSION) $(call get-current-version,$(1)) $(eval $(1).VERSION_PREFIX = $($(1).PREV_VERSION)+~)) echo '' >> $(2) $(if $($(1).VERSION_PREFIX),$(call echokv,$(1).VERSION_PREFIX,$($(1).VERSION_PREFIX),$(2))) $(call echokv,$(1).PREV_VERSION,$(call get-current-version,$(1)),$(2)) endef update-version-prefix: echo "# This file is generated/updated by 'debian/rules update-version-prefix'." > debian/rules.version_prefix.new $(foreach pkg,$(OTHER_PACKAGES) $(LIB_PACKAGES),$(call update-version-prefix,$(pkg),debian/rules.version_prefix.new)) mv debian/rules.version_prefix.new debian/rules.version_prefix .PHONY: binary binary-arch binary-indep build build-arch build-indep clean install binary binary-arch binary-indep build build-arch build-indep clean install: dh $@ build-stamp: unpack-stamp $(RM) -r build cp -al nvidia-cuda-tree-$(DEB_HOST_ARCH)/ build ifneq (amd64,$(DEB_HOST_ARCH)) # take missing examples from amd64 test -d build/libcublas/src || cp -alv amd64/libcublas/src build/libcublas/ test -d build/libcusparse/src || cp -alv amd64/libcusparse/src build/libcusparse/ test -d build/cuda_cupti/extras/CUPTI/samples/profiling_injection || cp -alv amd64/cuda_cupti/extras/CUPTI/samples/profiling_injection build/cuda_cupti/extras/CUPTI/samples/ endif # fix permissions find build/ -not -perm /0200 | xargs -r chmod -v u+w ifneq (,$(visual_profiler_pkg)) chmod -v -x build/cuda_nvvp/libnvvp/*.xpm endif chmod -v -x build/cuda_cupti/extras/CUPTI/samples/pc_sampling_utility/pc_sampling_utility_helper.h # remove tracking scripts find build \( -name google-analytics-tracker.js -o -name google-analytics-write.js -o -name tynt.js \) -exec rm -v {} + # remove tracking images @set -e -x ; for dir in \ build/nsight_compute/docs \ build/nsight_systems/documentation \ build/cuda_cupti/extras/CUPTI/doc \ build/cuda_sanitizer_api/compute-sanitizer/docs \ build/cuda_nvvp/libnvvp \ ; do test ! -d $$dir || find $$dir \ -name '*.html' -exec sed -r -i \ -e 's,(),,' \ -e 's,(),,' \ {} + ; \ done # replace embedded javascript libraries find build -name html5shiv-printshiv.min.js -exec ln -sfv /usr/share/javascript/html5shiv/html5shiv-printshiv.min.js {} \; find build -name jquery.min.js -exec ln -sfv /usr/share/javascript/jquery/jquery.min.js {} \; # reduce 'dh_missing --list-missing' noise @set -e -x ; for dir in build/*/include build/*/lib64 ; do if [ -h "$$dir" ] ; then target=$$(readlink -f $$dir) ; $(RM) $$dir ; mv -v $$target $$dir ; fi ; done ! cmp -s build/cuda_documentation/EULA.txt build/EULA.txt || $(RM) -v build/EULA.txt ! cmp -s build/cuda_documentation/EULA.txt build/libnvjitlink/LICENSE || $(RM) -v build/libnvjitlink/LICENSE $(RM) -v build/libnvvm_samples/nvvm/libnvvm-samples/build.bat $(RM) -rv build/cuda_demo_suite # libcudacxx, cub and thrust are packaged separately $(RM) -r build/cuda_cccl/include/cuda $(RM) -r build/cuda_cccl/include/nv $(RM) -r build/cuda_cccl/include/cub $(RM) -r build/cuda_cccl/include/thrust $(RM) -r build/cuda_cccl/lib64/cmake ifneq (,$(visual_profiler_pkg)) # split arch and indep eclipse plugins mkdir build/cuda_nvvp/libnvvp/plugins-arch mv build/cuda_nvvp/libnvvp/plugins/org.eclipse.equinox.launcher.gtk.linux.* build/cuda_nvvp/libnvvp/plugins-arch/ endif # replace embedded shared libraries with system libraries find build -name libssh.so -exec ln -sfv /$(libdir)/libssh.so.4 {} \; # # clean up nsight_compute ifeq (arm64,$(DEB_HOST_ARCH)) cp -alv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Positioning.so.6 build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ cp -alv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6QmlModels.so.6 build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ cp -alv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Quick.so.6 build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ cp -alv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6WebChannel.so.6 build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ cp -alv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6WebEngineCore.so.6 build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ endif ifeq (amd64,$(DEB_HOST_ARCH)) $(RM) -rv build/nsight_compute/host/$(NSIGHT_SYSTEMS_TARGET_DIR)/ $(RM) -rv build/nsight_compute/target/$(NSIGHT_COMPUTE_DESKTOP_DIR.i386)/ $(RM) -rv build/nsight_compute/target/$(NSIGHT_COMPUTE_DESKTOP_DIR.ppc64el)/ $(RM) -rv build/nsight_compute/target/$(NSIGHT_COMPUTE_DESKTOP_DIR.arm64)/ endif ifeq (ppc64el,$(DEB_HOST_ARCH)) # x86_64 binary $(RM) -v build/nsight_compute/extras/python/_ncu_report.so endif $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Mesa/libGL.so* $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libInjectionCommunicator.so $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Designer*.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Help.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Multimedia*.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6QuickParticles.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6QuickTest.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Sensors.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Sql.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6SvgWidgets.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6Test.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6WaylandCompositor.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQt6WaylandEglCompositorHwIntegration.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libboost_python*.so.1.* $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libcrypto.so* $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libpfm.so.4 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libssl.so* $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libstdc++.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libzstd.so.1 # missing libtiff.so.5 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/imageformats/libqtiff.so # missing libQt6WlShellIntegration.so.6 $(RM) -v build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/wayland-shell-integration/libwl-shell-plugin.so ifeq (amd64,$(DEB_HOST_ARCH)) chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libpapi.so.5 endif ifeq (arm64,$(DEB_HOST_ARCH)) chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/CrashReporter chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/OpenGLVersionChecker chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/CorePlugin/libCorePlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/RebelPlugin/libRebelPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/SassDebuggerPlugin/libSassDebuggerPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/libArmServerPlatformPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/libExternalIntegrationPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/libTPSConnectionPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/Plugins/libTPSSystemServerPlugin.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libAppLib.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libAppLibInterfaces.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libNvQtGui.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libQtPropertyBrowser.so chrpath -d build/nsight_compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR)/ncu-ui.bin endif ifneq (amd64,$(DEB_HOST_ARCH)) chrpath -d build/nsight_compute/target/$(NSIGHT_COMPUTE_DESKTOP_DIR)/libTreeLauncherTargetInjection.so endif # # clean up nsight_systems ifeq (amd64,$(DEB_HOST_ARCH)) chmod -v +x build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Scripts/VncContainer/Scripts/*.sh $(RM) -rv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Scripts/DependenciesInstaller endif mkdir build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)-examples mv build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Scripts build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)-examples $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/NVIDIA_SLA.pdf $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Mesa/libGL.so* $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInjectionCommunicator.so $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Charts.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Designer*.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Help.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Multimedia*.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6QuickParticles.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6QuickTest.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Sensors.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Sql.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6SvgWidgets.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6Test.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6WaylandCompositor.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQt6WaylandEglCompositorHwIntegration.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libboost_python*.so.1.* $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libcrypto.so* $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libjpeg.so.8 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libpfm.so.4 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libssl.so* $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libstdc++.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libz.so* # missing libtiff.so.5 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Plugins/imageformats/libqtiff.so # missing libQt6WlShellIntegration.so.6 $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Plugins/wayland-shell-integration/libwl-shell-plugin.so ifeq (amd64,$(DEB_HOST_ARCH)) chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libpapi.so.5 else chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/QdstrmImporter chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAgentAPI.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAnalysis.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAnalysisContainersData.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAnalysisData.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAnalysisProto.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAssert.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libCommonProtoServices.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libCommonProtoStreamSections.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libCore.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libCudaDrvApiWrapper.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libDeviceProperty.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libDevicePropertyProto.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libGpuInfo.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libGpuTraits.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libHostCommon.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInterfaceData.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInterfaceSharedBase.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInterfaceSharedLoggers.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libLinuxPerf.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libNvtxExtData.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libProcessLauncher.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libProtobufComm.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libProtobufCommClient.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libProtobufCommProto.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQuiverContainers.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQuiverEvents.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libStreamSections.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libSymbolAnalyzerLight.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libTimelineAssert.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libTimelineCommon.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjection64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionMPICH64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionOpenMPI64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionOpenSHMEM64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionProxy64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionUCP64.so ifeq (ppc64el,$(DEB_HOST_ARCH)) chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/nsys endif ifeq (arm64,$(DEB_HOST_ARCH)) chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/CrashReporter chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Plugins/CorePlugin/libCorePlugin.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/Plugins/QuadDPlugin/libQuadDPlugin.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAppLib.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libAppLibInterfaces.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libGenericHierarchy.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInterfaceShared.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libInterfaceSharedCore.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libNvQtGui.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libQtPropertyBrowser.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libSshClient.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libTimelineUIUtils.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libTimelineWidget.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/libexporter.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/nsys-ui.bin chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libLinuxKeyboardInterceptorProxy.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionCuBLAS64_10.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionCuBLAS64_11.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionCuDNN64_7.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionCuDNN64_8.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionNvMedia64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionNvMediaLegacy64.so chrpath -d build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/libToolsInjectionPythonBacktrace64.so endif endif ifneq (ppc64el,$(DEB_HOST_ARCH)) $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/python/bin/python $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/python/lib/gpustats.py $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/python/lib/nsysstats.py sed -i '1s%/usr/bin/env python$$%/usr/bin/python3%' build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/reports/*.py sed -i '1s%/usr/bin/env python$$%/usr/bin/python3%' build/nsight_systems/$(NSIGHT_SYSTEMS_HOST_DIR)/rules/*.py endif $(RM) -v build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/python/bin/python sed -i '1s%/usr/bin/env python$$%/usr/bin/python3%' build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/reports/*.py sed -i '1s%/usr/bin/env python$$%/usr/bin/python3%' build/nsight_systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/rules/*.py # # clean up compute-sanitizer ifneq (amd64,$(DEB_HOST_ARCH)) chrpath -d build/cuda_sanitizer_api/compute-sanitizer/libTreeLauncherTargetInjection.so endif ifeq (amd64,$(DEB_HOST_ARCH)) # i386 binaries $(RM) -rv build/cuda_sanitizer_api/compute-sanitizer/x86 endif # ifeq (amd64,$(DEB_HOST_ARCH)) # clean up gds grep -q '^PACKAGE_VERSION="$(NVIDIA_FS_DKMS_VERSION)"$$' build/nvidia_fs/usr/src/nvidia-fs/dkms.conf maxver=$$(grep -h '^ ' debian/libcufile*.symbols* | awk '{print $$2}' | sort -Vu | tail -n 1) && echo $$maxver && \ dpkg --compare-versions $$maxver le $(call get-custom-version,libcufile)~$(DEB_VERSION) chmod -v -x build/libcufile/gds/tools/run_gdsio.cfg ! cmp -s build/libcufile/gds/doc/copyright build/libcufile/gds-$(CUDA_VERSION)/copyright || $(RM) -v build/libcufile/gds-$(CUDA_VERSION)/copyright ! diff -q -w build/libcufile/gds/doc/copyright build/libcufile/gds/EULA.txt || $(RM) -v build/libcufile/gds/EULA.txt $(RM) -v build/libcufile/lib64/lib64 $(RM) -v build/libcufile/include/include endif # # remove empty directories find build -depth -type d -exec sh -c 'd="{}"; rmdir --ignore-fail-on-non-empty "$$d" ; test -d "$$d" || echo "removed $$d"' \; touch $@ execute_before_dh_update_autotools_config: $(AUTOGEN) unpack-stamp override_dh_auto_configure-arch: dh_auto_configure --sourcedirectory=cuda-gdb -- $(CUDA_GDB_FLAGS) execute_before_dh_auto_build: build-stamp override_dh_auto_build-arch: dh_auto_build --sourcedirectory=cuda-gdb -- V=1 ifneq (,$(jre_pkg)) execute_before_dh_auto_test-arch: openjdk-8-jre/$(CUDA_JAVA_HOME)/bin/java -version endif execute_before_dh_auto_install: rm -rf debian/tmp cp -al build/ debian/tmp override_dh_auto_install-arch: dh_auto_install --sourcedirectory=cuda-gdb/gdb dh_auto_install --sourcedirectory=cuda-gdb/gdbserver ifeq (amd64,$(DEB_HOST_ARCH)) override_dh_installchangelogs: dh_installchangelogs -plibcufile-dev build/libcufile/gds/doc/changelog dh_installchangelogs -pgds-tools build/libcufile/gds-$(CUDA_VERSION)/changelog dh_installchangelogs --remaining-packages endif override_dh_installman: dh_installman --language=C override_dh_python3: dh_python3 --skip-private --no-ext-rename override_dh_makeshlibs: dh_makeshlibs -X/stubs/ -VNone override_dh_shlibdeps: $(RM) -r libcuda mkdir libcuda ln -s ../nvidia-cuda/cuda_cudart/lib64/stubs/libcuda.so libcuda/libcuda.so.1 echo 'libcuda 1 XXXlibcuda1XXX' > debian/shlibs.local dh_shlibdeps -pnvidia-cuda-toolkit -- \ -l/usr/lib/nvidia-cuda-toolkit/compute-sanitizer dh_shlibdeps -pnvidia-cuda-dev -X/stubs/ dh_shlibdeps -pnsight-compute \ -- \ -l/usr/lib/nsight-compute/host/$(NSIGHT_COMPUTE_DESKTOP_DIR) dh_shlibdeps -pnsight-compute-target -- \ -l/$(libdir)/nsight-compute/target/$(NSIGHT_COMPUTE_DESKTOP_DIR) dh_shlibdeps -pnsight-systems \ -- \ -l/usr/lib/nsight-systems/$(NSIGHT_SYSTEMS_HOST_DIR) dh_shlibdeps -pnsight-systems-target -- \ -l/$(libdir)/nsight-systems/$(NSIGHT_SYSTEMS_TARGET_DIR) \ -l/$(libdir)/nsight-systems/$(NSIGHT_SYSTEMS_TARGET_DIR)/CollectX \ -llibcuda ifneq (,$(jre_pkg)) dh_shlibdeps -p$(jre_pkg) -- -l$(CUDA_JAVA_HOME)/jre/lib/$(JAVA_HOST_ARCH)/server endif dh_shlibdeps --remaining-packages -- -llibcuda $(RM) -r libcuda debian/shlibs.local sed -r -i -e 's/XXXlibcuda1XXX/$${package:libcuda1}/g' \ $(foreach lib,$(LIB_BASENAMES),-e 's/$(lib)$($(lib).SOVERSION)(,|$$)/$${$(lib):eq:Version}\1/g') \ debian/*.substvars # running dh_strip is not permitted by the NVIDIA license override_dh_dwz: dh_dwz -pnvidia-cuda-gdb override_dh_strip: dh_strip -pnvidia-cuda-gdb override_dh_strip_nondeterminism-indep: override_dh_strip_nondeterminism-arch: dh_strip_nondeterminism -pnvidia-cuda-gdb execute_before_dh_installdeb-indep: hardlink -v -t debian/nvidia-cuda-toolkit-doc/usr/share/doc/nvidia-cuda-toolkit hardlink -v -t debian/libcupti-doc/usr/share/doc/libcupti-dev execute_before_dh_installdeb-arch: hardlink -v -t debian/nsight-compute/usr/share/doc/nsight-compute hardlink -v -t debian/nsight-systems/usr/share/doc/nsight-systems # $1 = get-custom-version = $(or $($(1).DEB_VERSION),$($(1).VERSION_PREFIX)$($(1).VERSION)) get-upstream-version = $(or $($(1).DEB_VERSION),$($(1).VERSION),$(if $(2),$(DEB_VERSION_UPSTREAM))) get-previous-version = $($(1).PREV_VERSION) get-current-version = $(or $(call get-custom-version,$(1)),$(DEB_VERSION_UPSTREAM)) substvars += -V'cuda:Version:Major=$(CUDA_VERSION_MAJOR)' substvars += $(foreach pkg,$(filter-out $(PACKAGE_LIST),$(OTHER_PACKAGES)),-V'$(pkg):Version=0.not-built' -V'$(pkg):eq:Version=$(pkg) (= $${$(pkg):Version})') substvars += $(foreach pkg,$(filter-out $(LIB_PACKAGES),$(PACKAGE_LIST)),$(if $(call get-custom-version,$(pkg)),-V'$(pkg):Version=$(call get-custom-version,$(pkg))~$(DEB_VERSION)' -V'$(pkg):eq:Version=$(pkg) (= $${$(pkg):Version})')) substvars += $(foreach lib,$(LIB_BASENAMES),$(if $(call get-custom-version,$(lib)),-V'$(lib):Version=$(call get-custom-version,$(lib))~$(DEB_VERSION)')) substvars += $(foreach lib,$(LIB_BASENAMES),-V'$(lib):eq:Version=$(lib)$($(lib).SOVERSION) (= $${$(if $(call get-custom-version,$(lib)),$(lib),binary):Version})') substvars += -V'package:libcuda1=$(package_libcuda1)' substvars += -V'package:libnvidia-ml1=$(package_libnvidia-ml1)' substvars += -V'package:driver=$(package_driver)' substvars += -V'package:nvidia-kernel-dkms=$(package_nvidia-kernel-dkms)' substvars += -V'nvidia:MinVersion=$(version_driver)' substvars += -V'cuda:gcc:DefaultVersion=$(DEFAULT_GCC_VERSION)' substvars += -V'libcudacxx:Version=$(LIBCUDACXX_VERSION)' substvars += -V'cub:Version=$(CUB_VERSION)' substvars += -V'thrust:Version=$(THRUST_VERSION)' substvars += -V'cuda:arch:has-no-driver=$(if $(filter $(DEB_HOST_ARCH),$(CUDA_ARCH_LIST_NO_DRIVER)),,!)$(DEB_HOST_ARCH)' substvars += -V'cuda:arch:has-nvidia-profiler=$(if $(nvidia_profiler_pkg),,!)$(DEB_HOST_ARCH)' substvars += -V'cuda:arch:has-nvidia-visual-profiler=$(if $(visual_profiler_pkg),,!)$(DEB_HOST_ARCH)' substvars += -V'jre:Depends=$(jre_depends.$(VENDOR))' define check-monotonic-version : $(shell printf "%-29s" "$(1)") ; dpkg --compare-versions "$(call get-previous-version,$(1))" le "$(call get-current-version,$(1))" endef define gencontrol-template dh_gencontrol $(1) -- $(2) \ $(substvars) endef override_dh_gencontrol: $(foreach p,$(PACKAGE_LIST),$(call check-monotonic-version,$(p))) $(foreach p,$(PACKAGE_LIST),$(if $(call get-custom-version,$(p)),$(call gencontrol-template,-p$(p),-v$(call get-custom-version,$(p))~$(DEB_VERSION)))) $(call gencontrol-template,--remaining-packages,) execute_after_dh_autoreconf_clean: $(RM) -r .pc $(RM) -r nvidia-cuda-tree-amd64* $(RM) -r nvidia-cuda-tree-ppc64el* $(RM) -r nvidia-cuda-tree-arm64* $(RM) nvidia-cuda* $(RM) -r build $(RM) -r libcuda $(RM) EULA.fmt EULA.tmp copyright.tmp $(RM) -r openjdk-8-jre $(RM) debian/$(jre_pkg).copyright execute_after_dh_clean: $(RM) -r get-orig-source $(RM) -r cuda-gdb-$(CUDA_GDB_VERSION) cuda-gdb $(RM) $(AUTOCLEAN) $(RM) debian/rules.version debian/rules.soversion debian/rules.version: amd64/version.json sed -r -n '/: \{/{s/.*"(.*)".*/\1/;h};/"version" :/{s/.*: "(.*)".*/\1/;H;x;s/^/CUDA_VERSION_/;s/\n/ = /;p}' $< > $@ debian/rules.soversion: debian/control sed -rn 's/Package: (lib.*[^0-9.]+)([0-9.]+)$$/LIB_PACKAGES += \1\2\nLIB_BASENAMES += \1\n\1.SOVERSION = \2/p; s/Package: (.*)/OTHER_PACKAGES += \1/p' $< > $@ # Generating control files %:: %.in debian/rules debian/rules.defs perl -p \ -e 's{#VERSION_TOOLKIT#}{$(CUDA_VERSION_TOOLKIT)}g;' \ -e 's{#DEFAULT_GCC_VERSION#}{$(DEFAULT_GCC_VERSION)}g;' \ -e 's{#LIBDIR#}{$(libdir)}g;' \ -e 's{#!ppc64el#}{$(if $(filter ppc64el,$(DEB_HOST_ARCH)),#)}g;' \ -e 's{#!arm64#}{$(if $(filter arm64,$(DEB_HOST_ARCH)),#)}g;' \ -e 's{#CUDA_JAVA_HOME#}{$(CUDA_JAVA_HOME)}g;' \ -e 's{#NSIGHT_COMPUTE_DESKTOP_DIR#}{$(NSIGHT_COMPUTE_DESKTOP_DIR)}g;' \ -e 's{#NSIGHT_SYSTEMS_HOST_DIR#}{$(NSIGHT_SYSTEMS_HOST_DIR)}g;' \ -e 's{#NSIGHT_SYSTEMS_TARGET_DIR#}{$(NSIGHT_SYSTEMS_TARGET_DIR)}g;' \ -e 's{#UPSTREAM_HOST_ARCH#}{$(UPSTREAM_HOST_ARCH)}g;' \ < $< > $@ # $1 = , $2 = define sover-template $(1).VERSION_PREFIX ?= $$($(1)$(2).VERSION_PREFIX) $(1)$(2).VERSION ?= $$($(1).VERSION) $(1)$(2).%:: $(1)SOVER.% perl -p \ -e 's{#SOVERSION#}{$(2)}g;' \ -e 's{#VERSION#}{$$(or $$($(1).LIBVERSION),$$($(1).VERSION),$$(error $(1).VERSION))}g;' \ < $$< > $$@ endef $(foreach lib,$(LIB_BASENAMES),$(eval $(call sover-template,$(lib),$($(lib).SOVERSION)))) debian/g++: debian/gcc sed '/prog=/s/gcc-/g++-/g' < $< > $@ chmod 0755 $< $@ # only invoked manually check-whitespace: grep -r --exclude-dir=.svn --exclude-dir=.git --exclude '*.patch*' -E '\s$$' debian || true ############################################################################ # $1 = get_origdir = $(or $(ORIGDIR.$(strip $1)),$(ORIGDIR_BASE)-$(strip $1)) get_tarball = $(or $(TARBALL.$(strip $1)),$(TARBALL_BASE)-$(strip $1))$(TARBALL_SUFFIX) # these must be defined in rules.defs get_dl_url ?= $(error Undefined: get_dl_url) get_dl_filename ?= $(error Undefined: get_dl_filename) get_dl_type ?= $(error Undefined: get_dl_type) UPSTREAM_NAME = nvidia-cuda-toolkit UPSTREAM_VERSION = $(CUDA_VERSION_TOOLKIT) CUDA_TARBALL_LIST = $(foreach a,$(CUDA_ARCH_LIST),$(call get_tarball,$a)) OPENJDK_ARCH_LIST = $(filter-out $(CUDA_ARCH_LIST_NO_OPENJDK),$(CUDA_ARCH_LIST)) OPENJDK_TARBALL_LIST = $(sort $(foreach a,$(OPENJDK_ARCH_LIST),$(foreach j,source jre,$(call get_tarball,$(call get_openjdk_$(j)_component,$a))))) TARBALL_LIST = $(call get_tarball,empty) TARBALL_LIST += $(CUDA_TARBALL_LIST) TARBALL_LIST += $(OPENJDK_TARBALL_LIST) CACHE ?= ../.cache COMPRESS_EXT ?= gz COMPRESS.gz ?= gzip -n9 COMPRESS.xz ?= xz -9 ORIGDIR_BASE ?= $(UPSTREAM_NAME)-$(UPSTREAM_VERSION).orig TARBALL_BASE ?= $(UPSTREAM_NAME)_$(UPSTREAM_VERSION).orig TARBALL_SUFFIX ?= .tar.$(COMPRESS_EXT) ORIGDIR.empty ?= $(ORIGDIR_BASE) TARBALL.empty ?= $(TARBALL_BASE) # per-target variables origdir = $(error Undefined: origdir) tarball = $(error Undefined: tarball) openjdk_arch = $(error Undefined: openjdk_arch) openjdk_version = $(error Undefined: openjdk_version) get-orig-source-prepare: $(RM) -r get-orig-source mkdir get-orig-source get-orig-source-prepare/%: get-orig-source-prepare $(RM) $(tarball) mkdir get-orig-source/$(origdir) get-orig-source-download/%: dl_filename = $(call get_dl_filename,$*) get-orig-source-download/%: get-orig-source-prepare ln -v $(CACHE)/$(dl_filename) get-orig-source/ 2>/dev/null || \ wget $(call get_dl_url,$*) -O get-orig-source/$(dl_filename) if [ -d $(CACHE) ] && [ ! -f $(CACHE)/$(dl_filename) ]; then \ ln -v get-orig-source/$(dl_filename) $(CACHE) ; fi get-orig-source-download-openjdk-8-source/%: get-orig-source-prepare/% cd get-orig-source/$(origdir) && (apt-get source -d openjdk-8=$(openjdk_version) || debsnap -v -f -d . openjdk-8 $(openjdk_version)) get-orig-source-download-openjdk-8-jre/%: get-orig-source-prepare/% cd get-orig-source/$(origdir) && (apt-get download openjdk-8-jre:$(openjdk_arch)=$(openjdk_version) || debsnap -v -f -a $(openjdk_arch) -d . openjdk-8-jre $(openjdk_version)) cd get-orig-source/$(origdir) && (apt-get download openjdk-8-jre-headless:$(openjdk_arch)=$(openjdk_version) || debsnap -v -f -a $(openjdk_arch) -d . openjdk-8-jre-headless $(openjdk_version)) # unpack the all-in-one .run cuda installer containing toolkit, driver and samples get-orig-source-run-unpack/%: get-orig-source-prepare/% get-orig-source-download/% @set -e -x ; \ cd get-orig-source ; \ sh $(call get_dl_filename,$*) --nox11 --noexec --keep --target tmp.$* ; \ find tmp.$* -ls ; \ if [ -d tmp.$*/builds/cuda-toolkit ]; then \ mv tmp.$*/builds/cuda-toolkit/* $(origdir)/ ; \ elif [ -d tmp.$*/builds/cuda_cudart ]; then \ $(RM) -v tmp.$*/builds/NVIDIA-Linux*.run ; \ mv tmp.$*/builds/* $(origdir)/ ; \ else \ false ; \ fi ; \ $(RM) -r tmp.$* get-orig-source-files/%: get-orig-source-unpack/% @set -e -x ; \ cd get-orig-source ; \ touch $(origdir).stamp -r $$(find $(origdir) -type f | xargs -r ls -tr | tail -n 1) get-orig-source-files/empty: origdir = $(call get_origdir,empty) get-orig-source-files/empty: get-orig-source-prepare/empty $(CUDA_TARBALL_LIST) touch get-orig-source/$(origdir).stamp -r $$(ls -tr $(CUDA_TARBALL_LIST) | tail -n 1) get-orig-source-pack/%: origdir = $(call get_origdir,$*) get-orig-source-pack/%: tarball = $(call get_tarball,$*) get-orig-source-pack/%: get-orig-source-files/% @set -e -x ; \ cd get-orig-source ; \ tar cfv - \ --clamp-mtime --mtime="./$(origdir).stamp" \ --sort=name \ --owner=root --group=src \ $(origdir) \ | $(COMPRESS.$(COMPRESS_EXT)) > $(tarball); \ touch $(tarball) -r $(origdir).stamp mv get-orig-source/$(tarball) . $(call get_tarball,empty): get-orig-source-pack/empty # $1 = define get-orig-source-template get-orig-source-unpack/$1: get-orig-source-$$(call get_dl_type,$1)-unpack/$1 $$(call get_tarball,$1): get-orig-source-pack/$1 endef # $1 = , $2 = , $3 = source|jre define get-orig-source-openjdk-8-template ORIGDIR.$2 ?= $$(UPSTREAM_NAME).orig-$2 $$(call get_tarball,$2): openjdk_arch=$1 $$(call get_tarball,$2): openjdk_version=$$(call aval,OPENJDK_VERSION,$1) get-orig-source-unpack/$2: get-orig-source-download-openjdk-8-$3/$2 $$(call get_tarball,$2): get-orig-source-pack/$2 endef # $1 = define get-orig-source-openjdk-8-source-template $(call get-orig-source-openjdk-8-template,$1,$$(call get_openjdk_source_component,$1),source) endef # $1 = define get-orig-source-openjdk-8-jre-template $(call get-orig-source-openjdk-8-template,$1,$$(call get_openjdk_jre_component,$1),jre) endef $(foreach a,$(CUDA_ARCH_LIST),\ $(eval $(call get-orig-source-template,$a))\ $(eval $(call get-orig-source-openjdk-8-source-template,$a))\ $(eval $(call get-orig-source-openjdk-8-jre-template,$a))) get-orig-source-openjdk-8: $(OPENJDK_TARBALL_LIST) .PHONY: get-orig-source get-orig-source: $(TARBALL_LIST) $(RM) -r get-orig-source list-tarballs: @for t in $(TARBALL_LIST) ; do echo "$$t" ; done ############################################################################ # The tarballs are kept in a separate git repository and use the git-lfs # storage backend. To keep the local disk usage low, this repository is # checked out sparsely, only tarballs for versions that have been built # locally will be available locally. GIT ?= git TARBALL_REPOSITORY = https://salsa.debian.org/nvidia-team/tarballs-$(UPSTREAM_NAME).git TARBALL_TREE = ../tarballs-$(UPSTREAM_NAME) define sparse-checkout-current grep '^$(UPSTREAM_VERSION)/' $(TARBALL_TREE)/.git/info/sparse-checkout || \ echo '$(UPSTREAM_VERSION)/*' >> $(TARBALL_TREE)/.git/info/sparse-checkout endef define test-file-exists test -f $1 endef $(TARBALL_TREE): $(RM) -r $@.tmp $(GIT) clone --no-checkout $(TARBALL_REPOSITORY) $@.tmp cd $@.tmp && $(GIT) lfs install --local cd $@.tmp && $(GIT) config --local core.sparsecheckout true echo .gitattributes >> $@.tmp/.git/info/sparse-checkout cd $@.tmp && $(GIT) checkout mv $@.tmp $@ $(TARBALL_TREE)/$(UPSTREAM_VERSION): | $(TARBALL_TREE) $(sparse-checkout-current) cd $(TARBALL_TREE) && $(GIT) pull --ff-only && $(GIT) checkout tarball-tree: $(TARBALL_TREE) # only invoked manually writable-tarball-tree: tarball-tree cd $(TARBALL_TREE) && $(GIT) remote set-url origin $(patsubst https://salsa.debian.org/%,git@salsa.debian.org:%,$(TARBALL_REPOSITORY)) # invoked from gbp buildpackage preexport hook check-current-tarballs: $(TARBALL_TREE)/$(UPSTREAM_VERSION) $(foreach t,$(TARBALL_LIST),$(call test-file-exists,$(TARBALL_TREE)/$(UPSTREAM_VERSION)/$t)) # only invoked manually commit-current-tarballs: get-orig-source $(sparse-checkout-current) mkdir -p $(TARBALL_TREE)/$(UPSTREAM_VERSION) mv $(TARBALL_LIST) $(TARBALL_TREE)/$(UPSTREAM_VERSION)/ cd $(TARBALL_TREE) && $(GIT) add $(UPSTREAM_VERSION) && if $(GIT) status -s $(UPSTREAM_VERSION) | grep ^A ; then $(GIT) commit -m "add $(UPSTREAM_VERSION) tarballs" $(UPSTREAM_VERSION) ; fi