简介
wayland官网:https://wayland.freedesktop.org/
参考教程:https://wayland.freedesktop.org/building.html
简单地说,Wayland是一套display server(Wayland compositor)与client间的通信协议,而Weston是Wayland compositor的参考实现。其官网为http://wayland.freedesktop.org/。它们定位于在Linux上替换X图形系统。X图形系统经历了30年左右的发展,其设计在今天看来已略显陈旧。在X系统中,X Server作为中心服务,连接clien和硬件以及compositor。但时至今日,原本在X Server中做的事很多已被移到kernel或者单独的库中,因此X Server就显得比较累赘了。Wayland在架构上去掉了这个中间层,将compositor作为display server,使client与compositor直接通信,从而在灵活性和性能等方面上能够比前辈更加出色。
下载工具/库
下载一些使用到的工具和库。
sudo apt install python3-pip git ninja-build cmake
pip3 install --user meson
sudo apt install libffi-dev libxml2-dev graphviz doxygen xsltproc xmlto
安装ninja
git clone https://github.com/ninja-build/ninja.git
cd ninja
./configure.py --bootstrap
cp ./ninja /usr/bin/
设置环境变量
如果你不想将weston安装在系统中,需要设置以下环境变量,以便让各种库进行适当的链接。
# install 可以换成自己想要的位置
export WLD=$HOME/install
export LD_LIBRARY_PATH=$WLD/lib
export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
export PATH=$WLD/bin:$PATH
如果你想将weston安装在系统中。
export WLD=/usr
# 之后所有meson构建命令更改为以下命令
meson build/ --prefix=$WLD --libdir=/usr/lib --sysconfdir=/etc
ninja -C build/
sudo ninja -C build/ install
构建wayland
git clone https://gitlab.freedesktop.org/wayland/wayland.git
cd wayland
meson build/ --prefix=$WLD
ninja -C build/ install
构建wayland-protocols
git clone https://gitlab.freedesktop.org/wayland/wayland-protocols.git
cd wayland-protocols
meson build/ --prefix=$WLD
ninja -C build/ install
构建weston
git clone https://gitlab.freedesktop.org/wayland/weston.git
cd weston
meson build/ --prefix=$WLD
ninja -C build/ install
运行weston
weston
weston的一些测试程序
在weston中的终端输入
- ‘weston-terminal’ 是一个简单的终端仿真器,不是很兼容,但对bash来说已经足够好了
- ‘weston-flower’ 在屏幕上画一朵花,测试框架协议
- ‘weston-gears’ glxgears, but for wayland
- ‘weston-smoke’ 测试SHM缓冲区共享
- ‘weston-image’ 加载通过命令行传递的图像文件并显示它们
- ‘weston-view’ does the same for pdf files
- ‘weston-resizor’ 演示平滑的窗口大小调整(使用上下键)
- ‘weston-eventdemo’ reports libtoytoolkit’s events to console (see weston-eventdemo --help)