tools:在ubuntu 20.04上搭建weston环境

参考:

https://wayland.freedesktop.org/building.html

https://github.com/wayland-project/wayland-build-tools

1.git clone https://github.com/wayland-project/wayland-build-tools

Step 1: Install git, and clone the wayland-build-tools repository

        apt-get install -y git
        git clone git://anongit.freedesktop.org/wayland/wayland-build-tools

Where you place this repository is up to you.

Step 2: Prepare expected directories

        mkdir ~/Wayland # sources and builds will be here
        mkdir -p ~/.config/wayland-build-tools
        cp wl_defines.sh ~/.config/wayland-build-tools/

You can change these directories if you wish, but these are the defaults
and you'll need to edit the scripts to match. See WL_ROOT and WLD in
wl_defines.sh.

Step 3: Install packaged build dependencies

        ./wl_install_deps

Step 4: Clone the necessary repositories

        ./wl_clone

Step 5: Build upstream dependencies, Wayland, and Weston

        ./wl_build

Step 6: Run Weston

        source ~/.config/wayland-build-tools/wl_defines.sh
        weston

如 Readme,主要问题集中于第五步编译:

  1. 某些git库已经不需要【协议库】
  2. 缺少pkgconfig的path
  3. 某些源码需要meson/ninja编译
  4. libxfont需要打patch
    maze@maze-VirtualBox:~/Wayland/libXfont$ git diff ./
    diff --git a/configure.ac b/configure.ac
    index e497325..f71ca0c 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -54,6 +54,9 @@ AC_CHECK_HEADERS([endian.h poll.h sys/poll.h])
     AC_CHECK_FUNCS([poll readlink])
     AC_SEARCH_LIBS([strlcat], [bsd])
     AC_CONFIG_LIBOBJ_DIR([src/util])
    +if test "$ac_cv_search_strlcat" = "-lbsd"; then
    +  AC_DEFINE(HAVE_LIBBSD,1,[Has libbsd])
    +fi
     AC_REPLACE_FUNCS([reallocarray realpath strlcat strlcpy])
     
     # Check for BSDish err.h
    

     

  5. 编译weston需要安装各种库

    sudo apt-get install libpipewire-0.2
    sudo apt-get install libgstreamer1.0
    sudo apt-get install libcolord-dev
    sudo apt-get install liblcms2-dev
    sudo apt-get install libva-dev
    sudo apt-get install libsystemd-dev
    sudo apt-get install libwebp-dev
    sudo apt-get install libjpeg-dev
    
    
    sudo ln -s /usr/lib/x86_64-linux-gnu/libffi.so.7 /usr/lib/x86_64-linux-gnu/libffi.so.6

    NOTE Xwayland的部分可以不编译!

 

 

可以参考我的编译时用到的patch

From e8ee3e90236074b81e72f1100c32b2972f5e9554 Mon Sep 17 00:00:00 2001
From: maze-BUG <[email protected]>
Date: Mon, 6 Jul 2020 17:28:43 +0800
Subject: [PATCH] build on ubuntu 20.04

---
 wl_build      | 98 +++++++++++++++++----------------------------------
 wl_clone      | 15 ++------
 wl_defines.sh |  2 +-
 3 files changed, 36 insertions(+), 79 deletions(-)

diff --git a/wl_build b/wl_build
index 9f167a5..6d2e6fa 100755
--- a/wl_build
+++ b/wl_build
@@ -19,6 +19,18 @@ gen() {
 	./autogen.sh --prefix=$WLD $*
 }
 
+gen_meson() {
+	pkg=$1
+	shift
+	echo
+	echo $pkg
+	cd $WLROOT/$pkg
+	echo "meson builddir/ --prefix=$WLD $*"
+	meson builddir/ --prefix=$WLD $*
+	echo "ninja -C builddir/ install"
+	ninja -C builddir/ install
+}
+
 compile() {
 	make -j32 && make install
 	if [ $? != 0 ]; then
@@ -44,8 +56,8 @@ compile
 gen wayland-protocols
 compile
 
-gen drm --disable-libkms
-compile
+gen_meson drm \
+	-Dlibkms=false
 
 gen proto
 compile
@@ -56,20 +68,17 @@ compile
 gen libxcb
 compile
 
-gen presentproto
-compile
-
-gen dri3proto
+gen xorgproto
 compile
 
 gen libxshmfence
 compile
 
-gen libxkbcommon \
-	--with-xkb-config-root=/usr/share/X11/xkb \
-	--with-x-locale-root=/usr/share/X11/locale \
-	--disable-x11
-compile
+gen_meson libxkbcommon \
+	-Denable-x11=false \
+	-Dxkb-config-root=/usr/share/X11/xkb \
+	-Dx-locale-root=/usr/share/X11/locale
+
 
 llvm_drivers=swrast,nouveau,r300
 vga_pci=$(lspci | grep VGA | head -n1)
@@ -83,16 +92,14 @@ echo
 echo "mesa"
 cd $WLROOT/mesa
 git clean -xfd
-./autogen.sh --prefix=$WLD \
-	--enable-gles2 \
-	--with-egl-platforms=x11,wayland,drm \
-	--enable-gbm \
-	--enable-shared-glapi \
-	--disable-llvm-shared-libs \
-	--disable-dri3 \
-	--with-gallium-drivers=$llvm_drivers
-compile
-
+gen_meson mesa \
+	-Dgles2=true \
+	-Dplatforms=x11,wayland,drm \
+	-Dgbm=true \
+	-Dshared-glapi=true \
+	-Dshared-llvm=false \
+	-Ddri3=enabled \
+	-Dgallium-drivers=$llvm_drivers
 
 gen pixman
 compile
@@ -122,7 +129,7 @@ cd $WLROOT/libinput
 rm -rf $WLROOT/libinput/builddir/
 mkdir $WLROOT/libinput/builddir/
 echo "meson --prefix=$WLD builddir/"
-meson --prefix=$WLD -Ddebug-gui=false builddir/
+meson --prefix=$WLD -Ddebug-gui=false -Ddocumentation=false builddir/
 ninja -C builddir/
 ninja -C builddir/ install
 # sudo udevadm hwdb --update
@@ -134,46 +141,12 @@ if [ ${INCLUDE_XWAYLAND} ]; then
 		compile
 	fi
 
-	gen xproto
-	compile
-
 	rm -rf $WLROOT/libepoxy/m4
-	gen libepoxy
-	compile
-
-	gen glproto
-	compile
-
-	gen xcmiscproto
-	compile
+	gen_meson libepoxy
 
 	gen libxtrans
 	compile
 
-	gen bigreqsproto
-	compile
-
-	gen xextproto
-	compile
-
-	gen fontsproto
-	compile
-
-	gen videoproto
-	compile
-
-	gen recordproto
-	compile
-
-	gen resourceproto
-	compile
-
-	gen xf86driproto
-	compile
-
-	gen randrproto
-	compile
-
 	gen libxkbfile
 	compile
 
@@ -203,14 +176,9 @@ echo
 echo "weston"
 cd $WLROOT/weston
 git clean -xfd
-./autogen.sh --prefix=$WLD \
-	--with-cairo=image \
-	--with-xserver-path=$WLD/bin/Xwayland \
-	--enable-setuid-install=no \
-	--enable-clients \
-	--enable-headless-compositor \
-	--enable-demo-clients-install
-compile
+gen_meson weston \
+        -Dbackend-rdp=false \
+        -Dremoting=false
 #distcheck
 
 # Set up config file if it isn't there already
diff --git a/wl_clone b/wl_clone
index 4673517..7846b72 100755
--- a/wl_clone
+++ b/wl_clone
@@ -44,7 +44,7 @@ clone_or_update git://anongit.freedesktop.org/git/mesa/drm
 clone_or_update git://anongit.freedesktop.org/xcb/proto
 clone_or_update git://anongit.freedesktop.org/xorg/util/macros
 clone_or_update git://anongit.freedesktop.org/xcb/libxcb
-clone_or_update git://anongit.freedesktop.org/xorg/proto/presentproto
+clone_or_update git://anongit.freedesktop.org/git/xorg/proto/xorgproto
 clone_or_update git://anongit.freedesktop.org/xorg/proto/dri3proto
 clone_or_update git://anongit.freedesktop.org/xorg/lib/libxshmfence
 clone_or_update git://github.com/xkbcommon/libxkbcommon
@@ -54,7 +54,7 @@ clone_or_update git://anongit.freedesktop.org/cairo
 clone_or_update git://git.sv.gnu.org/libunwind
 clone_or_update git://anongit.freedesktop.org/libevdev
 clone_or_update git://anongit.freedesktop.org/wayland/wayland-protocols
-clone_or_update git://git.code.sf.net/p/linuxwacom/libwacom
+clone_or_update https://github.com/linuxwacom/libwacom
 clone_or_update git://anongit.freedesktop.org/wayland/libinput
 clone_or_update git://anongit.freedesktop.org/wayland/weston
 
@@ -64,18 +64,7 @@ if [ ${INCLUDE_XWAYLAND} ]; then
 	fi
 
 	clone_or_update git://github.com/anholt/libepoxy
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/glproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/xproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/xcmiscproto
 	clone_or_update git://anongit.freedesktop.org/xorg/lib/libxtrans
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/bigreqsproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/xextproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/fontsproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/videoproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/recordproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/resourceproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/xf86driproto
-	clone_or_update git://anongit.freedesktop.org/xorg/proto/randrproto
 	clone_or_update git://anongit.freedesktop.org/xorg/lib/libxkbfile
 	clone_or_update git://anongit.freedesktop.org/xorg/lib/libXfont
 	clone_or_update git://anongit.freedesktop.org/xorg/xserver
diff --git a/wl_defines.sh b/wl_defines.sh
index eaa1853..af5800d 100644
--- a/wl_defines.sh
+++ b/wl_defines.sh
@@ -12,7 +12,7 @@ XWAYLAND=${WLROOT}/install/bin/Xwayland
 export DISTCHECK_CONFIGURE_FLAGS="--with-xserver-path=$XWAYLAND"
 
 export LD_LIBRARY_PATH=$WLD/lib
-export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
+export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/:$WLD/lib/x86_64-linux-gnu/pkgconfig
 export PATH=$WLD/bin:$PATH
 export ACLOCAL_PATH="$WLD/share/aclocal"
 export ACLOCAL="aclocal -I $ACLOCAL_PATH"
-- 
2.25.1

编译成功后,运行weston,需要把libweston-9.so.0与libweston-desktop-9.so.0放到usr/lib/

sudo ln -s ~/Wayland/install/lib/x86_64-linux-gnu/libweston-9.so.0 /usr/lib/libweston-9.so.0
sudo ln -s ~/Wayland/install/lib/x86_64-linux-gnu/libweston-desktop-9.so.0 /usr/lib/libweston-desktop-9.so.0

随后weston还需要weston.ini放到~/.config/   [目前没有weston.ini也能启动weston,并且默认的backend是x11-backend]

至此,weston能够启动

tools:在ubuntu 20.04上搭建weston环境_第1张图片

 

你可能感兴趣的:(tools,weston/wayland,dispaly,weston,Wayland)