xref: /OK3568_Linux_fs/external/xserver/debian/rules (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/usr/bin/make -f
2
3include debian/rules.flags
4
5include /usr/share/dpkg/architecture.mk
6
7%:
8	dh $@ --with quilt
9
10override_dh_autoreconf-arch: abibumpcheck
11	dh_autoreconf
12
13override_dh_autoreconf-indep:
14	dh_autoreconf
15	mkdir -p build-source
16	tar \
17	--owner=0 --group=0 \
18        --transform 's,^,xorg-server/,' \
19	--exclude=debian \
20	--exclude=autom4te.cache \
21	--exclude=build-source \
22	--sort=name \
23	--mtime=@$(SOURCE_DATE_EPOCH) \
24	--clamp-mtime \
25	--mode=u+rw,go+r,go-w,a-s \
26        -cf - * | xz > build-source/xorg-server.tar.xz
27
28override_dh_auto_configure:
29	dh_auto_configure --builddirectory=debian/build/main -- \
30		$(confflags) \
31		$(confflags_main) \
32		$(vars)
33	dh_auto_configure --builddirectory=debian/build/udeb -- \
34		$(confflags) \
35		$(confflags_udeb) \
36		$(vars)
37
38override_dh_auto_build:
39	dh_auto_build --builddirectory=debian/build/main
40	dh_auto_build --builddirectory=debian/build/udeb
41
42override_dh_auto_test:
43	dh_auto_test -- -j1 VERBOSE=1
44
45override_dh_auto_install:
46	dh_auto_install --builddirectory=debian/build/main \
47		--destdir=debian/tmp/main
48	dh_auto_install --builddirectory=debian/build/udeb \
49		--destdir=debian/tmp/udeb
50
51	# oh, yuck.
52	find debian/tmp/*/usr/lib/xorg -type f -name '*.la' -delete
53
54	# remove modules not needed in d-i
55	rm -rf debian/tmp/udeb/usr/lib/xorg/modules/multimedia
56	rm -f debian/tmp/udeb/usr/lib/xorg/modules/libxaa.so
57	rm -f debian/tmp/udeb/usr/lib/xorg/modules/libexa.so
58	rm -f debian/tmp/udeb/usr/lib/xorg/modules/libwfb.so
59	rm -f debian/tmp/udeb/usr/lib/xorg/modules/libxf8_16bpp.so
60
61	# we don't ship these from the udeb build, needed for dh_install
62	# --fail-missing
63	rm -rf debian/tmp/udeb/var/lib/xkb/README.compiled
64	rm -rf debian/tmp/udeb/usr/bin/X
65	rm -rf debian/tmp/udeb/usr/include
66	rm -rf debian/tmp/udeb/usr/share/aclocal
67	rm -rf debian/tmp/udeb/usr/share/man
68	rm -rf debian/tmp/udeb/usr/lib/*/pkgconfig
69
70	install -m 755 debian/local/xvfb-run debian/tmp/main/usr/bin
71	install debian/local/xvfb-run.1 debian/tmp/main/usr/share/man/man1
72ifneq ($(DEB_HOST_ARCH_OS), linux)
73	install -d debian/tmp/main/usr/share/X11/xorg.conf.d
74	install -m 644 debian/local/10-*.conf debian/tmp/main/usr/share/X11/xorg.conf.d
75	install -d debian/tmp/udeb/usr/share/X11/xorg.conf.d
76	install -m 644 debian/local/10-*.conf debian/tmp/udeb/usr/share/X11/xorg.conf.d
77endif
78
79# Only read the first line, the rest of the file is used to determine
80# when the minimal version is to be bumped:
81SERVERMINVER = debian/serverminver
82serverminver = $(shell head -1 $(SERVERMINVER))
83
84.PHONY: abibumpcheck
85abibumpcheck: debian/serverminver
86	@echo Checking for the need of an ABI bump
87	# Build an updated version of the file:
88	head -1 $(SERVERMINVER) > $(SERVERMINVER).new
89	perl -ne 'print "$$1:$$2.$$3\n" if /^#define\s+(ABI_(?:VIDEODRV|XINPUT)_VERSION)\s+SET_ABI_VERSION\(\s*(\d+)\s*,\s*(\d+)\s*\)/' hw/xfree86/common/xf86Module.h|sort >> $(SERVERMINVER).new
90	# Compare both files:
91	@if ! cmp --quiet $(SERVERMINVER) $(SERVERMINVER).new; then \
92	echo "serverminver bump required, ABI changed!";\
93	echo "When bumping major or minor, always bump required xorg-server minimum";\
94	echo "version too, the newly built drivers are not backwards compatible!";\
95	diff -u $(SERVERMINVER) $(SERVERMINVER).new; \
96	exit 1; \
97	else \
98	echo "ABI unchanged"; \
99	rm -f $(SERVERMINVER).new; \
100	fi
101
102override_dh_fixperms-arch:
103	dh_fixperms
104	chown root:root $(CURDIR)/debian/xserver-xorg-legacy/usr/lib/xorg/Xorg.wrap
105	chmod ug+s $(CURDIR)/debian/xserver-xorg-legacy/usr/lib/xorg/Xorg.wrap
106
107override_dh_install:
108	dh_install -pxserver-xorg-core-udeb --sourcedir=debian/tmp/udeb
109	dh_install --remaining-packages --sourcedir=debian/tmp/main
110	install -d $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg
111	# Extract only the major ABI version:
112	set -e; \
113		abi_videodrv=`PKG_CONFIG_PATH=debian/tmp/main/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig pkg-config --variable=abi_videodrv xorg-server|cut -d . -f 1`; \
114		test -n "$$abi_videodrv"; echo videoabi=xorg-video-abi-$$abi_videodrv > debian/xserver-xorg-core.substvars && \
115		echo "xorg-video-abi-$$abi_videodrv, xserver-xorg-core (>= $(serverminver))" > debian/xserver-xorg-dev/usr/share/xserver-xorg/videodrvdep
116	set -e; \
117		abi_xinput=`PKG_CONFIG_PATH=debian/tmp/main/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig pkg-config --variable=abi_xinput xorg-server|cut -d . -f 1`; \
118		test -n "$$abi_xinput"; echo inputabi=xorg-input-abi-$$abi_xinput >> debian/xserver-xorg-core.substvars && \
119		echo "xorg-input-abi-$$abi_xinput, xserver-xorg-core (>= $(serverminver))" > debian/xserver-xorg-dev/usr/share/xserver-xorg/xinputdep
120
121	# The udeb uses the same substvars:
122	cp debian/xserver-xorg-core.substvars debian/xserver-xorg-core-udeb.substvars
123
124	# save the configure flags so that packages like vnc, tightvnc, tigervnc
125	# know how the package was built.
126	echo 'xserver_confflags = $(confflags) $(confflags_main)' \
127		> debian/xserver-xorg-dev/usr/share/xserver-xorg/configure_flags.mk
128
129	install -m 755 -d debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core
130	install -m 755 debian/xserver-xorg-core.bug.script debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core/script
131ifeq ($(DEB_HOST_ARCH_OS), linux)
132	install -d debian/xserver-xorg-core/lib/udev/rules.d
133	install -m 644 debian/local/64-xorg-xkb.rules debian/xserver-xorg-core/lib/udev/rules.d
134	install -d debian/xserver-xorg-core-udeb/lib/udev/rules.d
135	install -m 644 debian/local/64-xorg-xkb.rules debian/xserver-xorg-core-udeb/lib/udev/rules.d
136endif
137
138override_dh_missing-indep:
139	dh_missing -i -X udeb/
140
141override_dh_missing-arch:
142	dh_missing --fail-missing
143
144override_dh_clean:
145	dh_clean
146	rm -rf debian/build
147	rm -rf build-source
148