File: rules

package info (click to toggle)
nvidia-cg-toolkit 3.1.0013-5
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 187,516 kB
  • sloc: ansic: 510,168; cpp: 34,693; makefile: 745
file content (96 lines) | stat: -rwxr-xr-x 3,463 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
#!/usr/bin/make -f

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

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk

CG_INC_PATH	 = $(CURDIR)/$(DEB_HOST_ARCH)/include
CG_LIB_PATH	 = $(CURDIR)/$(DEB_HOST_ARCH)/$(if $(filter amd64,$(DEB_HOST_ARCH)),lib64,lib)

export LINKFLAGS
override_dh_auto_build: LINKFLAGS += $(LDFLAGS) -Wl,--as-needed
override_dh_auto_build:
	test -d amd64 && test -d i386 || ( echo "ERROR: The sources are not unpacked." ; exit 1 )
	$(MAKE) -C $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cginfo/ \
		CG_INC_PATH=$(CG_INC_PATH)
	$(MAKE) -C $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cgfxcat/ \
		CG_INC_PATH=$(CG_INC_PATH) CG_LIB_PATH=$(CG_LIB_PATH)

override_dh_compress:
	dh_compress -XMakefile -X.c -X.h

override_dh_installdocs:
	dh_installdocs -Xlicense.pdf -Xlicense.txt

override_dh_installexamples:
	test ! -d $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cginfo/ || \
		$(MAKE) -C $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cginfo/ clean
	test ! -d $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cgfxcat/ || \
		$(MAKE) -C $(DEB_HOST_ARCH)/local/Cg/examples/Tools/cgfxcat/ clean
	dh_installexamples -X.sln -X.vcproj -X.vcxproj
	test ! -d debian/nvidia-cg-doc/usr/share/doc/nvidia-cg-doc/examples/ || \
		$(MAKE) -C debian/nvidia-cg-doc/usr/share/doc/nvidia-cg-doc/examples/ clean
	test ! -d debian/nvidia-cg-doc/usr/share/doc/nvidia-cg-doc/examples/Trace/ || \
		$(MAKE) -C debian/nvidia-cg-doc/usr/share/doc/nvidia-cg-doc/examples/Trace/ clean

# Disable stripping since it may violate the license terms (modifies binaries).
# We compile cginfo and cgfxcat from source and can strip them.
override_dh_dwz:
	dh_dwz -XlibCgGL.so -XlibCg.so -Xcgc
override_dh_strip:
	dh_strip -XlibCgGL.so -XlibCg.so -Xcgc

%:
	dh $@

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

VERSION		 = $(DEB_VERSION_UPSTREAM)
TARBALLi386	 = nvidia-cg-toolkit_$(VERSION).orig-i386.tar.gz
TARBALLamd64	 = nvidia-cg-toolkit_$(VERSION).orig-amd64.tar.gz

URL1		 = http://http.developer.nvidia.com/Cg/
URL2		 = index_releases.html

.PHONY: get-orig-source
get-orig-source:
	LINK=$$(wget -q $(URL1)$(URL2) -O - | grep $(VERSION) | cut -d'"' -f2) ; \
	CURRENTURL=$(URL1)$$LINK ; \
	if [ -n "$$LINK" ]; then \
		wget -q $$CURRENTURL -O - | grep "x86.tgz" | cut -d '"' -f2 | wget -O $(TARBALLi386) -i - ; \
		wget -q $$CURRENTURL -O - | grep "_64.tgz" | cut -d '"' -f2 | wget -O $(TARBALLamd64) -i - ; \
	else \
		echo "Could not find nvidia-cg-toolkit version $(VERSION)" ; \
		exit 1 ; \
	fi

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

# The tarballs are kept in a separate git repository and use the git-lfs
# storage backend.

UPSTREAM_NAME		 = nvidia-cg-toolkit

GIT			?= git
TARBALL_REPOSITORY	 = https://salsa.debian.org/nvidia-team/tarballs-$(UPSTREAM_NAME).git
TARBALL_TREE		 = ../tarballs-$(UPSTREAM_NAME)

$(TARBALL_TREE):
	$(RM) -r $@.tmp
	$(GIT) clone --no-checkout $(TARBALL_REPOSITORY) $@.tmp
	cd $@.tmp && $(GIT) lfs install --local
	cd $@.tmp && $(GIT) checkout
	mv $@.tmp $@

# only invoked manually
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))