Created
January 20, 2021 22:50
-
-
Save unresolvedsymbol/9e9fe6d1ffc49ef3fb33083b80565adc to your computer and use it in GitHub Desktop.
Sway builder, idk if it's kinda broken werksonmymachine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Void's sway build script | |
# Intended for use without DM | |
# swaylock and sway are setuid root, be advised | |
usage() { | |
echo "Usage: $0 [-pr]" | |
echo " -p Pull updates from git" | |
echo " -w Wipe meson" | |
echo " -r Reconfigure meson" | |
exit 1 | |
} | |
while getopts "prw" opt &>/dev/null; do | |
case ${opt} in | |
p) pull=1;; | |
r) reconf=1;; | |
w) wipe=1;; | |
\?) usage;; | |
esac | |
done | |
echo "pull $pull" | |
echo "reconf $reconf" | |
echo "wipe $wipe" | |
project() { | |
name=$(basename $PWD) | |
file=${PREFIX}/bin/${name} | |
build=build$(echo $name | grep -q swaylock && echo -no-pam) | |
test -v $pull && git pull | |
test $wipe && { | |
echo "[*] wiping meson setup of ${name}" | |
meson setup --wipe $build || exit 1 | |
} | |
test $reconf || test ! -d $build && { | |
echo "[*] reconfiguring ${name}" | |
meson $build $(test -d build && echo "--reconfigure") --prefix $PREFIX -Dfish-completions=false -Dzsh-completions=true -Dbash-completions=false -Ddatadir=$PREFIX/share --buildtype debug || exit 1 | |
} | |
echo "[*] building ${name}" | |
ninja -C $build install || exit 1 | |
[ -x ${file} ] && patchelf --set-rpath ${PREFIX}/lib ${file} | |
{ grep -xE "(swaylock|sway)" && echo "[*] adding needed setuid for ${name}" && sudo chown root ${file} && sudo chmod 4755 ${file}; } <<<${name} | |
} | |
[ ! -d sway ] && git clone --recursive https://github.com/swaywm/sway | |
mkdir -p sway/subprojects | |
cd sway/subprojects | |
for subproject in wlroots swaylock swayidle swaybg; do | |
[ ! -d $subproject ] && git clone --recursive https://github.com/swaywm/$subproject | |
cd $subproject | |
project | |
cd .. | |
done | |
cd .. | |
project # Sway |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment