File: rules

package info (click to toggle)
libsdl3 3.4.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,312 kB
  • sloc: ansic: 428,899; objc: 13,036; xml: 9,581; cpp: 8,769; perl: 4,667; python: 3,538; sh: 813; makefile: 271; cs: 56
file content (136 lines) | stat: -rwxr-xr-x 4,313 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
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

built_binaries := $(shell dh_listpackages)

include /usr/share/dpkg/default.mk

export SDL_AUDIO_DRIVER=dummy
export SDL_VIDEO_DRIVER=dummy

# Upstream test timeouts assume a gaming-capable system.
# Keep the timeout reasonably short for architectures where interactive
# debugging is more likely, but extend it a lot on architectures that might
# be very slow or using qemu for buildds.
ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH)),)
test_timeout_multiplier = 3
else
test_timeout_multiplier = 20
endif

confflags = \
	-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON \
	-DSDL_ALSA_SHARED=OFF \
	-DSDL_DEPS_SHARED=ON \
	-DSDL_EXAMPLES=ON \
	-DSDL_FRIBIDI=ON \
	-DSDL_FRIBIDI_SHARED=OFF \
	-DSDL_HIDAPI_LIBUSB_SHARED=OFF \
	-DSDL_JACK=OFF \
	-DSDL_JACK_SHARED=ON \
	-DSDL_KMSDRM_SHARED=OFF \
	-DSDL_OSS=OFF \
	-DSDL_PULSEAUDIO_SHARED=OFF \
	-DSDL_RPATH=OFF \
	-DSDL_RPI=OFF \
	-DSDL_SHARED=ON \
	-DSDL_SNDIO_SHARED=ON \
	-DSDL_STATIC=ON \
	-DSDL_STATIC_PIC=ON \
	-DSDL_TESTS=ON \
	-DSDL_TESTS_TIMEOUT_MULTIPLIER=$(test_timeout_multiplier) \
	-DSDL_TEST_LIBRARY=ON \
	-DSDL_VENDOR_INFO="${DEB_VENDOR} ${DEB_VERSION}" \
	-DSDL_VIVANTE=OFF \
	-DSDL_X11=ON \
	-DSDL_X11_SHARED=OFF \
	-DSDLTEST_TIMEOUT_MULTIPLIER=$(test_timeout_multiplier) \
	$(NULL)

ifneq ($(filter %-tests,$(built_binaries)),)
  confflags += -DSDL_INSTALL_EXAMPLES=ON
  confflags += -DSDL_INSTALL_TESTS=ON
endif

ifeq ($(filter %-doc,$(built_binaries)),)
  confflags += -DSDL_INSTALL_DOCS=OFF
else
  confflags += -DSDL_INSTALL_DOCS=ON
endif

ifeq ($(DEB_HOST_ARCH_CPU),powerpc)
  confflags += -DSDL_ALTIVEC=OFF
endif

ifeq ($(DEB_HOST_ARCH_CPU),ppc64el)
  confflags += -DSDL_ALTIVEC=OFF
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
  confflags += -DSDL_PIPEWIRE_SHARED=ON
  confflags += -DSDL_WAYLAND=ON
  confflags += -DSDL_WAYLAND_LIBDECOR_SHARED=OFF
  confflags += -DSDL_WAYLAND_SHARED=OFF
else
  confflags += -DSDL_WAYLAND=OFF
endif

ifeq ($(DEB_VERSION_UPSTREAM),3.3.6+git20251229~95ac0ff+ds)
  # git describe --tags <hash>
  confflags += -DSDL_REVISION=SDL-prerelease-3.3.6-51-g95ac0ff4d6
endif

%:
	dh $@ -Scmake+ninja -Bbuild

override_dh_auto_configure:
	set -e; for png in test/icon.png test/gamepad_*.png test/glass.png; do \
		python3 cmake/xxd.py -i "$${png}" -o "$${png%.png}.h"; \
	done
	cd build-scripts && ./makecasefoldhashtable.pl > ../src/stdlib/SDL_casefolding.h
	set -e; for dir in src/render/gpu/shaders test test/testgpu; do \
		PATH=$(CURDIR)/debian/mini-shadercross:$$PATH env -C "$$dir" $(CURDIR)/$$dir/build-shaders.sh; \
	done
	# This is intended as a Windows batch file, but at the time of writing
	# it's so simple that it's also a valid shell script
	cd src/render/vulkan && sh -ex ./compile_shaders.bat
	sed -i -e 's/^const uint32_t/static &/' src/render/vulkan/VULKAN_*.h
	dh_auto_configure -- $(confflags)

execute_after_dh_auto_build:
ifneq ($(filter %-doc,$(built_binaries)),)
	sed -e 's/FULL_PATH_NAMES *=.*/FULL_PATH_NAMES = NO/' < docs/doxyfile > debian/Doxyfile
	cd docs && doxygen ../debian/Doxyfile
	# useless files
	find docs/output -name "*.md5" -delete
	find docs/output -type d -empty -delete
endif

# Only run testtimer as an autopkgtest on machines that we're reasonably
# sure are both fast and set up to be usable for interactive use
# (currently only x86 and 64-bit ARM).
# There is an assertion that requesting a 1ms delay does not result in
# a delay of more than 100ms, and that's not going to be reliably true
# on slow machines like riscv64 or batch-processing-oriented machines
# like s390x.
ifeq (,$(filter amd64 arm64 i386,$(DEB_HOST_ARCH)))
execute_after_dh_auto_install:
	rm -fv debian/tmp/usr/share/installed-tests/SDL3/testtimer.test
endif

execute_after_dh_auto_clean-indep:
	rm -f debian/Doxyfile
	rm -rf docs/output

# debhelper >= 13.4 makes all of /usr/libexec executable, which is not
# quite right for installed-tests
override_dh_fixperms:
	dh_fixperms -Xusr/libexec/installed-examples -Xusr/libexec/installed-tests
ifneq ($(filter %-tests,$(built_binaries)),)
	chmod --recursive --changes a+rX,u+w,og-w debian/libsdl3-tests/usr/libexec/installed-examples
	chmod --recursive --changes a+rX,u+w,og-w debian/libsdl3-tests/usr/libexec/installed-tests
endif

override_dh_installchangelogs:
	dh_installchangelogs -- WhatsNew.txt