diff options
author | Logan Rathbone <poprocks@gmail.com> | 2019-11-03 01:27:55 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-11-03 01:27:55 +0700 |
commit | b32c9f8ba901f68df11d723c11ac99b3e717f5ce (patch) | |
tree | 57437a166db33ec01783bfc675f17a4b7e68918d | |
parent | 833a418a9448f32874014c89bf70b7f065bdb220 (diff) |
desktop/weston: Added (Reference implementation of a Wayland).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | desktop/weston/README | 102 | ||||
-rw-r--r-- | desktop/weston/slack-desc | 19 | ||||
-rw-r--r-- | desktop/weston/weston-7.0.0-nopam.patch | 160 | ||||
-rw-r--r-- | desktop/weston/weston.SlackBuild | 199 | ||||
-rw-r--r-- | desktop/weston/weston.info | 10 |
5 files changed, 490 insertions, 0 deletions
diff --git a/desktop/weston/README b/desktop/weston/README new file mode 100644 index 000000000000..5c0ccf7dcce4 --- /dev/null +++ b/desktop/weston/README @@ -0,0 +1,102 @@ +Weston: reference implementation of a Wayland compositor. +========================================================== + +This README is current as of Weston 7.0.0. + +Introduction +------------ + +Weston is the reference implementation of a Wayland compositor, as well +as a useful environment in and of itself. + +Out of the box, Weston provides a very basic desktop, or a full-featured +environment for non-desktop uses such as automotive, embedded, +in-flight, industrial, kiosks, set-top boxes and TVs. It also provides a +library allowing other projects to build their own full-featured +environments on top of Weston's core. + +A small suite of example or demo clients are also provided: though they +can be useful in themselves, their main purpose is to be an example or +test case for others building compositors or clients. + + +Slackware-specific Information +------------------------------ + +***************************************** +IMPORTANT: MANUAL INTERVENTION REQUIRED. +***************************************** + +This SlackBuild of Weston takes a fairly "hands off" approach, and there +are a few things users need to be aware of. + +Firstly, it is, by default, patched to remove the PAM dependency. This +necessitates the elimination of the "-u" option of `weston-launch`, as +PAM is required for that feature to function. + +To launch Weston, here are some required steps. + +1. You must add a group to your system called "weston-launch". You may +do so, for instance, by running the following as root: + + # groupadd weston-launch + +2. Add users to the "weston-launch" group that you would like to be able +to run weston-launch: + + # usermod -a -G weston-launch $USER + +3. The `weston-launch` must be setuid root. This comes with the standard +warnings associated with doing so. + + # chmod +s /usr/bin/weston-launch + +4. If you do not have another script exporting XDG_RUNTIME_DIR, you +should enable the one that comes with this SlackBuild: + + # chmod +x /etc/profile.d/weston.sh + (or .csh, depending on your shell) + +Once you've logged out and back in as a normal user that has been added to the +"weston-launch" group from a virtual console, you should be able to run +`weston-launch` from that virtual console, and Weston will then launch and run +directly in that console. + +You can use the Ctrl+Alt+Backspace keyboard combination to kill Weston. + + +PAM +--- + +Ordinarily, PAM is a mandatory dependency for Weston. This SlackBuild of +Weston is, by default, patched to remove that dependency. If you happen to +have PAM installed on your system and would like to build Weston with PAM +support, make sure the USE_PAM variable is set to "true" (nb: nothing else, +such as "1", "yes", "on", etc. will work) before running the SlackBuild. +For example: + + # USE_PAM=true ./weston.SlackBuild + + +Optional Dependencies +--------------------- + +Above and beyond the hard dependencies listed in the .info file, Weston +contains many optional dependencies. Kindly consult the documentation +for a complete list. + +At the present time, the only optional dependency that this SlackBuild +accounts for is colord, which is disabled by default. That is because +colord pulls in many large dependencies, most of which are present on +-current (at the time of writing) but not on 14.2, so disabling it seems +like a sensible default on a balance of convenience. + +If you would like to enable colord functionality in this SlackBuild, +set the USE_COLORD variable to "true" before running the SlackBuild. + + +Known Issues +------------ + +I have not had success getting Weston to launch with the proprietary nvidia +drivers in use. YMMV. I have had the best luck with the Intel KMS drivers. diff --git a/desktop/weston/slack-desc b/desktop/weston/slack-desc new file mode 100644 index 000000000000..e82ad04753af --- /dev/null +++ b/desktop/weston/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +weston: weston (Reference implementation of a Wayland compositor) +weston: +weston: Weston is the reference implementation of a Wayland compositor, as +weston: well as a useful environment in and of itself. +weston: +weston: Out of the box, Weston provides a very basic desktop or a +weston: full-featured environment for non-desktop users. +weston: +weston: IMPORTANT: Please read README.Slackware before attempting to run. +weston: +weston: Homepage: http://wayland.freedesktop.org/ diff --git a/desktop/weston/weston-7.0.0-nopam.patch b/desktop/weston/weston-7.0.0-nopam.patch new file mode 100644 index 000000000000..8ad7b3639c9d --- /dev/null +++ b/desktop/weston/weston-7.0.0-nopam.patch @@ -0,0 +1,160 @@ +diff -Naur weston-7.0.0.orig/libweston/meson.build weston-7.0.0/libweston/meson.build +--- weston-7.0.0.orig/libweston/meson.build 2019-08-23 16:59:16.000000000 -0400 ++++ weston-7.0.0/libweston/meson.build 2019-10-17 22:22:55.415927653 -0400 +@@ -199,16 +199,11 @@ + ) + + if get_option('weston-launch') +- dep_pam = cc.find_library('pam') +- +- if not cc.has_function('pam_open_session', dependencies: dep_pam) +- error('pam_open_session not found for weston-launch') +- endif + + executable( + 'weston-launch', + 'weston-launch.c', +- dependencies: [dep_pam, systemd_dep, dep_libdrm], ++ dependencies: [systemd_dep, dep_libdrm], + include_directories: include_directories('..'), + install: true + ) +diff -Naur weston-7.0.0.orig/libweston/weston-launch.c weston-7.0.0/libweston/weston-launch.c +--- weston-7.0.0.orig/libweston/weston-launch.c 2019-08-23 16:59:16.000000000 -0400 ++++ weston-7.0.0/libweston/weston-launch.c 2019-10-17 22:52:18.991891665 -0400 +@@ -51,7 +51,6 @@ + + #include <pwd.h> + #include <grp.h> +-#include <security/pam_appl.h> + + #ifdef HAVE_SYSTEMD_LOGIN + #include <systemd/sd-login.h> +@@ -100,8 +99,6 @@ + #endif + + struct weston_launch { +- struct pam_conv pc; +- pam_handle_t *ph; + int tty; + int ttynr; + int sock[2]; +@@ -193,47 +190,6 @@ + } + + static int +-pam_conversation_fn(int msg_count, +- const struct pam_message **messages, +- struct pam_response **responses, +- void *user_data) +-{ +- return PAM_SUCCESS; +-} +- +-static int +-setup_pam(struct weston_launch *wl) +-{ +- int err; +- +- wl->pc.conv = pam_conversation_fn; +- wl->pc.appdata_ptr = wl; +- +- err = pam_start("login", wl->pw->pw_name, &wl->pc, &wl->ph); +- if (err != PAM_SUCCESS) { +- fprintf(stderr, "failed to start pam transaction: %d: %s\n", +- err, pam_strerror(wl->ph, err)); +- return -1; +- } +- +- err = pam_set_item(wl->ph, PAM_TTY, ttyname(wl->tty)); +- if (err != PAM_SUCCESS) { +- fprintf(stderr, "failed to set PAM_TTY item: %d: %s\n", +- err, pam_strerror(wl->ph, err)); +- return -1; +- } +- +- err = pam_open_session(wl->ph, 0); +- if (err != PAM_SUCCESS) { +- fprintf(stderr, "failed to open pam session: %d: %s\n", +- err, pam_strerror(wl->ph, err)); +- return -1; +- } +- +- return 0; +-} +- +-static int + setup_launcher_socket(struct weston_launch *wl) + { + if (socketpair(AF_LOCAL, SOCK_SEQPACKET, 0, wl->sock) < 0) { +@@ -431,14 +387,6 @@ + close(wl->signalfd); + close(wl->sock[0]); + +- if (wl->new_user) { +- err = pam_close_session(wl->ph, 0); +- if (err) +- fprintf(stderr, "pam_close_session failed: %d: %s\n", +- err, pam_strerror(wl->ph, err)); +- pam_end(wl->ph, err); +- } +- + if (ioctl(wl->tty, KDSKBMUTE, 0) && + ioctl(wl->tty, KDSKBMODE, wl->kb_mode)) + fprintf(stderr, "failed to restore keyboard mode: %s\n", +@@ -660,15 +608,6 @@ + setenv("HOME", wl->pw->pw_dir, 1); + setenv("SHELL", wl->pw->pw_shell, 1); + +- env = pam_getenvlist(wl->ph); +- if (env) { +- for (i = 0; env[i]; ++i) { +- if (putenv(env[i]) != 0) +- fprintf(stderr, "putenv %s failed\n", env[i]); +- } +- free(env); +- } +- + /* + * We open a new session, so it makes sense + * to run a new login shell +@@ -739,8 +678,6 @@ + help(const char *name) + { + fprintf(stderr, "Usage: %s [args...] [-- [weston args..]]\n", name); +- fprintf(stderr, " -u, --user Start session as specified username,\n" +- " e.g. -u joe, requires root.\n"); + fprintf(stderr, " -t, --tty Start session on alternative tty,\n" + " e.g. -t /dev/tty4, requires -u option.\n"); + fprintf(stderr, " -v, --verbose Be verbose\n"); +@@ -754,7 +691,6 @@ + int i, c; + char *tty = NULL; + struct option opts[] = { +- { "user", required_argument, NULL, 'u' }, + { "tty", required_argument, NULL, 't' }, + { "verbose", no_argument, NULL, 'v' }, + { "help", no_argument, NULL, 'h' }, +@@ -766,11 +702,7 @@ + while ((c = getopt_long(argc, argv, "u:t:vh", opts, &i)) != -1) { + switch (c) { + case 'u': +- wl.new_user = optarg; +- if (getuid() != 0) { +- fprintf(stderr, "weston: Permission denied. -u allowed for root only\n"); +- exit(EXIT_FAILURE); +- } ++ fprintf(stderr, "weston: -u is unsupported in this weston-launch build\n"); + break; + case 't': + tty = optarg; +@@ -822,9 +754,6 @@ + if (setup_tty(&wl, tty) < 0) + exit(EXIT_FAILURE); + +- if (wl.new_user && setup_pam(&wl) < 0) +- exit(EXIT_FAILURE); +- + if (setup_launcher_socket(&wl) < 0) + exit(EXIT_FAILURE); + diff --git a/desktop/weston/weston.SlackBuild b/desktop/weston/weston.SlackBuild new file mode 100644 index 000000000000..676942b4c465 --- /dev/null +++ b/desktop/weston/weston.SlackBuild @@ -0,0 +1,199 @@ +#!/bin/sh + +# Slackware build script for Weston + +# Copyright 2019 Logan Rathbone <poprocks@gmail.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=weston +VERSION=${VERSION:-7.0.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.xz +cd $PRGNAM-$VERSION + +# If you have PAM installed on your system and would like to make use +# of it, run this as USE_PAM=true ./weston.Slackbuild +# otherwise, a patch will be applied to remove the PAM dependency. + +USE_PAM=${USE_PAM:-false} + +if [ "$USE_PAM" != 'true' ]; then + patch -p1 < $CWD/weston-7.0.0-nopam.patch +fi + +# Make sure ownerships and permissions are sane: +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# "./configure" +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +meson build/ \ + --prefix=/usr \ + --mandir=man \ + --libdir=lib${LIBDIRSUFFIX} \ + -Dlauncher-logind=false \ + -Dbackend-rdp=false \ + -Dsystemd=false \ + -Dpipewire=false \ + -Dsimple-dmabuf-drm=auto \ + -Dcolor-management-colord=${USE_COLORD:-false} + +# "make" +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +ninja -C build + +# "make install" +DESTDIR=$PKG ninja -C build/ install + +# strip +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +# Install /etc/profile.d scripts. +mkdir -p $PKG/etc/profile.d/ + +cat << 'EOF' > $PKG/etc/profile.d/${PRGNAM}.sh.new +#!/bin/sh +if test -z "${XDG_RUNTIME_DIR}"; then + export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir + if ! test -d "${XDG_RUNTIME_DIR}"; then + mkdir "${XDG_RUNTIME_DIR}" + chmod 0700 "${XDG_RUNTIME_DIR}" + fi +fi +EOF + +cat << 'EOF' > $PKG/etc/profile.d/${PRGNAM}.csh.new +#!/bin/csh +if ( ! $?XDG_RUNTIME_DIR ) then + setenv XDG_RUNTIME_DIR /tmp/${uid}-runtime-dir + if ( ! -d $XDG_RUNTIME_DIR ) then + mkdir "${XDG_RUNTIME_DIR}" + chmod 0700 "${XDG_RUNTIME_DIR}" + endif +endif +EOF + +chmod 644 $PKG/etc/profile.d/${PRGNAM}*.new + +# setup doinst script... + +mkdir -p $PKG/install + +cat << 'EOF' > $PKG/install/doinst.sh +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + + config $NEW +} + +EOF + +# config-ify the profile.d stuff + +# FIXME - I tried many things to try to creatively preserve the perms +# of weston-launch as well (ie, in case someone suid's it and wants to +# keep it that way upon upgrade), but this is really difficult if not +# impossible to implement with Slackware's packaging system without +# allowing for stray binaries (which would have been setuid by the +# user) lingering around, which I'd really rather avoid, for safety. +# +# At this juncture, users will simply have to manually setuid-root the +# binary upon each upgrade. + +cat << EOF >> $PKG/install/doinst.sh +preserve_perms etc/profile.d/${PRGNAM}.sh.new +preserve_perms etc/profile.d/${PRGNAM}.csh.new + +EOF + +# Install some documentation and finish up. +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COPYING README.md CONTRIBUTING.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.Slackware + +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/desktop/weston/weston.info b/desktop/weston/weston.info new file mode 100644 index 000000000000..1acf0ecd49d9 --- /dev/null +++ b/desktop/weston/weston.info @@ -0,0 +1,10 @@ +PRGNAM="weston" +VERSION="7.0.0" +HOMEPAGE="https://wayland.freedesktop.org/" +DOWNLOAD="https://wayland.freedesktop.org/releases/weston-7.0.0.tar.xz" +MD5SUM="cbfda483bc2501d0831af3f33c707850" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="meson libinput libwebp libxkbcommon wayland-egl wayland-protocols" +MAINTAINER="Logan Rathbone" +EMAIL="poprocks@gmail.com" |