summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 4d838baaa984fbd4a3a354453cd0c41fe27ec53d (plain)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

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

include debian/xsfbs/xsfbs.mk

# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	confflags += --build=$(DEB_HOST_GNU_TYPE)
else
	confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif
ifeq (linux, $(DEB_HOST_ARCH_OS))
	confflags += --enable-udev
	confflags += --enable-libkms
	LIBKMS = yes
	confflags += --enable-vmwgfx-experimental-api
	confflags += --enable-nouveau-experimental-api
	NOUVEAU = yes
	confflags += --enable-radeon
	RADEON = yes
else
	confflags += --disable-udev
	confflags += --disable-libkms
	LIBKMS=no
	confflags += --disable-nouveau-experimental-api
	NOUVEAU = no
	confflags += --disable-radeon
	RADEON = no
endif

# only build libdrm-intel on x86
ifneq (,$(filter amd64 i386,$(DEB_HOST_ARCH_CPU)))
ifneq (,$(filter linux kfreebsd,$(DEB_HOST_ARCH_OS)))
	INTEL = yes
endif
endif

ifeq ($(INTEL), yes)
	confflags += --enable-intel
else
	confflags += --disable-intel
endif

CFLAGS = -Wall -g

ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
	MAKEFLAGS += -j$(NUMJOBS)
endif

configure: $(STAMP_DIR)/patch
	dh_testdir
	autoreconf -vfi

build/config.status: configure
	dh_testdir
	test -d build || mkdir build
	cd build && \
	../configure \
		--prefix=/usr \
		--mandir=\$${prefix}/share/man \
		--infodir=\$${prefix}/share/info \
		--enable-static=yes \
		$(confflags) \
		CFLAGS="$(CFLAGS)"

build: build-stamp
build-stamp: build/config.status
	dh_testdir
	cd build && $(MAKE)
	>$@

clean: xsfclean
	dh_testdir
	dh_testroot
	rm -f build-stamp

	rm -f config.cache config.log config.status
	rm -f */config.cache */config.log */config.status
	rm -f conftest* */conftest*
	rm -rf autom4te.cache */autom4te.cache
	rm -rf build
	rm -f $$(find -name Makefile.in)
	rm -f compile config.guess config.sub configure depcomp install-sh
	rm -f ltmain.sh missing INSTALL aclocal.m4 config.h.in mkinstalldirs
	rm -f libdrm.pc libdrm/config.h.in

	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	cd build && $(MAKE) install DESTDIR=$(CURDIR)/debian/tmp

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -s
	dh_testroot -s
	dh_installchangelogs -s ChangeLog
	dh_installdocs -s
	dh_installexamples -s
	dh_install -s --sourcedir=debian/tmp -X.la --fail-missing
	dh_link -s
	dh_strip -plibdrm2 --dbg-package=libdrm2-dbg
ifeq ($(INTEL), yes)
	dh_strip -plibdrm-intel1 --dbg-package=libdrm-intel1-dbg
endif
ifeq ($(NOUVEAU), yes)
	dh_strip -plibdrm-nouveau1a --dbg-package=libdrm-nouveau1a-dbg
endif
ifeq ($(RADEON), yes)
	dh_strip -plibdrm-radeon1 --dbg-package=libdrm-radeon1-dbg
endif
ifeq ($(LIBKMS), yes)
	dh_strip -p libkms1 --dbg-package=libkms1-dbg
endif
	dh_strip -s --remaining-packages
	dh_compress -s
	dh_fixperms -s
	dh_makeshlibs -plibdrm2 -V'libdrm2 (>= 2.4.17)' -- -c4
ifeq ($(INTEL), yes)
	dh_makeshlibs -plibdrm-intel1 -V'libdrm-intel1 (>= 2.4.23-3~)' -- -c4
endif
ifeq ($(NOUVEAU), yes)
	dh_makeshlibs -plibdrm-nouveau1a -V'libdrm-nouveau1a (>= 2.4.23)' -- -c4
endif
ifeq ($(RADEON), yes)
	dh_makeshlibs -plibdrm-radeon1 -V'libdrm-radeon1 (>= 2.4.20)' -- -c4
endif
ifeq ($(LIBKMS), yes)
	dh_makeshlibs -plibkms1 -V'libkms1' -- -c4
endif
	dh_installdeb -s
	dh_shlibdeps -s
	dh_lintian -s
	dh_gencontrol -s
	dh_md5sums -s
	dh_builddeb -s

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install