天天看點

tools:在ubuntu 20.04上搭建weston環境

參考:

https://wayland.pages.freedesktop.org/weston/index.html

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 [已經更新,不再需要]
    [email protected]:~/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環境

 基于最新weston 9.09的最新修改如下:

./weston-launch -u root -t /dev/tty8


[email protected]:~/Wayland/weston$ git diff ./
diff --git a/compositor/main.c b/compositor/main.c
index 7b8c196f..613740c7 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -593,6 +593,7 @@ static const char xdg_detail_message[] =
 static void
 verify_xdg_runtime_dir(void)
 {
+       setenv("XDG_RUNTIME_DIR", "/run/user/1000", 0);
        char *dir = getenv("XDG_RUNTIME_DIR");
        struct stat s;
 
           

繼續閱讀