1
Dependencies between server and drivers
2
=======================================
4
Cyril Brulebois <kibi@debian.org>
7
Upstream-side: ABI version numbers
8
----------------------------------
10
The X server defines several
11
http://en.wikipedia.org/wiki/Application_binary_interface[ABI] version numbers in the
12
`hw/xfree86/common/xf86Module.h` header, through the
13
`SET_ABI_VERSION(maj,min)` macro. In this document, the focus is on
14
`ABI_VIDEODRV_VERSION` and `ABI_XINPUT_VERSION`, which are
15
respectively about `video` drivers and `input` drivers.
17
An example of input ABI is `12.1`, `12` being the `major`, `1` being
20
Like in usual shared libraries, the major is bumped when interfaces
21
are broken. There’s no compatibility at all in that case.
23
The minor gets bumped when interfaces are added. In other words, if a
24
driver is working with `x.y`, it should also work with higher minors:
25
`x.z`; `z>y`. The converse is not true, if a driver requires a given
26
minor (for example because it needs a new feature, like MultiTouch),
27
it won’t work with lower minors (which didn’t provide the needed
28
feature). Put another way: we have ascending compatibility with the
31
Conclusion: We need to keep track of both major and minor.
33
Thanks to `pkg-config` we can query them:
36
$ pkg-config --variable=abi_videodrv xorg-server
38
$ pkg-config --variable=abi_xinput xorg-server
43
Debian-side: Using virtual packages
44
-----------------------------------
49
When `xorg-server` gets built, we use ++pkg-config++’s output to
50
determine the current major. Through substitution variables, we add
51
two virtual packages in the `Provides` field of the server (for both
52
`xserver-xorg-core` and `xserver-xorg-core-udeb`): `xorg-input-abi-$x`
53
and `xorg-video-abi-$y`, where `$x` and `$y` are the major part of the
54
version queried through `pkg-config` variables.
56
To handle ascending compatibility for minors, we maintain in
57
`debian/serverminver` the minimal version of `xserver-xorg-core` which
58
is needed. When a minor is bumped, we store the server version in that
59
file. This way, drivers built afterwards will depend on a *minimal*
60
version of the driver, the last which saw a minor version bump. In
61
other words: they will “depend on the server version they were built
62
against, or a higher/compatible one”.
64
Both ABI and minimal server version are recorded in two files shipped
65
in `xserver-xorg-dev`, to be used while building drivers:
67
* `/usr/share/xserver-xorg/xinputdep`
68
* `/usr/share/xserver-xorg/videodrvdep`
70
Example for `xinputdep`:
73
xorg-input-abi-11, xserver-xorg-core (>= 2:1.8.99.904)
75
To make sure we bump the `debian/serverminver` when there’s a minor
76
ABI change, there’s a `abibumpcheck` target (on which `clean`
77
depends), which extracts input and video ABI from the upstream header,
78
and compares them to the previous ones stored in
79
`debian/serverminver`, failing and diffing is something changed.
85
Drivers also use substitution variables in their control file,
86
replaced at build time.
90
Depends: ${xinpdriver:Depends}, …
91
Provides: ${xinpdriver:Provides}
94
Depends: ${xviddriver:Depends}, …
95
Provides: ${xviddriver:Provides}
98
For now, `${xinpdriver:Provides}` is always replaced with
99
`xorg-driver-input`, and `${xviddriver:Provides}` is always replaced
100
with `xorg-driver-video`. Hopefully provided packages will not change,
101
but using substitution variables is cheap, and makes it easy to add
102
tweaks afterwards if needed.
105
Driver’s build system
106
~~~~~~~~~~~~~~~~~~~~~
108
To set those variables, we ship a `dh_xsf_substvars` script in
109
`xserver-xorg-dev` starting with `2:1.9.4`, to be run before
110
`dh_gencontrol`. It iterates on the packages listed by
111
`dh_listpackages` (very old `debhelper` command) and does the
114
* It reads variables from the files mentioned above.
115
* If a package name ends with `-udeb`, it replaces
116
`xserver-xorg-core` with `xserver-xorg-core-udeb`.
117
* If a package name ends with `-dbg`, it does nothing for this
118
package. Debug packages usually depend strictly on the non-debug
119
packages, which in turn have appropriate dependencies.
120
* If a package name starts with `xserver-xorg-input-`, it appends
121
`xinpdriver:Depends=…` and `xinpdriver:Provides=…` to this
122
package’s substvars file.
123
* If a package name starts with `xserver-xorg-video-`, it appends
124
`xviddriver:Depends=…` and `xviddriver:Provides=…` to this
125
package’s substvars file.
127
Why such heuristics? The idea is to avoid getting “unused substitution
128
variable” warning messages while building. And since there’s a clear
129
`xserver-xorg-{input,video}-*` namespace, we can use that to specify
130
only input-related variables for input drivers, and only video-related
131
variables for video drivers.
133
To make it easy to compute substvars when using `dh`, a `dh` sequence
134
(`xsf.pm`) is shipped. As of `2:1.9.4-1`, it inserts
135
`dh_xsf_substvars` right before the `dh_gencontrol` call. Other
136
repetitive tasks could also be automated this way.
140
Sample driver packaging
141
-----------------------
143
The following assumes:
145
* The upstream build system is sane enough, which lets us run
146
`autoreconf` at build time.
147
* It is a `video` driver. For an `input` driver, replace both
148
`xviddriver` occurrences with `xinpdriver`.
150
Sample debian/control file
151
~~~~~~~~~~~~~~~~~~~~~~~~~~
158
xserver-xorg-dev (>= 2:1.9.4),
165
${xviddriver:Depends},
167
${xviddriver:Provides}
170
Sample debian/rules file
171
~~~~~~~~~~~~~~~~~~~~~~~~
177
#override_dh_auto_configure:
178
# dh_auto_configure -- --with-FOO --without-BAR
180
# Install in debian/tmp to retain control through dh_install:
181
override_dh_auto_install:
182
dh_auto_install --destdir=debian/tmp
184
# Kill *.la files, and forget no-one:
186
find debian/tmp -name '*.la' -delete
187
dh_install --fail-missing
191
# dh_strip --dbg-package=xserver-xorg-video-DRIVER-dbg
193
# That's a plugin, use appropriate warning level:
194
override_dh_shlibdeps:
195
dh_shlibdeps -- --warnings=6
198
dh $@ --with quilt,autoreconf,xsf --builddirectory=build/
203
* `dh_auto_configure`: Commented out since there’s usually no
204
specific option to pass when building drivers. Sometimes needed to
205
get a related utility built.
206
* `dh_auto_install`: It behaves differently when operating on a
207
single package (it installs under `debian/PACKAGE` instead of
208
`debian/tmp`), so make it use `debian/tmp` in all cases. This way,
209
`dh_install` has to be used (see below). That also means that a
210
binary package (_e.g._ a debug package) can be added without
212
* `dh_install`: No point in keeping the `.la` files. Also, using
213
`--fail-missing` makes sure every file installed by upstream is
214
installed in some package, or explicitly ignored.
215
* `dh_strip`: Commented out, there’s only a few drivers shipping a
217
* `dh_shlibdeps`: The comment really says it all.
218
* `dh`: The order is important! We want patching to happen before
219
autoreconfiguring (both `quilt` and `autoreconf` insert commands
220
before `dh_auto_configure`, and after `dh_clean`). Also, we build
221
out-of-tree. The `xsf` sequence is explained in the previous part.
223
If one needs to build several flavours,
224
http://git.debian.org/?p=pkg-xorg/driver/xserver-xorg-video-fbdev.git;a=blob;f=debian/rules[++fbdev++’s rules file]
225
can be used as an example.
232
Staying informed of driver-related changes can be a bit difficult in
235
* If one maintains a single driver within the X Strike Force, one
236
might not notice the few mails about drivers in the heavy mail flow
238
* If one maintains a driver outside the X Strike Force, one is
239
probably not subscribed to the mailing list at all.
241
For those reasons, a mail alias is being set up to gather all
242
maintainers interested in receiving driver-related mails.