summaryrefslogtreecommitdiffstats
path: root/wayland.sh
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-02-05 16:42:51 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-02-05 16:42:51 +0100
commitdc8b98556f8752f0496ec71d43a4ef52a58e66f6 (patch)
tree175cbcfd5f14d59a46e5d87983ed39ccc8f130b8 /wayland.sh
parentcdd6c040293eb19b1263314c46ba570d6bdc6320 (diff)
downloadbin-dc8b98556f8752f0496ec71d43a4ef52a58e66f6.zip
bin-dc8b98556f8752f0496ec71d43a4ef52a58e66f6.tar.gz
wayland* update
Diffstat (limited to 'wayland.sh')
-rwxr-xr-xwayland.sh97
1 files changed, 97 insertions, 0 deletions
diff --git a/wayland.sh b/wayland.sh
new file mode 100755
index 0000000..e09771c
--- /dev/null
+++ b/wayland.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+# hbased on ttp://wayland.freedesktop.org/building.html
+
+WLD=/opt/wayland
+LD_LIBRARY_PATH=$WLD/lib
+PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
+ACLOCAL="aclocal -I $WLD/share/aclocal"
+C_INCLUDE_PATH=$WLD/include
+LIBRARY_PATH=$WLD/lib
+PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
+
+#export WLD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL C_INCLUDE_PATH LIBRARY_PATH PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
+
+BUILD_DIR=${BUILD_DIR:-~/local}
+FORCE_AUTOGEN=0
+FORCE_DISTCLEAN=0
+SUDO_PASSWD=""
+for arg in $@; do
+ option=`echo "'$arg'" | cut -d'=' -f1 | tr -d "'"`
+ value=`echo "'$arg'" | cut -d'=' -f2- | tr -d "'"`
+ case $option in
+ "-f") FORCE_AUTOGEN=1;;
+ "-c") FORCE_DISTCLEAN=1;;
+ "-s") SUDO_PASSWD=$value;;
+ esac
+done
+
+RESET="\033[0m"
+RED="\033[0;31m"
+GREEN="\033[0;32m"
+
+function say () { echo -e "$GREEN$1$RESET"; }
+
+function error () { echo -e "${RED}FAILURE${RESET} $1" && exit 1; }
+
+sudo -K
+TMP=/tmp/sudo.test
+[ -e "$TMP" ] && rm -f "$TMP"
+echo "$SUDO_PASSWD" | sudo -S touch "$TMP" &>/dev/null
+if [ ! -e "$TMP" ]; then
+ error "cmdline provided sudo password failed!"
+else
+ echo "$SUDO_PASSWD" | sudo -S rm -f "$TMP"
+fi
+echo
+
+function build () {
+ if [ $FORCE_AUTOGEN -eq 1 -o ! -e Makefile ]; then
+ say " * autogen --prefix=$WLD $my_configure_opts" && ./autogen.sh --prefix=$WLD $my_configure_opts
+ fi
+ if [ $FORCE_DISTCLEAN -eq 1 ]; then
+ say " * make distclean" && make distclean >/dev/null
+ fi
+ tmp=/tmp/$my_dir.build
+ say " * make" && make >$tmp && say " * install" && echo "$SUDO_PASSWD" | sudo -S -E make install
+}
+
+function update () {
+ SHA_PREV=$(git log --pretty="format:%H" HEAD~1..)
+ say " * pull" && git pull || return 1
+ SHA_HEAD=$(git log --pretty="format:%H" HEAD~1..)
+ if [ $FORCE_AUTOGEN -eq 1 -o $FORCE_DISTCLEAN -eq 1 ]; then
+ build
+ else
+ [ "$SHA_PREV" = "$SHA_HEAD" ] && return 0
+ build
+ fi
+}
+
+function do_your_job () {
+ if [ -d "$my_dir" ]; then
+ cd "$my_dir" && update && cd .. || error
+ else
+ say " * clone $my_src" && git clone "$my_src" "$my_dir" && cd "$my_dir" && autogen && cd .. || error
+ fi
+ say " * SUCCESS\n"
+}
+
+cd $BUILD_DIR || exit 1
+
+# WAYLAND
+say "wayland"
+my_dir=wayland
+my_src=git://anongit.freedesktop.org/wayland/wayland
+my_configure_opts=
+do_your_job
+
+# WAYLAND-DEMOS
+say "wayland-demos"
+my_dir=wayland-demos
+my_src=git://anongit.freedesktop.org/wayland/wayland-demos
+my_configure_opts=
+do_your_job
+
+say "DONE"
+