Xpra: Ticket #649: new Xorg-related build option(s)

As of 0.14.* building Xpra in clean chroot environment became much harder due to build-time Xorg detection: build script (setup.py) tries to determine Xorg path and version and suid status in order to generate "xpra.conf". Unfortunately this requires "xserver-xorg-core" package to be present on build-time. On Debian I do not want to introduce this dependency which seems to be more like run-time than build time dep. As workaround I had to use patch brutally hardcoding Xorg information to "setup.py" but IMHO it would be much more elegant to pass build options instead. Please note that passing only "--with-Xdummy" is insufficient as there is no way to override Xorg detection using build options. Please consider adding setup.py build options to allow building without Xorg. Thanks.



Thu, 21 Aug 2014 03:13:30 GMT - Antoine Martin: owner changed

Correct. It's there because I don't really have the time to go through every distro and figure out what options the packages should be built with for every one of them.. (not helped by the fact that the Debian "rules" file is shared between all of them - and that how to override any setup.py arguments is not immediately obvious to me)

r7377 should do what you want though, can you confirm? And help with the rules file?


Fri, 22 Aug 2014 00:06:44 GMT - onlyjob:

Replying to totaam:

r7377 should do what you want though, can you confirm?

It does indeed. Thank you.

And help with the rules file?

No problem. "rules" is Makefile so it's not too hard to customise. Usually it is enough to add override_dh_auto_configure section as follows:

override_dh_auto_configure:
	dh_auto_configure -- --with-option1 --with-option2

dh_auto_configure passes build options to detected build system. Xpra is not using configure flow so I pass build options to "build" and "install" target as follows:

BUILDOPTS= --with-verbose --with-Xdummy --without-Xdummy_wrapper
override_dh_auto_build:
	dh_auto_build -- $(BUILDOPTS)
override_dh_auto_install:
	dh_auto_install --destdir=$(CURDIR)/debian/xpra -- $(BUILDOPTS)

dh_auto_build will run setup.py as follows:

setup.py build --force --with-verbose --with-Xdummy --without-Xdummy_wrapper

You can add BUILDOPTS depending on conditions like this:

ifeq ($(DEB_BUILD_ARCH_OS),hurd)
BUILDOPTS+= --disable-alsa
endif

See dpkg-architecture(1) for list of variables.

The following sample set variable DH_AS_NEEDED to "--as-needed" if dh-autoreconf version 6 or higher is installed:

# use --as-needed only if supported by dh-autoreconf (to simplify backporting)
DH_AS_NEEDED=$(shell dpkg --compare-versions $$(dpkg --status dh-autoreconf | grep Version | cut -d' ' -f2) ge 6 && echo --as-needed)
override_dh_autoreconf:
	dh_autoreconf $(DH_AS_NEEDED)

Let me know if you need more ideas. Also debian-mentors mail list is full of helpful hints and people ready to share their experience.


Fri, 22 Aug 2014 01:56:28 GMT - Antoine Martin:

Backport to v0.14.x in r7392.

One last question: any idea how I could do this:

if release is squeeze or distro is ubuntu:
BUILDOPTS+= --without-Xdummy
endif

One more: should I be using --destdir=$(CURDIR)/debian/xpra or --destdir=$(CURDIR)/debian/tmp? (and where would I find out all these things by myself: the override stuff was easy to understand, but googling for hours gave me zero hits)


Fri, 22 Aug 2014 05:08:48 GMT - onlyjob:

I would add lsb-release to Build-Depends and then do the following (untested):

ifeq ($(shell lsb_release --short --codename),squeeze)
BUILDOPTS+= --without-Xdummy
endif
ifeq ($(shell lsb_release --short --id),Ubuntu)
BUILDOPTS+= --without-Xdummy
endif
## show build options:
$(info I: BUILDOPTS==$(BUILDOPTS))

Information about overrides should be somewhere in general packaging docs:

--destdir=$(CURDIR)/debian/xpra instruct installer to put everything directly to directory where package "xpra" is staged. This may be convenient when only one binary package (i.e. .DEB) is built.

--destdir=$(CURDIR)/debian/tmp is to instruct installer to put everything to temporary directory. There shall be "debian/package.install" files to pick-up stuff from "debian/tmp" to destination packages. This is convenient when one source package produces more than one binary package.

dh_auto_install(1) says:

Unless --destdir option is specified, the files are installed into debian/package/ if there is only one binary package. In the multiple binary package case, the files are instead installed into debian/tmp/, and should be moved from there to the appropriate package build directory using dh_install(1).


I sometimes pass optional "--destdir" explicitly to avoid relying on defaults.


Fri, 22 Aug 2014 05:12:14 GMT - onlyjob:

Some override examples in dh(1).


Fri, 22 Aug 2014 10:52:37 GMT - onlyjob:

I just found that backport in 0.14.2 is incomplete -- it is missing the following hunk:

--- a/setup.py
+++ b/setup.py
@@ -190,9 +190,10 @@
             "clipboard",
             "server", "client", "x11", "gtk_x11",
             "gtk2", "gtk3", "qt4", "html5",
             "sound", "cyxor", "cymaths", "opengl", "argb",
-            "warn", "strict", "shadow", "debug", "PIC", "Xdummy", "verbose", "bundle_tests")
+            "warn", "strict", "shadow", "debug", "PIC",
+            "Xdummy", "Xdummy_wrapper", "verbose", "bundle_tests")
 HELP = "-h" in sys.argv or "--help" in sys.argv
 if HELP:
     setup()
     print("Xpra specific build and install switches:")

Fri, 22 Aug 2014 10:54:39 GMT - Antoine Martin:

Did I somehow miss the rejects? Damn. Done in r7411, sorry.


Sun, 24 Aug 2014 05:08:45 GMT - Antoine Martin: status changed; resolution set

Closing - feel free to re-open if I've missed anything.


Sat, 23 Jan 2021 05:01:55 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/649