| 1 | #!/usr/bin/make -f |
| 2 | # debian/rules for the Debian xorg-server package. |
| 3 | # Copyright © 2004 Scott James Remnant <scott@netsplit.com> |
| 4 | # Copyright © 2005 Daniel Stone <daniel@fooishbar.org> |
| 5 | # Copyright © 2005 David Nusinow <dnusinow@debian.org> |
| 6 | |
| 7 | # Uncomment this to turn on verbose mode. |
| 8 | #export DH_VERBOSE=1 |
| 9 | |
| 10 | # Set up the $(STAMP_DIR) directory, and use it for quilt' stamp: |
| 11 | STAMP_DIR := stampdir |
| 12 | QUILT_STAMPFN := $(STAMP_DIR)/patch |
| 13 | $(STAMP_DIR)/stampdir: |
| 14 | mkdir $(STAMP_DIR) |
| 15 | >$@ |
| 16 | |
| 17 | include /usr/share/quilt/quilt.make |
| 18 | |
| 19 | ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 20 | NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) |
| 21 | MAKEFLAGS += -j$(NUMJOBS) |
| 22 | endif |
| 23 | |
| 24 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) |
| 25 | DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) |
| 26 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) |
| 27 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) |
| 28 | DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) |
| 29 | ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE)) |
| 30 | confflags += --build=$(DEB_HOST_GNU_TYPE) |
| 31 | else |
| 32 | confflags += --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) |
| 33 | endif |
| 34 | |
| 35 | # udeb is arch-dependent... |
| 36 | ifneq (, $(filter %-udeb, $(shell dh_listpackages -s))) |
| 37 | udeb = yes |
| 38 | endif |
| 39 | |
| 40 | # ...but let's support disabling it to speed up debug builds: |
| 41 | ifneq (,$(filter noudeb,$(DEB_BUILD_OPTIONS))) |
| 42 | udeb = |
| 43 | DH_INSTALL_OPTIONS = -Nxserver-xorg-core-udeb |
| 44 | endif |
| 45 | |
| 46 | |
| 47 | ifeq ($(DEB_HOST_ARCH_OS), linux) |
| 48 | selinux = --enable-xselinux |
| 49 | build_xmir = --enable-xmir |
| 50 | else |
| 51 | selinux = --disable-xselinux |
| 52 | endif |
| 53 | |
| 54 | # Mir isn't built on PPC |
| 55 | ifneq (,$(filter $(DEB_HOST_ARCH), arm64 powerpc ppc64el)) |
| 56 | build_xmir = --disable-xmir |
| 57 | endif |
| 58 | |
| 59 | ifeq ($(DEB_HOST_ARCH_OS), hurd) |
| 60 | dri = --disable-dri --disable-dri2 --disable-dri3 |
| 61 | else |
| 62 | dri = --enable-dri --enable-dri2 |
| 63 | ifeq ($(DEB_HOST_ARCH_OS), linux) |
| 64 | dri += --enable-dri3 |
| 65 | else |
| 66 | # disable dri3 on kbsd until xtrans fd passing is enabled |
| 67 | dri += --disable-dri3 |
| 68 | endif |
| 69 | endif |
| 70 | |
| 71 | config_backend = --disable-config-dbus --disable-config-hal |
| 72 | ifeq ($(DEB_HOST_ARCH_OS), linux) |
| 73 | config_backend += --enable-config-udev |
| 74 | else ifeq ($(DEB_HOST_ARCH_OS), kfreebsd) |
| 75 | config_backend += --disable-config-udev --enable-config-devd |
| 76 | libs = $(shell pkg-config --libs libbsd-overlay) |
| 77 | cppflags = $(shell pkg-config --cflags libbsd-overlay) |
| 78 | else # hurd |
| 79 | config_backend += --disable-config-udev |
| 80 | endif |
| 81 | |
| 82 | vars = $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+pie" DEB_LDFLAGS_MAINT_APPEND="-Wl,-Bsymbolic" DEB_CPPFLAGS_MAINT_APPEND="-DPRE_RELEASE=0 $(cppflags)" dpkg-buildflags --export=configure) LIBS="$(libs)" |
| 83 | |
| 84 | ifneq (,$(filter nocheck, $(DEB_BUILD_OPTIONS))) |
| 85 | config_tests = --disable-unit-tests |
| 86 | else |
| 87 | config_tests = --enable-unit-tests |
| 88 | endif |
| 89 | |
| 90 | INSTALL=/usr/bin/install |
| 91 | |
| 92 | VENDOR = $(shell lsb_release -i -s) |
| 93 | SUPPORT = For technical support please see http://www.ubuntu.com/support |
| 94 | |
| 95 | SOURCE_NAME := xorg-server |
| 96 | SOURCE_VERSION := $(shell dpkg-parsechangelog | awk -F': ' '/^Version: / {print $$2}') |
| 97 | |
| 98 | # Add a workaround for LP: #1266492 |
| 99 | confflags += lt_cv_prog_compiler_static_works=no |
| 100 | |
| 101 | # Add a workaround for LP: #1266492 |
| 102 | confflags += lt_cv_prog_compiler_static_works=no |
| 103 | |
| 104 | # disable-static is so we don't get libfoo.a for modules. now if only we could |
| 105 | # kill the .las. |
| 106 | confflags += \ |
| 107 | --disable-silent-rules \ |
| 108 | --disable-static \ |
| 109 | --without-dtrace \ |
| 110 | --disable-strict-compilation \ |
| 111 | --disable-debug \ |
| 112 | $(config_tests) \ |
| 113 | --with-int10=x86emu \ |
| 114 | --with-extra-module-dir="/usr/lib/${DEB_HOST_MULTIARCH}/xorg/extra-modules,/usr/lib/xorg/extra-modules" \ |
| 115 | --with-os-vendor="$(VENDOR)" \ |
| 116 | --with-builderstring="$(SOURCE_NAME) $(SOURCE_VERSION) ($(SUPPORT))" \ |
| 117 | --with-xkb-path=/usr/share/X11/xkb \ |
| 118 | --with-xkb-output=/var/lib/xkb \ |
| 119 | --disable-install-libxf86config \ |
| 120 | --enable-mitshm \ |
| 121 | --enable-xres \ |
| 122 | --disable-xcsecurity \ |
| 123 | --disable-tslib \ |
| 124 | --enable-dbe \ |
| 125 | --disable-xf86bigfont \ |
| 126 | --enable-dpms \ |
| 127 | $(config_backend) \ |
| 128 | --enable-xorg \ |
| 129 | --disable-linux-acpi \ |
| 130 | --disable-linux-apm \ |
| 131 | --disable-xquartz \ |
| 132 | --disable-xwin \ |
| 133 | --disable-xfake \ |
| 134 | --disable-xfbdev \ |
| 135 | --disable-install-setuid |
| 136 | |
| 137 | confflags_main = \ |
| 138 | --with-default-font-path="/usr/share/fonts/X11/misc,/usr/share/fonts/X11/cyrillic,/usr/share/fonts/X11/100dpi/:unscaled,/usr/share/fonts/X11/75dpi/:unscaled,/usr/share/fonts/X11/Type1,/usr/share/fonts/X11/100dpi,/usr/share/fonts/X11/75dpi,built-ins" \ |
| 139 | --enable-aiglx \ |
| 140 | --enable-glx-tls \ |
| 141 | --enable-registry \ |
| 142 | --enable-composite \ |
| 143 | --enable-record \ |
| 144 | --enable-xv \ |
| 145 | --enable-xvmc \ |
| 146 | --enable-dga \ |
| 147 | --enable-screensaver \ |
| 148 | --enable-xdmcp \ |
| 149 | --enable-xdm-auth-1 \ |
| 150 | --enable-glx \ |
| 151 | $(dri) \ |
| 152 | --enable-present \ |
| 153 | --enable-xinerama \ |
| 154 | --enable-xf86vidmode \ |
| 155 | --enable-xace \ |
| 156 | $(selinux) \ |
| 157 | --enable-xfree86-utils \ |
| 158 | --enable-dmx \ |
| 159 | --enable-xvfb \ |
| 160 | --enable-xnest \ |
| 161 | --enable-kdrive \ |
| 162 | --enable-xephyr \ |
| 163 | $(build_xfbdev) \ |
| 164 | $(build_xmir) \ |
| 165 | --with-sha1=libgcrypt \ |
| 166 | --enable-xcsecurity \ |
| 167 | $(config_backend_main) \ |
| 168 | $(void) |
| 169 | |
| 170 | confflags_udeb = \ |
| 171 | --with-default-font-path="built-ins" \ |
| 172 | --disable-aiglx \ |
| 173 | --disable-glx-tls \ |
| 174 | --disable-registry \ |
| 175 | --disable-composite \ |
| 176 | --disable-record \ |
| 177 | --disable-xv \ |
| 178 | --disable-xvmc \ |
| 179 | --enable-dga \ |
| 180 | --disable-screensaver \ |
| 181 | --disable-xdmcp \ |
| 182 | --disable-xdm-auth-1 \ |
| 183 | --disable-glx \ |
| 184 | --disable-dri \ |
| 185 | --disable-dri2 \ |
| 186 | --disable-xinerama \ |
| 187 | --disable-xf86vidmode \ |
| 188 | --disable-xace \ |
| 189 | --disable-xselinux \ |
| 190 | --disable-xfree86-utils \ |
| 191 | --disable-dmx \ |
| 192 | --disable-xvfb \ |
| 193 | --disable-xnest \ |
| 194 | --disable-kdrive \ |
| 195 | --disable-xephyr \ |
| 196 | --disable-xfbdev \ |
| 197 | --disable-xmir \ |
| 198 | --with-sha1=libnettle \ |
| 199 | $(config_backend_udeb) \ |
| 200 | $(void) |
| 201 | |
| 202 | $(QUILT_STAMPFN): $(STAMP_DIR)/stampdir |
| 203 | |
| 204 | $(STAMP_DIR)/autoreconf: $(STAMP_DIR)/stampdir $(QUILT_STAMPFN) |
| 205 | dh_testdir |
| 206 | autoreconf -vfi |
| 207 | >$@ |
| 208 | |
| 209 | $(STAMP_DIR)/build-source: $(STAMP_DIR)/autoreconf |
| 210 | mkdir -p build-source |
| 211 | tar \ |
| 212 | --owner=0 --group=0 \ |
| 213 | --transform 's,^,xorg-server/,' \ |
| 214 | --exclude=stampdir --exclude=debian \ |
| 215 | --exclude=build-* --exclude=autom4te.cache \ |
| 216 | -cf - * | xz > build-source/xorg-server.tar.xz |
| 217 | >$@ |
| 218 | |
| 219 | $(STAMP_DIR)/configure-%: $(STAMP_DIR)/autoreconf |
| 220 | dh_testdir |
| 221 | mkdir -p build-$* |
| 222 | cd build-$* && \ |
| 223 | ../configure \ |
| 224 | --prefix=/usr \ |
| 225 | --mandir=\$${prefix}/share/man \ |
| 226 | --infodir=\$${prefix}/share/info \ |
| 227 | --sysconfdir=/etc \ |
| 228 | --localstatedir=/var \ |
| 229 | $(confflags) \ |
| 230 | $(confflags_$*) \ |
| 231 | $(vars) |
| 232 | >$@ |
| 233 | |
| 234 | $(STAMP_DIR)/build-%: $(STAMP_DIR)/configure-% |
| 235 | dh_testdir |
| 236 | cd build-$* && $(MAKE) |
| 237 | >$@ |
| 238 | |
| 239 | $(STAMP_DIR)/tests-%: $(STAMP_DIR)/build-% |
| 240 | cd build-$* && $(MAKE) check VERBOSE=1 |
| 241 | >$@ |
| 242 | |
| 243 | build: abibumpcheck |
| 244 | build: $(STAMP_DIR)/build-main |
| 245 | build: $(STAMP_DIR)/tests-main |
| 246 | ifeq ($(udeb), yes) |
| 247 | build: $(STAMP_DIR)/build-udeb |
| 248 | build: $(STAMP_DIR)/tests-udeb |
| 249 | endif |
| 250 | build-arch: build |
| 251 | build-indep: $(STAMP_DIR)/build-source build |
| 252 | |
| 253 | clean: unpatch |
| 254 | dh_testdir |
| 255 | rm -rf $(STAMP_DIR) |
| 256 | rm -f config.cache config.log config.status |
| 257 | rm -f */config.cache */config.log */config.status |
| 258 | rm -f conftest* */conftest* |
| 259 | rm -rf autom4te.cache */autom4te.cache |
| 260 | rm -rf build-* |
| 261 | rm -f compile config.guess config.sub configure depcomp install-sh |
| 262 | rm -f ltmain.sh missing INSTALL aclocal.m4 ylwrap |
| 263 | rm -f include/do-not-use-config.h.in |
| 264 | rm -f m4/lt*.m4 m4/libtool.m4 |
| 265 | find -name Makefile.in -delete |
| 266 | rm -f test-driver |
| 267 | dh_clean |
| 268 | |
| 269 | install: build |
| 270 | dh_testdir |
| 271 | dh_testroot |
| 272 | dh_prep |
| 273 | dh_installdirs |
| 274 | |
| 275 | cd build-main && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp/main install |
| 276 | ifeq ($(udeb), yes) |
| 277 | cd build-udeb && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp/udeb install |
| 278 | endif |
| 279 | |
| 280 | # oh, yuck. |
| 281 | find debian/tmp/*/usr/lib/xorg -type f -name '*.la' | \ |
| 282 | xargs rm -f |
| 283 | |
| 284 | # remove modules not needed in d-i |
| 285 | rm -rf debian/tmp/udeb/usr/lib/xorg/modules/multimedia |
| 286 | rm -f debian/tmp/udeb/usr/lib/xorg/modules/libxaa.so |
| 287 | rm -f debian/tmp/udeb/usr/lib/xorg/modules/libexa.so |
| 288 | rm -f debian/tmp/udeb/usr/lib/xorg/modules/libwfb.so |
| 289 | rm -f debian/tmp/udeb/usr/lib/xorg/modules/libxf8_16bpp.so |
| 290 | |
| 291 | # we don't ship these from the udeb build, reduce noise from dh_install |
| 292 | # --list-missing |
| 293 | rm -rf debian/tmp/udeb/usr/include |
| 294 | rm -rf debian/tmp/udeb/usr/share/aclocal |
| 295 | rm -rf debian/tmp/udeb/usr/share/man |
| 296 | rm -rf debian/tmp/udeb/usr/lib/pkgconfig |
| 297 | |
| 298 | install -m 755 debian/local/xvfb-run debian/tmp/main/usr/bin |
| 299 | # Make sure Xvfb at least starts up |
| 300 | PATH=debian/tmp/main/usr/bin/:/bin:/usr/bin \ |
| 301 | debian/tmp/main/usr/bin/xvfb-run -s "-screen 0 1280x1024x24 -nolisten tcp -noreset" true |
| 302 | |
| 303 | install debian/local/xvfb-run.1 debian/tmp/main/usr/share/man/man1 |
| 304 | ifneq ($(DEB_HOST_ARCH_OS), linux) |
| 305 | install -d debian/tmp/main/usr/share/X11/xorg.conf.d |
| 306 | install -m 644 debian/local/10-*.conf debian/tmp/main/usr/share/X11/xorg.conf.d |
| 307 | ifeq ($(udeb), yes) |
| 308 | install -d debian/tmp/udeb/usr/share/X11/xorg.conf.d |
| 309 | install -m 644 debian/local/10-*.conf debian/tmp/udeb/usr/share/X11/xorg.conf.d |
| 310 | endif |
| 311 | endif |
| 312 | |
| 313 | # stub to start building deb files, used by binary-indep and binary-arch |
| 314 | binary-initial: |
| 315 | dh_testdir |
| 316 | dh_testroot |
| 317 | |
| 318 | # stub to build deb files, used by binary-indep and binary-arch |
| 319 | binary-deb: |
| 320 | dh_lintian |
| 321 | dh_compress |
| 322 | dh_fixperms |
| 323 | dh_installdeb |
| 324 | dh_shlibdeps |
| 325 | dh_gencontrol |
| 326 | dh_md5sums |
| 327 | dh_builddeb |
| 328 | |
| 329 | # Only read the first line, the rest of the file is used to determine |
| 330 | # when the minimal version as to be bumped: |
| 331 | SERVERMINVER = debian/serverminver |
| 332 | serverminver = $(shell head -1 $(SERVERMINVER)) |
| 333 | |
| 334 | .PHONY: abibumpcheck |
| 335 | abibumpcheck: debian/serverminver $(QUILT_STAMPFN) |
| 336 | @echo Checking for the need of an ABI bump |
| 337 | # Build an updated version of the file: |
| 338 | head -1 $(SERVERMINVER) > $(SERVERMINVER).new |
| 339 | 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 |
| 340 | # Compare both files: |
| 341 | @if ! cmp --quiet $(SERVERMINVER) $(SERVERMINVER).new; then \ |
| 342 | echo "serverminver bump required, ABI changed!";\ |
| 343 | echo "When bumping major or minor, always bump required xorg-server minimum";\ |
| 344 | echo "version too, the newly built drivers are not backwards compatible!";\ |
| 345 | diff -u $(SERVERMINVER) $(SERVERMINVER).new; \ |
| 346 | exit 1; \ |
| 347 | else \ |
| 348 | echo "ABI unchanged"; \ |
| 349 | rm -f $(SERVERMINVER).new; \ |
| 350 | fi |
| 351 | |
| 352 | # Build architecture-dependent files here. |
| 353 | binary-arch: build install |
| 354 | $(MAKE) -f debian/rules DH_OPTIONS=-s binary-initial |
| 355 | |
| 356 | dh_installdocs -s |
| 357 | dh_installchangelogs -s |
| 358 | dh_install $(DH_INSTALL_OPTIONS) -s --list-missing |
| 359 | $(INSTALL) -d $(CURDIR)/debian/xserver-xorg-dev/usr/share/xserver-xorg |
| 360 | # Extract only the major ABI version: |
| 361 | abi_videodrv=`PKG_CONFIG_PATH=debian/tmp/main/usr/lib/pkgconfig pkg-config --variable=abi_videodrv xorg-server|cut -d . -f 1`; \ |
| 362 | echo videoabi=xorg-video-abi-$$abi_videodrv > debian/xserver-xorg-core.substvars && \ |
| 363 | echo "xorg-video-abi-$$abi_videodrv, xserver-xorg-core (>= $(serverminver))" > debian/xserver-xorg-dev/usr/share/xserver-xorg/videodrvdep |
| 364 | abi_xinput=`PKG_CONFIG_PATH=debian/tmp/main/usr/lib/pkgconfig pkg-config --variable=abi_xinput xorg-server|cut -d . -f 1`; \ |
| 365 | echo inputabi=xorg-input-abi-$$abi_xinput >> debian/xserver-xorg-core.substvars && \ |
| 366 | echo "xorg-input-abi-$$abi_xinput, xserver-xorg-core (>= $(serverminver))" > debian/xserver-xorg-dev/usr/share/xserver-xorg/xinputdep |
| 367 | |
| 368 | # The udeb uses the same substvars: |
| 369 | cp debian/xserver-xorg-core.substvars debian/xserver-xorg-core-udeb.substvars |
| 370 | |
| 371 | $(INSTALL) -m 755 -d debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core |
| 372 | $(INSTALL) -m 755 debian/xserver-xorg-core.bug.script debian/xserver-xorg-core/usr/share/bug/xserver-xorg-core/script |
| 373 | ifeq ($(DEB_HOST_ARCH_OS), linux) |
| 374 | install -d debian/xserver-xorg-core/lib/udev/rules.d |
| 375 | install -m 644 debian/local/64-xorg-xkb.rules debian/xserver-xorg-core/lib/udev/rules.d |
| 376 | ifeq ($(udeb), yes) |
| 377 | install -d debian/xserver-xorg-core-udeb/lib/udev/rules.d |
| 378 | install -m 644 debian/local/64-xorg-xkb.rules debian/xserver-xorg-core-udeb/lib/udev/rules.d |
| 379 | endif |
| 380 | endif |
| 381 | dh_installdebconf -s |
| 382 | dh_installman -s |
| 383 | dh_link -s |
| 384 | dh_strip -pxserver-xorg-xmir -pxserver-xorg-core --dbg-package=xserver-xorg-core-dbg |
| 385 | dh_strip -s -Nxserver-xorg-core -Nxserver-xorg-core-dbg |
| 386 | $(MAKE) -f debian/rules DH_OPTIONS=-s binary-deb |
| 387 | |
| 388 | |
| 389 | # Build architecture-independent files here |
| 390 | binary-indep: build-indep install check |
| 391 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-initial |
| 392 | dh_install -i |
| 393 | dh_installdocs -i |
| 394 | dh_installchangelogs -i ChangeLog |
| 395 | |
| 396 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-deb |
| 397 | |
| 398 | check: |
| 399 | dh_testdir |
| 400 | |
| 401 | binary: binary-indep binary-arch |
| 402 | .PHONY: build clean binary-indep binary-arch binary install |