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