Subject: [alpine-aports] [PATCH] testing/weston: upgrade to 2.0.0

From: Valery Kartel <[email-masked]>
Date: Mon, 27 Feb 2017 10:30:50 +0200

--
take maintain
shared libs moved to libweston, libweston-desktop
split to submodules: cms-*, client-*, shell-*, backend-*
add check() function
add helper submodule weston-desktop-x11 to run as x11 client

---
Successfuly runs on vanilla-linux. Fails on grsec.
Terribly slow when runs as remote (ssh -X) x11 client
---
 testing/weston/APKBUILD         | 126 +++++++++++++++++++++++++++++++++-------
 testing/weston/musl-fixes.patch |  10 ----
 2 files changed, 104 insertions(+), 32 deletions(-)
 delete mode 100644 testing/weston/musl-fixes.patch

diff --git a/testing/weston/APKBUILD b/testing/weston/APKBUILD
index 845642d22c..239d91e5a8 100644
--- a/testing/weston/APKBUILD
+++ b/testing/weston/APKBUILD
@@ -1,21 +1,35 @@
 # Contributor: Sören Tempel <[email-masked]>
-# Maintainer:
+# Maintainer: Valery Kartel <[email-masked]>
 pkgname=weston
-pkgver=1.12.0
-pkgrel=1
-pkgdesc="Reference implementation of a Wayland compositor"
+pkgver=2.0.0
+pkgrel=0
+_libname=lib$pkgname
+_libdir=$_libname-${pkgver%%.*}
+pkgdesc="The reference Wayland server"
 url="http://wayland.freedesktop.org"
 arch="x86_64 armhf"
 license="MIT"
 depends=""
-makedepends="wayland-protocols libxkbcommon-dev libinput-dev
-	libunwind-dev poppler-glib mtdev-dev libxcursor-dev
-	glu-dev pango-dev colord-dev"
-subpackages="$pkgname-doc"
-source="http://wayland.freedesktop.org/releases/$pkgname-$pkgver.tar.xz
-	musl-fixes.patch"
-
+makedepends="wayland-protocols-dev libxkbcommon-dev xkeyboard-config
+	libinput-dev libunwind-dev mtdev-dev libxcursor-dev glu-dev
+	pango-dev colord-dev freerdp-dev libwebp-dev libva-dev dbus-dev
+	"
+_cms="cms-colord cms-static"
+_shell="shell-desktop shell-fullscreen shell-ivi"
+_client="info terminal wcap-decode"
+_backend="backend-drm backend-fbdev backend-headless
+	backend-rdp backend-x11 backend-wayland
+	"
+for _sub in $_cms $_shell $_client $_backend; do
+	subpackages="$subpackages $pkgname-$_sub:_sub"
+done
+subpackages="$pkgname-dev $pkgname-doc $subpackages
+	$pkgname-clients $_libname-desktop:_libd $_libname:libs
+	$pkgname-xwayland $pkgname-desktop-x11:_x11:noarch
+	"
+source="http://wayland.freedesktop.org/releases/$pkgname-$pkgver.tar.xz"
 builddir="$srcdir/$pkgname-$pkgver"
+
 build() {
 	cd "$builddir"
 	./configure \
@@ -25,21 +39,89 @@ build() {
 		--sysconfdir=/etc \
 		--mandir=/usr/share/man \
 		--localstatedir=/var \
-		--libexecdir=/usr/lib/weston \
+		--libexecdir=/usr/lib/$pkgname \
+		--enable-rdp-compositor \
+		--enable-screen-sharing \
+		--enable-vaapi-recorder \
+		--enable-clients \
+		--enable-demo-clients-install \
 		--disable-weston-launch \
-		--enable-libinput-backend \
+		--disable-setuid-install \
 		|| return 1
-	make || return 1
+	make
+}
+
+check() {
+	make -C "$builddir" check
+	return 0
 }
 
 package() {
-	make DESTDIR="$pkgdir" \
-		-C "$builddir" install || return 1
+	make  -C "$builddir" DESTDIR="$pkgdir" install
+}
+
+libs() {
+	depends="xkeyboard-config"
+	default_libs
+}
+
+_libd() {
+	pkgdesc="Desktop shells abstraction library for libweston compositors"
+	mkdir -p "$subpkgdir"/usr/lib || return 1
+	mv "$pkgdir"/usr/lib/*desktop* "$subpkgdir"/usr/lib
+}
+
+clients() {
+	pkgdesc="Weston example clients"
+	mkdir -p "$subpkgdir"/usr/bin || return 1
+	mv "$pkgdir"/usr/bin/$pkgname-* "$subpkgdir"/usr/bin
+}
+
+xwayland() {
+	pkgdesc="Wayland module to run X Clients"
+	mkdir -p "$subpkgdir"/usr/lib/$_libdir || return 1
+	mv "$pkgdir"/usr/lib/$_libdir/xwayland.so \
+		"$subpkgdir"/usr/lib/$_libdir
+}
+
+_x11() {
+	pkgdesc="Weston desktop helper pack (x11 backend)"
+	depends="$pkgname $pkgname-shell-desktop $pkgname-xwayland
+		$pkgname-backend-x11 $pkgname-terminal"
+	mkdir -p "$subpkgdir"
+}
+
+_sub() {
+	local name path
+	case $subpkgname in
+	*-cms-*)
+		name=${subpkgname#$pkgname-cms-}
+		path=/usr/lib/$pkgname
+		pkgdesc="Weston CMS module: $name"
+		name=cms-$name.so
+		;;
+	*-shell-*)
+		name=${subpkgname#$pkgname-shell-}
+		path=/usr/lib/$pkgname
+		pkgdesc="Weston shell: $name"
+		name=*$name-shell*
+		;;
+	*-backend-*)
+		name=${subpkgname#$pkgname-backend-}
+		path=/usr/lib/$_libdir
+		pkgdesc="Weston backend: $name"
+		name=$name-backend.so
+		grep -q cairo "$pkgdir"/$path/$name && depends="mesa-dri-swrast"
+		;;
+	*)
+		name=$subpkgname
+		path=/usr/bin
+		[ -x "$pkgdir"/$path/$name ] || name=${subpkgname#$pkgname-}
+		pkgdesc="Weston client: $name"
+		;;
+	esac
+	mkdir -p "$subpkgdir"/$path || return 1
+	mv "$pkgdir"/$path/$name "$subpkgdir"/$path
 }
 
-md5sums="310af6d7f8ba03c3418cec8ad72ea748  weston-1.12.0.tar.xz
-6f68d03829f100d358283a5714573d37  musl-fixes.patch"
-sha256sums="ac7ac2a32e3b9f50131fccded5d2326bd36b2226712d90b61999118a09af5033  weston-1.12.0.tar.xz
-03b6225fa84b52523afe571b0ec820342933e1052d87b8a8f6eb1177847ecfae  musl-fixes.patch"
-sha512sums="80cf7c01951cc72b32284a5a6960c2ae7a8dfffffb155cb0f94cd3585b0afa3f06bb8e2b87467d18ab95f0fd673ad9319a6e14ee5f3cec1d3b72c7c0146c927e  weston-1.12.0.tar.xz
-f9f892cdba13b1ae4d2726cfda5543364da545e725fabbf2145cd977648e84a138bb65197c604aae43a5e8415e3a58a45ec8d7a15e23eb72b7b95edefca531bc  musl-fixes.patch"
+sha512sums="085a0ba278932d41b50edd6e89db5df31cd6a1179c6cfe9a8ac5ac64e63b25cfc3da1ad8c587259273c3812593029b803867195e2d82b12b5cdd2588ac59acc6  weston-2.0.0.tar.xz"
diff --git a/testing/weston/musl-fixes.patch b/testing/weston/musl-fixes.patch
deleted file mode 100644
index 00886d6d02..0000000000
--- a/testing/weston/musl-fixes.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- weston-1.12.0/shared/string-helpers.h.orig
-+++ weston-1.12.0/shared/string-helpers.h
-@@ -28,6 +28,7 @@
- 
- #include <stdbool.h>
- #include <stdlib.h>
-+#include <stdint.h>
- #include <errno.h>
- #include <assert.h>
- 
-- 
2.11.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Mon, 13 Mar 2017 10:02:19 +0100

Hi,
thank you for your contribution.

Are all these subpackages needed? How big in size are they? Perhaps
having subpackage for library and client would be enough and the
APKBUILD could be simplified?

>  testing/weston/APKBUILD         | 126

Here it fails with:

configure: creating ./config.status
config.status: creating doc/doxygen/tools.doxygen
config.status: creating doc/doxygen/tooldev.doxygen
config.status: creating Makefile
config.status: creating libweston/version.h
config.status: creating compositor/weston.pc
config.status: creating libweston/libweston-2.pc
config.status: creating libweston-desktop/libweston-desktop-2.pc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

	Native Backend			drm-backend.so
	setuid Install			no

	Cairo Renderer			image
	EGL				yes
	libxkbcommon			yes
	xcb_xkb				yes
	XWayland			yes
	dbus				yes

	ivi-shell			yes

	Build wcap utility		yes
	Build Fullscreen Shell		yes
	Enable developer documentation	no

	weston-launch utility		no
	systemd-login support		no
	systemd notify support		no

	DRM Compositor			yes
	X11 Compositor			yes
	Wayland Compositor		yes
	Headless Compositor		yes
	FBDEV Compositor		yes
	RDP Compositor			yes
	Screen Sharing			yes
	JUnit XML output		no

	Build Clients			yes
	Build EGL Clients		no
	Build Simple Clients		yes
	Build Simple EGL Clients	yes

	Install Demo Clients		yes

	Colord Support			yes
	LCMS2 Support			yes
	libjpeg Support			yes
	libwebp Support			yes
	libunwind Support		yes
	VA H.264 encoding Support	yes

make: *** No rule to make target 'protocol/xdg-shell-unstable-v6-
protocol.c', needed by 'all'.  Stop.
>>> ERROR: weston: all failed

Thanks!

|_eo

---

From: Valery Kartel <[email-masked]>
Date: Mon, 13 Mar 2017 12:31:57 +0200

Hi,
Long thought how to split it into packages and this is the result of 10+
tries ))
I split it not by size but because of the dependencies and frequency of use

libraries:
 - libweston - core library
 - libweston-desktop - helper library to build desktop-shells (used by
weston-shell-desktop only)

color-management-systems: just split it to static and colord, because
colord depends on colord-service.
cms is not required to run session so I split it out.

shells:
 - desktop - classic windowed desktop implementation
 - fullscreen - runs app fullscreen. sutable for e-kiosks
 - ivi - in-vehicle infotainment - for car pc

backends:
 - drm - to run local on dri drivers (use libinput, udev)
 - fbdev - to run local via fbdev drivers (use libinput, udev)
 - headless - to run local w/o any local input/output
 - rdp - to run remote via rdp (depends on freerdp)
 - x11 - to run via x11 (depends on x11, cairo/mesa. jpeg, png...)
 - wayland - to run via wayland (depends on wayland, cairo/mesa, jpeg,
png...)

client: there are three clients bundled while installed. info, terminal and
wcap-decode.

wcap-decode is not a client just a video/audio decoder of recorded weston
session

clients: a pack of example clients. I think it's better to rename it to
-examples...

xwayland - helper module to run x11 client on wayland. Not required to run
session

weston-desktop-x11: - just an example pack to run it as x11 client.

PS: just rebuild it on fresh-installed x86_64 and build done without any
errors...

---

From: Valery Kartel <[email-masked]>
Date: Mon, 13 Mar 2017 13:12:57 +0200

Found why your build fails. It a makedepends bug.

2017-03-13 12:31 GMT+02:00 Valery Kartel <[email-masked]>:

> client: there are three clients bundled while installed. info, terminal
> and wcap-decode.
>