File: rules

package info (click to toggle)
psychtoolbox-3 3.0.9%2Bsvn2579.dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 63,408 kB
  • sloc: ansic: 73,310; cpp: 11,139; objc: 3,129; sh: 1,669; python: 382; php: 272; makefile: 172; java: 113
file content (150 lines) | stat: -rwxr-xr-x 5,733 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
#!/usr/bin/make -f
# -*- makefile -*-

# get Octave paths
include /usr/share/octave/debian/defs.make
# get Matlab paths
include /usr/share/matlab/debian/defs.make

srcpkg = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Source:' | cut -d ' ' -f 2,2)
debver = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2,2 )
uver = $(shell echo $(debver) | cut -d '-' -f 1,1 )

# Directories which are created/populated/cleanedup
BDIRS=PsychSourceGL/Projects/Linux/build/ Psychtoolbox/PsychBasic/Octave3LinuxFiles Psychtoolbox/PsychBasic/PsychPlugins
OCT_SHAREDDIR=debian/psychtoolbox-3-common/usr/share/psychtoolbox-3
OCT_LIBDIR=debian/octave-psychtoolbox-3/usr/lib/psychtoolbox-3

export LDFLAGS=-Wl,--as-needed

# Critical for building on machines with multiarch support
# (e.g. ubuntu 11.04)
GLIB_INCLUDES=$(shell pkg-config --cflags glib-2.0)

# Upstream advises to build without optimization at the moment
export CXXFLAGS=-Wall -g -O0
export CFLAGS=-Wall -g -O0 -std=gnu99 $(GLIB_INCLUDES)

%:
	dh $@

override_dh_auto_build: build-stamp
build-stamp:
	mkdir -p $(BDIRS)
	: # Build patched version of portaudio
	: # dependent on patch deb_portaudio_Makefile
	$(MAKE) -C PsychSourceGL/Cohorts/PortAudio

	: # Build all extensions, but:
	: #  3  dependent on portaudio above
	: #  4  libeyelink -- non-distributable binary blob with open-sourced API
	cd PsychSourceGL/Source/; \
		for mode in 0 1 2 3   5 6 7 8 9; do \
		  octave -p $(CURDIR)/Psychtoolbox/PsychOneliners -q --eval "linuxmakeitoctave3_ubuntugutsy($$mode)" || exit 1; \
	done

	: # Manually build OpenGL text renderer extension
	cd PsychSourceGL/Cohorts/FTGLTextRenderer; \
	$(CXX) $(CXXFLAGS) -I. -I/usr/include/ -I/usr/include/freetype2/ \
		-L/usr/lib -pie -shared -fPIC \
		-o libptbdrawtext_ftgl.so.1 \
		libptbdrawtext_ftgl.cpp qstringqcharemulation.cpp OGLFT.cpp \
		-lGL -lGLU -lfontconfig -lfreetype

	: # Manually build tcp_udp_ip toolbox's extension
	cd ./Psychtoolbox/PsychHardware/iViewXToolbox/tcp_udp_ip; \
		octave -q --eval "mex pnet.c"; [ -f pnet.mex ]

	install --mode=0644 PsychSourceGL/Cohorts/FTGLTextRenderer/libptbdrawtext_ftgl.so.1 \
	   Psychtoolbox/PsychBasic/PsychPlugins
	touch $@

override_dh_auto_install:
	dh_auto_install
	: # to guarantee -common existance for arch-dep builds only:
	mkdir -p $(OCT_SHAREDDIR)
	rsync -a --exclude=*.o ./Psychtoolbox/ $(OCT_SHAREDDIR)

	: # Move .mex to reside alongside with .m to gain easy help in octave
	mv $(OCT_SHAREDDIR)/PsychBasic/Octave3LinuxFiles/* $(OCT_SHAREDDIR)/PsychBasic
	: # But PsychHID must go into PsychHardware alongside with .m
	mv $(OCT_SHAREDDIR)/PsychBasic/PsychHID.mex $(OCT_SHAREDDIR)/PsychHardware
	rmdir $(OCT_SHAREDDIR)/PsychBasic/Octave3LinuxFiles

	: # Move .mex binaries under /usr/lib and create symlinks file to point back
	mkdir -p $(OCT_LIBDIR)
	cp debian/octave-psychtoolbox-3.links.in  debian/octave-psychtoolbox-3.links
	find $(OCT_SHAREDDIR)/ -iname \*.mex | while read f; do \
		fn=$$(basename $$f); ds=$$(dirname $$f); \
		dl=$$(echo $$ds | sed -e 's,psychtoolbox-3-common,octave-psychtoolbox-3,g' -e 's,/share/,/lib/,g'); \
		echo "I: Moving $$f under $$dl"; \
		mkdir -p $$dl; \
		mv $$f $$dl; \
		echo "/usr/lib$${f#*usr/share}	/usr$${f#*usr}" >> debian/octave-psychtoolbox-3.links; \
	done

	cp debian/psychtoolbox-3-lib.links.in  debian/psychtoolbox-3-lib.links
	find $(OCT_SHAREDDIR)/ -iname \*.so* -o -iname \*.a | while read f; do \
		fn=$$(basename $$f); ds=$$(dirname $$f); \
		dl=$$(echo $$ds | sed -e 's,psychtoolbox-3-common,psychtoolbox-3-lib,g' -e 's,/share/,/lib/,g'); \
		echo "I: Moving $$f under $$dl"; \
		mkdir -p $$dl; \
		mv $$f $$dl; \
		echo "/usr/lib$${f#*usr/share}	/usr$${f#*usr}" >> debian/psychtoolbox-3-lib.links; \
	done

	: # Filter out duplicate licenses etc
	find debian/ -iname 3Dlabs-License.txt -o \
				 -iname COPYING -o \
				 -iname *license.txt | xargs -r rm

	: # Filter out some scripts which aren't pertitent to Debian systems
	find debian/ -iname simplepsychtoolboxsetup.sh -o -iname setupdate.sh | xargs -r rm


override_dh_makeshlibs:
	dh_makeshlibs
	: # Provide Octave:Depends
	[ -e /usr/bin/octave-depends ] \
	&& octave-depends \
	|| echo 'octave:Depends=octave (>= 3.4.3-1~)' >> debian/octave-psychtoolbox-3.substvars

#override_dh_fixperms:
#	dh_fixperms

override_dh_strip:
	dh_strip --dbg-package=psychtoolbox-3-dbg

override_dh_shlibdeps:
	@: # octave will take care of proper deps for extensions -- no need to scan
	@: # them and warn all the time
	dh_shlibdeps -l$(shell octave-config --print OCTLIBDIR)

	: # Manually remove executable bit for everything not to be executed (e.g. .mex .m .so.*)
	@: # needs to be done post dh_strip,dh_shlibdeps so that .mex are found by dh_strip, dh_shlibdeps
#	find debian/ -regextype posix-egrep \
#	-regex '.*\.(c|jpg|vert|frag|xml|html|hiro|kanji|mat|m|txt|mex|so(|\..*))' \
#	-perm /+x -print0 \
	@: # strip from all files since we do not have any real executable there
	find debian/ -ipath '*psych*/usr/*' -perm /+x -type f ! -iname ATIRadeonperf_Linux -print0 \
	| xargs -0 --no-run-if-empty chmod a-x

override_dh_installchangelogs:
	dh_installchangelogs debian/changelog.upstream

override_dh_clean:
	dh_clean
	rm -f build-stamp
	: # Manually remove  additional trash
	find Psych* -regextype posix-egrep -regex '.*\.(o|mex|so(|\..*))' -delete
	-rmdir $(BDIRS)
	: # Prune some Debian generated files
	-rm debian/octave-psychtoolbox-3.links debian/psychtoolbox-3-lib.links
	$(MAKE) -C PsychSourceGL/Cohorts/PortAudio clean

debian/changelog.upstream:
	git log remotes/branches/beta >| $@

get-orig-source: debian/changelog.upstream
	git archive --format=tar --prefix=$(srcpkg)-$(gitver)/ dfsg | \
        gzip -9 > $(srcpkg)_$(uver).orig.tar.gz