File: rules

package info (click to toggle)
nvidia-cuda-toolkit 8.0.44-4
  • links: PTS, VCS
  • area: non-free
  • in suites: stretch
  • size: 2,370,244 kB
  • ctags: 62
  • sloc: sh: 4,761,620; makefile: 212
file content (279 lines) | stat: -rwxr-xr-x 9,892 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_ARCH		?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH	?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
VENDOR			:= $(shell dpkg-vendor --derives-from Ubuntu && echo Ubuntu || echo Debian)

include debian/rules.defs
CUDA_VERSION_TOOLKIT	:= $(shell dpkg-parsechangelog | sed -nr '/^Version:/s/Version: (.*:)?(.*)-(.*)/\2/p')
CUDA_VERSION_MAJOR	?= $(word 1,$(subst ., ,$(CUDA_VERSION_TOOLKIT)))
CUDA_VERSION_MINOR	?= $(word 2,$(subst ., ,$(CUDA_VERSION_TOOLKIT)))
version_driver		 = $(CUDA_VERSION_DRIVER)
watch_url		 = $(if $(CUDA_BETA),$(CUDA_WATCH_URL_BETA),$(CUDA_WATCH_URL))

package_libcuda1 \
	= libcuda1 (>= $${nvidia:MinVersion}) \
	| libcuda-$${cuda:SoVersion}-1
#ifeq ($(VENDOR),Ubuntu)
package_libcuda1	+= | no-libcuda1 [ppc64el]
#endif

package_nvidia-libopencl1 \
	= nvidia-libopencl1 (>= $${nvidia:MinVersion}) \
	| libopencl-1.2-1

# 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: debian/rules debian/rules.shuffle
	dh_testdir
	$(RM) -r $@ $@.tmp
	sh $(CUDA_FILENAME.amd64) --noexec --keep --target $@.tmp
	$(MAKE) -C $@.tmp -f ../debian/rules.shuffle shuffle-nvidia-cuda-amd64
	mv $@.tmp $@

nvidia-cuda-ppc64el: debian/rules debian/rules.shuffle
	dh_testdir
	$(RM) -r $@ $@.tmp
	mkdir $@.tmp
	@set -e -x ; for deb in ppc64el/cuda*.deb ; do dpkg -x $$deb $@.tmp/ubuntutree ; done
	$(MAKE) -C $@.tmp -f ../debian/rules.shuffle shuffle-nvidia-cuda-ppc64el
	mv $@.tmp $@

unpack-stamp: nvidia-cuda-$(DEB_HOST_ARCH)
	ln -s nvidia-cuda-$(DEB_HOST_ARCH) nvidia-cuda
	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 CP1255 -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 binary-arch build build-arch build-indep clean install:
	dh $@

binary-indep:
	# the documentation packages must be built on amd64 (otherwise some parts are missing)
	test "$(DEB_HOST_ARCH)" = "amd64"
	dh $@

override_dh_auto_configure: $(AUTOGEN) unpack-stamp

override_dh_auto_install:
	mkdir debian/tmp
	cp -al nvidia-cuda-$(DEB_HOST_ARCH) debian/tmp/usr
	chmod -x debian/tmp/usr/libnvvp/*.xpm
	chmod -x debian/tmp/usr/libnsight/*.xpm
	sed -i '/^-vm$$/ d; /^..\/jre\/bin\/java$$/ d' debian/tmp/usr/libnvvp/nvvp.ini debian/tmp/usr/libnsight/nsight.ini
	chmod -x debian/tmp/usr/bin/crt/link.stub
	chmod -x debian/tmp/usr/bin/crt/prelink.stub
	chmod -x debian/tmp/usr/nvvm/include/*.h
	chmod -x debian/tmp/usr/nvvm/libnvvm-samples/build.bat
ifeq ($(DEB_HOST_ARCH),ppc64el)
	chrpath -d debian/tmp/usr/bin/cuda-gdb
endif
	# remove tracking scripts
	rm -rfv debian/tmp/usr/doc/html/common/scripts
	# remove tracking images
	find debian/tmp/usr/doc/html -name '*.html' -exec sed -r -i \
		-e '\,http://omniture.nvidia.com/b/ss/nvidiacudadocs/1/H.17--NS/0, { s,(<noscript>),<!-- \1,; s,img src,img DISABLED,; s,(</noscript>),\1 -->, }' \
		-e 's,(<script type="text/javascript" )src(="http://w.sharethis.com/button/buttons.js"[^>]*></script>),<!-- \1DISABLED\2 -->,' \
		{} +
	find debian/tmp/usr/libnsight debian/tmp/usr/libnvvp -name 'license.html' -exec sed -r -i \
		-e 's,(<script type="text/javascript" )src(="http://w.sharethis.com/button/buttons.js"[^>]*></script>),<!-- \1DISABLED\2 -->,' \
		{} +
	# reduce 'dh_install --list-missing' noise
	rm -rf debian/tmp/usr/include/thrust
	rm -rf debian/tmp/usr/lib32
	rm -rf debian/tmp/usr/*/lib32

override_dh_install:
	dh_install --list-missing
	rm -rf debian/nvidia-visual-profiler/usr/share/nvidia-visual-profiler/plugins/org.eclipse.equinox.launcher.gtk.linux.*
	rm -rf debian/nvidia-nsight/usr/share/nvidia-nsight/plugins/org.eclipse.equinox.launcher.gtk.linux.*

override_dh_installman:
	dh_installman --language=C

override_dh_makeshlibs:
	dh_makeshlibs -X/stubs/

override_dh_shlibdeps:
	mkdir libcuda
	ln -s ../nvidia-cuda/lib/stubs/libcuda.so libcuda/libcuda.so.1
	echo 'libcuda 1 XXXlibcuda1XXX' > debian/shlibs.local
	dh_shlibdeps -X/stubs/ -- -llibcuda
	$(RM) -r libcuda debian/shlibs.local
	sed -i -r 's/XXXlibcuda1XXX/$${package:libcuda1}/g' debian/*.substvars

# running dh_strip is not permitted by the NVIDIA license
override_dh_strip:
override_dh_strip_nondeterminism:

override_dh_compress:
	dh_compress -Xusr/share/doc/nvidia-cuda-doc/examples -Xusr/share/doc/libcupti-doc/examples

override_dh_gencontrol:
	dh_gencontrol -- \
		-V'package:libcuda1=$(package_libcuda1)' \
		-V'package:nvidia-libopencl1=$(package_nvidia-libopencl1)' \
		-V'cuda:SoVersion=$(CUDA_SOVERSION)' \
		-V'nvidia:MinVersion=$(version_driver)'

override_dh_auto_clean:
	$(RM) -r .pc
	$(RM) nvidia-cuda
	$(RM) -r nvidia-cuda-amd64
	$(RM) -r nvidia-cuda-ppc64el
	$(RM) EULA.fmt EULA.tmp copyright.tmp

override_dh_clean:
	dh_clean
	$(RM) $(AUTOCLEAN)
	$(MAKE) -f debian/rules $(AUTOKEEP)


# Generating control files
%:: %.in debian/rules debian/rules.defs
	perl -p \
	-e 's{#VERSION_TOOLKIT#}{$(CUDA_VERSION_TOOLKIT)}g;' \
	-e 's{#SOVERSION#}{$(CUDA_SOVERSION)}g;' \
	-e 's{#CUDA_DOWNLOAD_URL#}{$(watch_url)}g;' \
	-e 's{#LIBDIR#}{$(libdir)}g;' \
	-e 's{#MAN_DATE#}{$(CUDA_MAN_DATE.$(DEB_HOST_ARCH))}g;' \
	< $< > $@

lib%$(CUDA_SOVERSION).install:: lib%SOVER.install
	cp $< $@

lib%$(CUDA_SOVERSION).links:: lib%SOVER.links
	cp $< $@

lib%$(CUDA_SOVERSION).lintian-overrides:: lib%SOVER.lintian-overrides
	cp $< $@

lib%$(CUDA_SOVERSION).symbols:: lib%SOVER.symbols
	cp $< $@

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

############################################################################

CACHE			?= ../.cache
ORIGDIR			?= nvidia-cuda-toolkit-$(CUDA_VERSION_TOOLKIT).orig
TARBALL_BASE		?= nvidia-cuda-toolkit_$(CUDA_VERSION_TOOLKIT).orig
TARBALL_SUFFIX		?= .tar.gz
TARBALL			?= $(TARBALL_BASE)$(TARBALL_SUFFIX)
ORIGDIR.amd64		?= $(ORIGDIR)
TARBALL.amd64		?= $(TARBALL)
ORIGDIR.ppc64el		?= $(ORIGDIR)-ppc64el
TARBALL.ppc64el		?= $(TARBALL_BASE)-ppc64el$(TARBALL_SUFFIX)

CUDA_DL_FILENAME.amd64	?= cuda_$(CUDA_VERSION_TOOLKIT)_linux.run
CUDA_DL_FILENAME.ppc64el?= ???

CUDA_URL_FILENAME.amd64		?= $(CUDA_DL_FILENAME.amd64:.run=-run)
CUDA_URL_FILENAME.ppc64el	?= $(CUDA_DL_FILENAME.ppc64el:.deb=-deb)

get-orig-source-prepare:
	$(RM) $(TARBALL)
	$(RM) $(TARBALL.amd64)
	$(RM) $(TARBALL.ppc64el)
	$(RM) -r get-orig-source || true
	mkdir get-orig-source

get-orig-source-download-%: get-orig-source-prepare
	ln -v $(CACHE)/$(CUDA_DL_FILENAME.$*) get-orig-source/ 2>/dev/null || \
		wget $(CUDA_DL_URL_BASE)/$(CUDA_URL_FILENAME.$*) -O get-orig-source/$(CUDA_DL_FILENAME.$*)
	if [ -d $(CACHE) ] && [ ! -f $(CACHE)/$(CUDA_DL_FILENAME.$*) ]; then \
		ln -v get-orig-source/$(CUDA_DL_FILENAME.$*) $(CACHE) ; fi

# unpack the all-in-one .run cuda installer containing toolkit, driver and samples
get-orig-source-run-unpack-%: get-orig-source-download-%
	@set -e -x ; \
	    cd get-orig-source ; \
	    mkdir $(ORIGDIR.$*) ; \
	    sh $(CUDA_DL_FILENAME.$*) --noexec --keep --target tmp ; \
	    find tmp -ls ; \
	    if [ -d tmp/run_files ]; then \
	        mv -f tmp/run_files/cuda-linux*-rel*.run tmp/run_files/EULA.txt $(ORIGDIR.$*)/ ; \
	    else \
	        mv "$(CUDA_DL_FILENAME.$*)" $(ORIGDIR.$*)/ ; \
	    fi ; \
	    rm -rf tmp ; \
	    chmod 0755 $(ORIGDIR.$*)/*.run

# unpack the all-in-one .deb local-repo installer
get-orig-source-deb-unpack-%: get-orig-source-download-%
	@set -e -x ; \
	    cd get-orig-source ; \
	    mkdir $(ORIGDIR.$*) ; \
	    dpkg -X $(CUDA_DL_FILENAME.$*) tmp.$* ; \
	    mv tmp.$*/var/cuda-repo-$(CUDA_VERSION_MAJOR)-$(CUDA_VERSION_MINOR)-local/*.deb $(ORIGDIR.$*) ; \
	    rm -rf tmp.$* ; \
	    : "# Remove undistributable files:" ; \
	    rm -fv $(ORIGDIR.$*)/cuda-samples-$(CUDA_VERSION_MAJOR)-$(CUDA_VERSION_MINOR)_*.deb ; \
	    : "# Remove driver:" ; \
	    rm -fv $(ORIGDIR.$*)/libcuda1-[0-9][0-9][0-9]_*_*.deb ; \
	    rm -fv $(ORIGDIR.$*)/nvidia-[0-9][0-9][0-9]*_*_*.deb ; \
	    chmod 0644 $(ORIGDIR.$*)/*.deb

get-orig-source-unpack-amd64: get-orig-source-run-unpack-amd64
get-orig-source-unpack-ppc64el: get-orig-source-deb-unpack-ppc64el

get-orig-source-pack-%: get-orig-source-unpack-%
	@set -e -x ; \
	    cd get-orig-source ; \
	    latestfile=$$(ls -tr $$(find $(ORIGDIR.$*) -type f) | tail -n 1) ; \
	    tar cfv - \
	        --clamp-mtime --mtime="./$$latestfile" \
		--sort=name \
		--owner=root --group=src \
		$(ORIGDIR.$*) \
		| gzip -n9 > $(TARBALL.$*); \
	    touch $(TARBALL.$*) -r $$latestfile
	mv get-orig-source/$(TARBALL.$*) .

get-orig-source-pack-main: get-orig-source-pack-amd64

.PHONY: get-orig-source
get-orig-source: get-orig-source-pack-main get-orig-source-pack-ppc64el
	rm -rf get-orig-source