#!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 include /usr/share/dpkg/architecture.mk include /usr/share/dpkg/pkg-info.mk VENDOR ?= $(call dpkg_late_eval,VENDOR,dpkg-vendor --derives-from Ubuntu && echo Ubuntu || echo Debian) include debian/rules.defs CUDA_ARCH_LIST ?= amd64 CUDA_PATCH_LIST ?= CUDA_PATCH_LIST_ARCH ?= $(patsubst $(DEB_HOST_ARCH)-%,%,$(filter $(DEB_HOST_ARCH)-%,$(CUDA_PATCH_LIST))) CUDA_ARCH_LIST_NO_DRIVER?= CUDA_ARCH_LIST_NO_JAVA ?= CUDA_VERSION_TOOLKIT ?= $(DEB_VERSION_UPSTREAM) CUDA_VERSION_MAJOR ?= $(word 1,$(subst ., ,$(CUDA_VERSION_TOOLKIT))) CUDA_VERSION_MINOR ?= $(word 2,$(subst ., ,$(CUDA_VERSION_TOOLKIT))) version_driver = $(CUDA_VERSION_DRIVER.$(DEB_HOST_ARCH)) watch_url = $(CUDA_WATCH_URL) PACKAGE_LIST := $(shell dh_listpackages) 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/include/thrust/version.h)),$(error empty THRUST_VERSION)) OPENJDK_VERSION ?= $(or $(strip $(shell nvidia-cuda/jre/bin/java -version 2>&1 | sed -rn '1s/.*"1\.([0-9]*)\.0_(.*)"/\1u\2/p')),$(error empty OPENJDK_VERSION)) CUDA_JAVA_HOME ?= /usr/lib/jvm/nvidia-java-8-openjdk-$(DEB_HOST_ARCH) jre_pkg ?= $(filter nvidia-openjdk-8-jre,$(PACKAGE_LIST)) package_libcuda1 \ = libcuda1 (>= $${nvidia:MinVersion}) \ | libcuda-$${cuda:SoVersion}-1 #ifeq ($(VENDOR),Ubuntu) package_libcuda1 += | no-libcuda1 [$${cuda:arch:has-no-driver}] #endif # system libdir libdir = usr/lib/$(DEB_HOST_MULTIARCH) TEMPLATES := $(wildcard debian/*.in debian/patches/*.in) SOVERTEMPLATES := $(wildcard debian/*SOVER*) AUTOGEN += $(patsubst %.in,%,$(TEMPLATES)) AUTOGEN += $(subst SOVER,$(CUDA_SOVERSION),$(sort $(patsubst %.in,%,$(SOVERTEMPLATES)))) AUTOGEN += debian/g++ AUTOKEEP = debian/watch AUTOCLEAN = $(filter-out $(AUTOKEEP),$(AUTOGEN)) AUTOCLEAN += debian/shlibs.local .PHONY: autogen prepare autogen: $(AUTOGEN) prepare: autogen unpack-stamp compare-copyright-license nvidia-cuda-amd64: dh_testdir $(RM) -r $@ $@.tmp sh $(CUDA_FILENAME.amd64) --noexec --keep --target $@.tmp mv $@.tmp $@ nvidia-cuda-amd64-patch1: | nvidia-cuda-amd64 dh_testdir $(RM) -r $@ $@.tmp sh amd64-patch1/$(CUDA_FILENAME.amd64-patch1) --noexec --keep --target $@.tmp mv $@.tmp/payload/cuda-linux64-mixed-rel-nightly/* $@.tmp/ $(RM) -v $@.tmp/install_patch.pl $(RM) -v $@.tmp/payload/install_manifest mv $@.tmp $@ for f in $$(cd $@ && find . ! -type d) ; do test -e nvidia-cuda-amd64/$$f || echo "new file in $@: $$f" ; done nvidia-cuda-ppc64el: dh_testdir $(RM) -r $@ $@.tmp mkdir $@.tmp @set -e -x ; for deb in ppc64el/cuda*.deb ; do dpkg -x $$deb $@.tmp/ubuntutree ; done mv $@.tmp/ubuntutree/usr/local/cuda*/* $@.tmp/ $(RM) -r $@.tmp/ubuntutree/usr/lib/pkgconfig $(RM) -r $@.tmp/ubuntutree/usr/share/doc $(RM) -r $@.tmp/ubuntutree/usr/share/lintian $(RM) -v $@.tmp/ubuntutree/etc/ld.so.conf.d/cuda-$(subst .,-,$(CUDA_SOVERSION)).conf $(RM) -v $@.tmp/bin/computeprof $(RM) -v $@.tmp/LICENSE $(RM) -v $@.tmp/README mv $@.tmp/doc/EULA.txt $@.tmp/ $(RM) $@.tmp/include $@.tmp/lib64 mv $@.tmp/targets/ppc64le-linux/include $@.tmp/include mv $@.tmp/targets/ppc64le-linux/lib $@.tmp/lib64 mv $@.tmp $@ nvidia-cuda-ppc64el-patch1: | nvidia-cuda-ppc64el dh_testdir $(RM) -r $@ $@.tmp mkdir $@.tmp @set -e -x ; for deb in ppc64el-patch1/cuda*.deb ; do dpkg -x $$deb $@.tmp/ubuntutree ; done mv $@.tmp/ubuntutree/usr/local/cuda*/* $@.tmp/ $(RM) -r $@.tmp/ubuntutree/usr/lib/pkgconfig $(RM) -r $@.tmp/ubuntutree/usr/share/doc $(RM) -r $@.tmp/ubuntutree/usr/share/lintian $(RM) -v $@.tmp/ubuntutree/etc/ld.so.conf.d/cuda-$(subst .,-,$(CUDA_SOVERSION)).conf cmp -s nvidia-cuda-ppc64el/bin/nvcc.profile $@.tmp/bin/nvcc.profile && $(RM) -v $@.tmp/bin/nvcc.profile $(RM) $@.tmp/include $@.tmp/lib64 mv $@.tmp/targets/ppc64le-linux/include $@.tmp/include mv $@.tmp/targets/ppc64le-linux/lib $@.tmp/lib64 mv $@.tmp $@ for f in $$(cd $@ && find . ! -type d) ; do test -e nvidia-cuda-ppc64el/$$f || echo "new file in $@: $$f" ; done unpack-stamp: $(filter debian/patches%,$(AUTOGEN)) unpack-stamp: nvidia-cuda-$(DEB_HOST_ARCH) unpack-stamp: $(foreach patch,$(CUDA_PATCH_LIST_ARCH),nvidia-cuda-$(DEB_HOST_ARCH)-$(patch)) $(RM) nvidia-cuda $(foreach patch,$(CUDA_PATCH_LIST_ARCH),nvidia-cuda-$(patch)) ln -sf nvidia-cuda-$(DEB_HOST_ARCH) nvidia-cuda $(foreach patch,$(CUDA_PATCH_LIST_ARCH),ln -sf nvidia-cuda-$(DEB_HOST_ARCH)-$(patch) nvidia-cuda-$(patch) ; ) 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 .PHONY: binary binary-arch binary-indep build build-arch build-indep clean install binary-arch build build-arch build-indep clean install: dh $@ binary binary-indep: # the documentation packages must be built on amd64 (otherwise some parts are missing) test "$(DEB_HOST_ARCH)" = "amd64" dh $@ build-stamp: unpack-stamp $(RM) -r build cp -al nvidia-cuda-$(DEB_HOST_ARCH)/ build $(foreach patch,$(CUDA_PATCH_LIST_ARCH),cp -al nvidia-cuda-$(patch)/* build/ ; ) $(cleanup-after-merging-patches-into-build/$(CUDA_VERSION_TOOLKIT)) # fix permissions chmod -x build/bin/crt/link.stub chmod -x build/bin/crt/prelink.stub chmod -x build/libnvvp/*.xpm chmod -x build/libnsight/*.xpm chmod -x build/nvvm/include/*.h chmod -x build/nvvm/libnvvm-samples/build.bat # remove java path sed -i '/^-vm$$/ d; /^..\/jre\/bin\/java$$/ d' build/libnvvp/nvvp.ini build/libnsight/nsight.ini ifneq (,$(jre_pkg)) # these depend on libraries from oldoldstable $(RM) -v build/jre/lib/amd64/libavplugin-53.so $(RM) -v build/jre/lib/amd64/libavplugin-54.so endif # 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 find \ build/doc/html \ -name '*.html' -exec sed -r -i \ -e '\,http://omniture.nvidia.com/b/ss/nvidiacudadocs/1/H.17--NS/0, { s,(