├── LICENSE ├── README.md ├── install.sh ├── start_wayfire.sh.in ├── update_build.sh └── wayfire.desktop.in /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Wayfire 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # wf-install 2 | This contains an install script called `install.sh`. It is a script to install and configure [Wayfire](https://wayfire.org) and related programs like [wf-shell](https://github.com/WayfireWM/wf-shell). 3 | 4 | ## Dependencies 5 | 6 | The following is a list of dependencies needed on Ubuntu, similar lists are required on other distributions. The last one is only needed if you want to install WCM. 7 | 8 | `sudo apt install git meson python3-pip pkg-config libwayland-dev autoconf libtool libffi-dev libxml2-dev libegl1-mesa-dev libgles2-mesa-dev libgbm-dev libinput-dev libxkbcommon-dev libpixman-1-dev xutils-dev xcb-proto python3-xcbgen libcairo2-dev libglm-dev libjpeg-dev libgtkmm-3.0-dev xwayland libdrm-dev libgirepository1.0-dev libsystemd-dev policykit-1 libx11-xcb-dev libxcb-xinput-dev libxcb-composite0-dev xwayland libasound2-dev libpulse-dev libseat-dev valac libdbusmenu-gtk3-dev libxkbregistry-dev libdisplay-info-dev hwdata` 9 | 10 | ## `install.sh` 11 | 12 | The general usage is: 13 | 14 | ``` 15 | git clone https://github.com/WayfireWM/wf-install 16 | cd wf-install 17 | 18 | ./install.sh --prefix /opt/wayfire --stream 0.8.x 19 | ``` 20 | 21 | The last script will download all necessary components and install them to the given prefix. 22 | If you want to build the latest versions, use `--stream master`. 23 | For Wayfire and wf-shell, default configuration files will also be installed to `$XDG_CONFIG_HOME/wayfire.ini` or `~/.config/wayfire.ini` 24 | 25 | The script also has a few other options, which you can see by calling `./install.sh --help` 26 | 27 | ## `update_build.sh` 28 | 29 | `update_build.sh` is a script similar to `install.sh`, but assumes you have already built and installed Wayfire. 30 | It will simply update the downloaded code, recompile and install it to the same prefix as configured with `install.sh`. 31 | 32 | ``` 33 | ./update_build.sh . 0.8.x 34 | ``` 35 | 36 | The first parameter is the toplevel directory where you started the build (i.e the folder with `wayfire`, `wf-shell` and `wcm` source), and the second one is the version of Wayfire to build. 37 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | print_help() { 4 | echo "Usage:" 5 | echo " -v, --verbose Verbose output." 6 | echo " -c, --clean Force clean build, i.e. delete previously downloaded sources and start from scratch." 7 | echo " -s, --stream= Build a particular branch of Wayfire and other components. Usually master or a release like X.Y.Z" 8 | echo " Default is master" 9 | echo " -p, --prefix= Prefix where to install Wayfire. Default: /opt/wayfire" 10 | echo " --system-wlroots Use the system-wide installation of wlroots instead of the bundled one." 11 | echo " -o, --optimize Enables build optimizations." 12 | echo " -d, --debug Enables debug build." 13 | exit 1 14 | } 15 | 16 | 17 | # Parse arguments 18 | VERBOSE=0 19 | CLEANBUILD=0 20 | PREFIX=/opt/wayfire 21 | STREAM=master 22 | USE_SYSTEM_WLROOTS=disabled 23 | BUILDPARAMS="-Dbuildtype=debugoptimized" 24 | 25 | # Temporarily disable exit on error 26 | set +e 27 | options="$(getopt -o hvcs:p:do --long verbose --long clean --long stream: --long prefix: --long system-wlroots --long debug --long optimize -- "$@")" 28 | ERROR_CODE="$?" 29 | set -e 30 | 31 | if [ "$ERROR_CODE" != 0 ]; then 32 | print_help 33 | exit 1 34 | fi 35 | 36 | eval set -- "$options" 37 | while true; do 38 | case $1 in 39 | -v|--verbose) 40 | VERBOSE=1 41 | ;; 42 | -c|--clean) 43 | CLEANBUILD=1 44 | ;; 45 | -s|--stream) 46 | shift 47 | STREAM="$1" 48 | ;; 49 | -p|--prefix) 50 | shift 51 | PREFIX="$1" 52 | ;; 53 | -d|--debug) 54 | BUILDPARAMS="-Dbuildtype=debug -Db_sanitize=address,undefined" 55 | ;; 56 | -o|--optimize) 57 | BUILDPARAMS="-Dbuildtype=release -Db_lto=true" 58 | ;; 59 | --system-wlroots) 60 | USE_SYSTEM_WLROOTS=enabled 61 | ;; 62 | -h|--help) 63 | print_help 64 | exit;; 65 | --) 66 | shift 67 | break;; 68 | esac 69 | shift 70 | done 71 | 72 | if [ "$VERBOSE" = 1 ]; then 73 | set -x 74 | fi 75 | 76 | echo "Building Wayfire $STREAM" 77 | echo "Installation prefix: $PREFIX" 78 | 79 | BUILDROOT="$(cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" 80 | function ask_confirmation { 81 | while true; do 82 | read -p "$1" yn 83 | case "$yn" in 84 | [Yy]* ) yn=Y; break;; 85 | [Nn]* ) yn=N; break;; 86 | * ) echo "Please answer yes or no.";; 87 | esac 88 | done 89 | } 90 | 91 | # Usually we use sudo, but if prefix is somewhere in ~/, we don't need sudo 92 | SUDO=sudo 93 | if [ -w "$PREFIX" ] || ! which sudo > /dev/null; then 94 | SUDO= 95 | fi 96 | 97 | if [ "${USE_SYSTEM_WLROOTS}" = disabled ] && [ "$PREFIX" = /usr ]; then 98 | ask_confirmation 'The installation of Wayfire may overwrite any system-wide wlroots installation. Continue[y/n]? ' 99 | if [ "${yn}" = N ]; then 100 | exit 101 | fi 102 | fi 103 | 104 | # First step, clone necessary repositories 105 | 106 | # First argument: name of the repository to clone 107 | check_download() { 108 | cd "$BUILDROOT" 109 | if [ ! -d "$1" ] || [ "$CLEANBUILD" = 1 ]; then 110 | rm -rf "$1" 111 | git clone "https://github.com/WayfireWM/$1" 112 | fi 113 | 114 | # Checkout the correct stream 115 | cd "$1" 116 | git checkout "origin/${STREAM}" 117 | } 118 | 119 | check_download wayfire 120 | check_download wf-shell 121 | 122 | cd "$BUILDROOT/wayfire" 123 | 124 | meson build --prefix="${PREFIX}" $BUILDPARAMS -Duse_system_wfconfig=disabled -Duse_system_wlroots="${USE_SYSTEM_WLROOTS}" 125 | ninja -C build 126 | $SUDO ninja -C build install 127 | DEST_LIBDIR="$(meson configure | grep "\" | awk '{print $2}')" 128 | 129 | cd "$BUILDROOT/wf-shell" 130 | PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${PREFIX}/${DEST_LIBDIR}/pkgconfig" meson build --prefix="${PREFIX}" $BUILDPARAMS 131 | ninja -C build 132 | $SUDO ninja -C build install 133 | 134 | if ! pkg-config --exists libsystemd && ! pkg-config --exists libelogind && pkg-config --exists libcap; then 135 | $SUDO setcap cap_sys_admin=eip "$PREFIX/bin/wayfire" 136 | fi 137 | 138 | # Install a minimalistic, but still usable configuration 139 | # First argument is the name of the file 140 | # Second argument is the name of the template 141 | function install_config { 142 | CONFIG_FILE="$BUILDROOT/$1" 143 | cp "$2" "$CONFIG_FILE" 144 | 145 | DEFAULT_CONFIG_PATH="${HOME}/.config/$1" 146 | if [ "${XDG_CONFIG_HOME}" != "" ]; then 147 | DEFAULT_CONFIG_PATH="${XDG_CONFIG_HOME}/$1" 148 | fi 149 | 150 | if [ -f "${DEFAULT_CONFIG_PATH}" ]; then 151 | ask_confirmation "Do you want to override the existing config file ${DEFAULT_CONFIG_PATH} [y/n]? " 152 | else 153 | yn=Y 154 | fi 155 | 156 | if [ "$yn" = Y ]; then 157 | mkdir -p "$(dirname "${DEFAULT_CONFIG_PATH}")" 158 | cp "${CONFIG_FILE}" "${DEFAULT_CONFIG_PATH}" --backup=t 159 | fi 160 | } 161 | 162 | install_config wayfire.ini "$BUILDROOT/wayfire/wayfire.ini" 163 | install_config wf-shell.ini "$BUILDROOT/wf-shell/wf-shell.ini.example" 164 | 165 | # Generate a startup script, setting necessary env vars. 166 | cp "$BUILDROOT/start_wayfire.sh.in" "$BUILDROOT/start_wayfire.sh" 167 | if [ "${PREFIX}" != '/usr' ]; then 168 | sed -i "s@^LD_.*@export LD_LIBRARY_PATH=${PREFIX}/${DEST_LIBDIR}:\$LD_LIBRARY_PATH@g" "$BUILDROOT/start_wayfire.sh" 169 | sed -i "s@^PATH.*@export PATH=${PREFIX}/bin:\$PATH@g" "$BUILDROOT/start_wayfire.sh" 170 | sed -i "s@^XDG_.*@export XDG_DATA_DIRS=${PREFIX}/share:\$XDG_DATA_DIRS@g" "$BUILDROOT/start_wayfire.sh" 171 | fi 172 | $SUDO install -m 755 "$BUILDROOT/start_wayfire.sh" "$PREFIX/bin/startwayfire" 173 | 174 | ask_confirmation "Do you want to install wayfire-plugins-extra? [y/n]? " 175 | if [ "$yn" = Y ]; then 176 | check_download wayfire-plugins-extra 177 | cd "$BUILDROOT/wayfire-plugins-extra" 178 | PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${PREFIX}/${DEST_LIBDIR}/pkgconfig" meson setup build --prefix="${PREFIX}" $BUILDPARAMS 179 | ninja -C build 180 | $SUDO ninja -C build install 181 | fi 182 | 183 | ask_confirmation "Do you want to install WCM, a graphical configuration tool for Wayfire [y/n]? " 184 | if [ "$yn" = Y ]; then 185 | check_download wcm 186 | cd "$BUILDROOT/wcm" 187 | PKG_CONFIG_PATH="$PKG_CONFIG_PATH:${PREFIX}/${DEST_LIBDIR}/pkgconfig" meson setup build --prefix="${PREFIX}" $BUILDPARAMS 188 | ninja -C build 189 | $SUDO ninja -C build install 190 | fi 191 | 192 | SESSIONS_DIR=/usr/share/wayland-sessions/ 193 | SUDO_FOR_SESSIONS=sudo 194 | if [ -w $SESSIONS_DIR ] || ! which sudo > /dev/null; then 195 | SUDO_FOR_SESSIONS= 196 | fi 197 | ask_confirmation "Do you want to install wayfire.desktop to $SESSIONS_DIR/ [y/n]? " 198 | if [ "$yn" = Y ]; then 199 | cp "$BUILDROOT/wayfire.desktop.in" "$BUILDROOT/wayfire.desktop" 200 | sed -i "s@^Exec.*@Exec=$PREFIX/bin/startwayfire@g" "$BUILDROOT/wayfire.desktop" 201 | sed -i "s@^Icon.*@Icon=$PREFIX/share/wayfire/icons/wayfire.png@g" "$BUILDROOT/wayfire.desktop" 202 | $SUDO_FOR_SESSIONS mkdir -p "$SESSIONS_DIR" 203 | $SUDO_FOR_SESSIONS install -m 644 "$BUILDROOT/wayfire.desktop" "$SESSIONS_DIR" 204 | fi 205 | 206 | echo "Installation done. Run $PREFIX/bin/startwayfire to start wayfire." 207 | -------------------------------------------------------------------------------- /start_wayfire.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # if $XDG_DATA_DIRS is not set, set it to the spec recommended value 4 | [ -z "$XDG_DATA_DIRS" ] && export XDG_DATA_DIRS="/usr/local/share:/usr/share" 5 | 6 | # path for wf-config and wlroots 7 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH 8 | # path is needed for wf-shell clients 9 | PATH=$PATH 10 | # path to find .desktop files like wcm 11 | XDG_DATA_DIRS=$XDG_DATA_DIRS 12 | 13 | if [ -d "$XDG_DATA_HOME" ]; then 14 | DEFAULT_LOG_DIR=$XDG_DATA_HOME/wayfire 15 | else 16 | DEFAULT_LOG_DIR=$HOME/.local/share/wayfire 17 | fi 18 | 19 | mkdir -p $DEFAULT_LOG_DIR 20 | if [ $? != 0 ]; then 21 | echo "Could not create log directory $DEFAULT_LOG_DIR" 22 | echo "Using stdout as log" 23 | wayfire "$@" 24 | elif [ ! -z "$WAYLAND_DISPLAY" ] || [ ! -z "$DISPLAY" ]; then 25 | echo "Running nested, using stdout as log" 26 | wayfire "$@" 27 | else 28 | LOG_FILE=$DEFAULT_LOG_DIR/wayfire.log 29 | if [ -f $LOG_FILE ]; then 30 | cp $LOG_FILE $LOG_FILE.old 31 | fi 32 | echo "Using log file: $LOG_FILE" 33 | wayfire "$@" &> $LOG_FILE 34 | fi 35 | -------------------------------------------------------------------------------- /update_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | set -o xtrace 5 | 6 | BUILDROOT=$(realpath $1) 7 | STREAM=$2 8 | if [ "$STREAM" = "" ]; then 9 | STREAM=master 10 | fi 11 | 12 | # First argument is the name of the component 13 | build_component() { 14 | SUDO=sudo 15 | if [ ! -d $BUILDROOT/$1 ]; then 16 | echo "Component $1 not found, skipping ..." 17 | return 18 | else 19 | PREFIX=$(meson configure ./build | grep "Installation prefix" | awk '{print $2}') 20 | if [ -w $PREFIX ]; then 21 | SUDO= 22 | fi 23 | fi 24 | 25 | cd $BUILDROOT/$1 26 | git fetch origin 27 | git checkout origin/${STREAM} 28 | git submodule update --init 29 | ninja -C build 30 | $SUDO ninja -C build install 31 | } 32 | 33 | build_component wayfire 34 | build_component wf-shell 35 | build_component wcm 36 | -------------------------------------------------------------------------------- /wayfire.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=0.4 3 | Name=Wayfire Session 4 | Comment=Use this session to run Wayfire as your desktop environment 5 | Exec=$PREFIX/bin/startwayfire 6 | Icon=$PREFIX/share/wayfire/icons/wayfire.png 7 | Type=Application 8 | --------------------------------------------------------------------------------