Commit c6d12349 authored by satmandu's avatar satmandu Committed by GitHub

Sommelier & Xwayland (#4450)

* Update to sommelier from platform2 with graphics hardware acceleration support

* Cleanups of ARCH variables & formatting

* Add more documentation

* cleanup default drivers and paths

* Shared Memory Drivers w/o crostini need to be noop

* Cleanup formatting and fix library paths for non-x86_64 archs

* Refactored with hashcheck, & new const

* s/armv11/armv7l/

* depends cleanup

* Update to current c++ version of sommelier

Also add startsommelier & restartsommelier scripts as per 
https://github.com/skycocker/chromebrew/pull/4517

* Add xdpyinfo as dep as part of .bashrc script

* Use more flags used in crostini

* Display should be a variable

* refactor sommelier variables to not source scripts

As pe https://chromium.googlesource.com/chromiumos/docs/+/master/security/noexec_shell_scripts.md

* needs xauth; log to /tmp/sommelier.log

--sd-notify=READY=1 does not work.

* adjust sommelier run time flags & env file documentation

* Refactored scripts

Also now have both sommelier instances running correctly,
for both wayland & xwayland.

* eliminate need to use sed on source files

Just put virtwl.h in build/linux!

* wayland sommelier instance needs display setting

* Have all X instances run through sommelier proxied wayland

* cleanups of env var code

* Use "-L" with curl

* eliminate variable in .sommelier.env

* conditional dependency to allow for xwayland package

* Changed logfile location

* edit postinstall text

* Add xwayland tweaked for sommelier

* Add xwayland dependency.

(This can be removed if a later version of xorg_server incorporates the xwayland changes.)

* remove xauth flag, more extensive xserver cleanup

* use XDG_RUNTIME_DIR in cleanup

* Fix variable name

* fix array variable assignment in .sommelier.env

* Adjust sommelier_accelerators variable

* escape line continue \

* Don't export temporary variables

* Refactor scripts to indepedently start/stop sommelier instances

* Make suggested changes, fix gcc >9.x error.

* clean up patch infrastructure

* change download semantics as requested

* Fix missing "d"

* make checksommelierwayland fn more robust
parent 513eb9a7
This diff is collapsed.
require 'package'
class Xwayland < Package
description 'X server configured to work with weston or sommelier'
homepage 'https://x.org'
version '1.20.9-1'
# Using xorg ToT due to large number of recent xwayland commits.
source_url 'https://github.com/freedesktop/xorg-xserver/archive/d18dcecbe08a9ff22e43f12b6b7679a6ef1a6eb0.zip'
source_sha256 '091edf47059adfa09242906db97e1d9d44dc6557efde4af861a7055975fa55ce'
depends_on 'libepoxy'
depends_on 'xorg_proto'
depends_on 'libxtrans'
depends_on 'libxkbfile'
depends_on 'wayland'
depends_on 'eudev'
depends_on 'libxfont'
depends_on 'libbsd'
depends_on 'nettle'
depends_on 'libtirpc'
depends_on 'pixman'
depends_on 'xinit'
depends_on 'libxkbcommon'
depends_on 'libunwind'
depends_on 'font_util'
depends_on 'xorg_lib'
depends_on 'libtirpc'
depends_on 'font_util'
depends_on 'libbsd'
depends_on 'dbus'
depends_on 'lzma' => :build
depends_on 'xkbcomp'
depends_on 'glproto'
depends_on 'mesa'
# Patches are from Google xwayland overlay at https://source.chromium.org/chromiumos/chromiumos/codesearch/+/master:src/third_party/chromiumos-overlay/x11-base/xwayland/files/
def self.patch
url_patch1 = "https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/067ac4b5060c16e6687a97cbb4bcdbaf5a0b5639/x11-base/xwayland/files/0001-Eliminate-conflict-with-X11-Xlib.h-with-khronos-eglp.patch?format=TEXT"
uri_patch1 = URI.parse url_patch1
filename_patch1 = 'patch1_base64'
sha256sum_patch1 = '16f5d5d1986daf07b4e0f01eb0e68b53d8ef301d169f3cc9493158c8b4987f16'
puts "Downloading patch1".yellow
system('curl', '-s', '-C', '-', '--insecure', '-L', '-#', url_patch1, '-o', filename_patch1)
abort 'Checksum mismatch. :/ Try again.'.lightred unless
Digest::SHA256.hexdigest( File.read( filename_patch1 ) ) == sha256sum_patch1
puts "patch1 archive downloaded".lightgreen
system 'base64 --decode patch1_base64 > patch1'
system 'patch -p 1 < patch1'
url_patch2 = "https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/067ac4b5060c16e6687a97cbb4bcdbaf5a0b5639/x11-base/xwayland/files/0001-xwayland-Fall-back-to-gbm_bo_create-if-no-modifiers-.patch?format=TEXT"
uri_patch2 = URI.parse url_patch2
filename_patch2 = 'patch2_base64'
sha256sum_patch2 = 'd44bfca0e26ca06892b37b12faca2a6756cdc2455aac36ac7607bfa188856b35'
puts "Downloading patch2".yellow
system('curl', '-s', '-C', '-', '--insecure', '-L', '-#', url_patch2, '-o', filename_patch2)
abort 'Checksum mismatch. :/ Try again.'.lightred unless
Digest::SHA256.hexdigest( File.read( filename_patch2 ) ) == sha256sum_patch2
puts "patch2 archive downloaded".lightgreen
system 'base64 --decode patch2_base64 > patch2'
system 'patch -p 1 < patch2'
url_patch3 = "https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/067ac4b5060c16e6687a97cbb4bcdbaf5a0b5639/x11-base/xwayland/files/0001-xwayland-sysmacros.patch?format=TEXT"
uri_patch3 = URI.parse url_patch3
filename_patch3 = 'patch3_base64'
sha256sum_patch3 = 'b66eb66cc8023ab2170db91e4d6038dca99b814addfcb0977d30479a2e514ab8'
puts "Downloading patch3".yellow
system('curl', '-s', '-C', '-', '--insecure', '-L', '-#', url_patch3, '-o', filename_patch3)
abort 'Checksum mismatch. :/ Try again.'.lightred unless
Digest::SHA256.hexdigest( File.read( filename_patch3 ) ) == sha256sum_patch3
puts "patch3 archive downloaded".lightgreen
system 'base64 --decode patch3_base64 > patch3'
system 'patch -F 10 --force -p 1 < patch3'
end
case ARCH
when 'armv7l', 'aarch64'
PEER_CMD_PREFIX='/lib/ld-linux-armhf.so.3'
when 'i686'
PEER_CMD_PREFIX='/lib/ld-linux-i686.so.2'
when 'x86_64'
PEER_CMD_PREFIX='/lib64/ld-linux-x86-64.so.2'
end
def self.build
ENV['CFLAGS'] = "-fuse-ld=lld"
ENV['CXXFLAGS'] = "-fuse-ld=lld"
system "meson setup build"
system "meson configure #{CREW_MESON_OPTIONS} \
-Dipv6=true \
-Dxvfb=true \
-Dxnest=true \
-Dxcsecurity=true \
-Dxorg=true \
-Dxephyr=false \
-Dxwayland=true \
-Dglamor=true \
-Dudev=true \
-Ddocs=false \
-Dxwin=false \
-Dsystemd_logind=false \
-Dlibunwind=true \
-Dint10=false \
-Dlog_dir=#{CREW_PREFIX}/var/log \
build"
system "meson configure build"
system "ninja -C build"
system "cat <<'EOF'> Xwayland_sh
#!/bin/bash
if base=$(readlink \"$0\" 2>/dev/null); then
case $base in
/*) base=$(readlink -f \"$0\" 2>/dev/null);; # if $0 is abspath symlink, make symlink fully resolved.
*) base=$(dirname \"$0\")/\"${base}\";;
esac
else
case $0 in
/*) base=$0;;
*) base=${PWD:-`pwd`}/$0;;
esac
fi
basedir=${base%/*}
# TODO(crbug/1003841): Remove LD_ARGV0 once
# ld.so supports forwarding the binary name.
LD_ARGV0=\"$0\" LD_ARGV0_REL=\"../bin/Xwayland.sh\" exec \"${basedir}/..#{PEER_CMD_PREFIX}\" --library-path \"${basedir}/../#{ARCH_LIB}\" --inhibit-rpath '' \"${base}.elf\" \"$@\"
EOF"
end
def self.install
system "DESTDIR=#{CREW_DEST_DIR} ninja -C build install"
FileUtils.mv "#{CREW_DEST_PREFIX}/bin/Xwayland", "#{CREW_DEST_PREFIX}/bin/Xwayland.elf"
system "install -Dm755 Xwayland_sh #{CREW_DEST_PREFIX}/bin/Xwayland"
FileUtils.ln_sf "#{CREW_DEST_PREFIX}/bin/Xwayland", "#{CREW_DEST_PREFIX}/bin/X"
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment