summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuild-wayland.sh156
1 files changed, 114 insertions, 42 deletions
diff --git a/build-wayland.sh b/build-wayland.sh
index 596765b..aa82e56 100755
--- a/build-wayland.sh
+++ b/build-wayland.sh
@@ -16,18 +16,52 @@ export WLD LD_LIBRARY_PATH PKG_CONFIG_PATH ACLOCAL C_INCLUDE_PATH LIBRARY_PATH P
RESET="\033[0m"
RED="\033[0;31m"
-function say () { echo -e "$RED$1$RESET"; }
+GREEN="\033[0;32m"
+
+function say () { echo -e "$GREEN$1$RESET"; }
+function error () { echo -e "${RED}FAILURE${RESET}" && exit 1; }
+
+function build () {
+ say " * make" && make && say " * install" && sudo -E make install
+}
+
+function autogen () {
+ say " * autogen --prefix=$WLD $my_configure_opts" && ./autogen.sh --prefix=$WLD $my_configure_opts && build
+}
+
+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..)
+ [ "$SHA_PREV" = "$SHA_HEAD" ] && return 0
+ build
+}
+
+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"
+}
# WAYLAND
-say "wayland" && [ ! -d wayland ] && git clone git://anongit.freedesktop.org/wayland/wayland
-cd wayland && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
+say "wayland"
+my_dir=wayland
+my_src=git://anongit.freedesktop.org/wayland/wayland
+my_configure_opts=
+do_your_job
# XCB
[ ! -d xcb ] && mkdir xcb
cd xcb
-say "cxb:pthread-stubs" && [ ! -d pthread-stubs ] && git clone git://anongit.freedesktop.org/xcb/pthread-stubs
-cd pthread-stubs && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
+say "cxb:pthread-stubs"
+my_dir=pthread-stubs
+my_src=git://anongit.freedesktop.org/xcb/pthread-stubs
+my_configure_opts=
+do_your_job
cd ..
@@ -35,21 +69,35 @@ cd ..
[ ! -d mesa ] && mkdir mesa
cd mesa
-say "mesa:drm" && [ ! -d drm ] && git clone git://anongit.freedesktop.org/git/mesa/drm
-cd drm && git pull && ./autogen.sh --prefix=$WLD --enable-nouveau-experimental-api && make && sudo -E make install && cd .. || exit 1
-
-say "mesa:macros" && [ ! -d macros ] && git clone git://anongit.freedesktop.org/git/xorg/util/macros
-cd macros && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "mesa:glproto" && [ ! -d glproto ] && git clone git://anongit.freedesktop.org/xorg/proto/glproto
-cd macros && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "mesa:dri2proto" && [ ! -d dri2proto ] && git clone git://anongit.freedesktop.org/xorg/proto/dri2proto
-cd macros && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "mesa:mesa" && [ ! -d mesa ] && git clone git://anongit.freedesktop.org/mesa/mesa
-cd mesa && git pull && ./autogen.sh --prefix=$WLD --enable-gles2 --disable-gallium-egl \
- --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi && make && sudo -E make install && cd .. || exit 1
+say "mesa:drm"
+my_dir=drm
+my_src=git://anongit.freedesktop.org/git/mesa/drm
+my_configure_opts="--enable-nouveau-experimental-api"
+do_your_job
+
+say "mesa:macros"
+my_dir=macros
+my_src=git://anongit.freedesktop.org/git/xorg/util/macros
+my_configure_opts=
+do_your_job
+
+say "mesa:glproto"
+my_dir=glproto
+my_src=git://anongit.freedesktop.org/xorg/proto/glproto
+my_configure_opts=
+do_your_job
+
+say "mesa:dri2proto"
+my_dir=dri2proto
+my_src=git://anongit.freedesktop.org/xorg/proto/dri2proto
+my_configure_opts=
+do_your_job
+
+say "mesa:mesa"
+my_dir=mesa
+my_src=git://anongit.freedesktop.org/mesa/mesa
+my_configure_opts="--enable-gles2 --disable-gallium-egl --with-egl-platforms=x11,wayland,drm --enable-gbm --enable-shared-glapi"
+do_your_job
cd ..
@@ -57,32 +105,56 @@ cd ..
[ ! -d xorg ] && mkdir xorg
cd xorg
-say "xorg:macros" && [ ! -d macros ] && git clone git://anongit.freedesktop.org/xorg/util/macros
-cd macros && git pull &&./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:xproto" && [ ! -d xproto ] && git clone git://anongit.freedesktop.org/xorg/proto/xproto
-cd xproto && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:kbproto" && [ ! -d kbproto ] && git clone git://anongit.freedesktop.org/xorg/proto/kbproto
-cd kbproto && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:libX11" && [ ! -d libX11 ] && git clone git://anongit.freedesktop.org/xorg/lib/libX11
-cd libX11 && git pull && ./autogen.sh --prefix=$WLD --enable-specs=false && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:libxkbcommon" && [ ! -d libxkbcommon ] && git clone git://people.freedesktop.org/xorg/lib/libxkbcommon.git libxkbcommon
-cd libxkbcommon && git pull && ./autogen.sh --prefix=$WLD --with-xkb-config-root=/usr/share/X11/xkb && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:pixman" && [ ! -d pixman ] && git clone git://anongit.freedesktop.org/pixman
-cd pixman && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
-
-say "xorg:cairo" && [ ! -d cairo ] && git clone git://anongit.freedesktop.org/cairo
-cd cairo && git pull && ./autogen.sh --prefix=$WLD --enable-gl --enable-xcb && make && sudo -E make install && cd .. || exit 1
+say "xorg:macros"
+my_dir=macros
+my_src=git://anongit.freedesktop.org/xorg/util/macros
+my_configure_opts=
+do_your_job
+
+say "xorg:xproto"
+my_dir=xproto
+my_src=git://anongit.freedesktop.org/xorg/proto/xproto
+my_configure_opts=
+do_your_job
+
+say "xorg:kbproto"
+my_dir=kbproto
+my_src=git://anongit.freedesktop.org/xorg/proto/kbproto
+my_configure_opts=
+do_your_job
+
+say "xorg:libX11"
+my_dir=libX11
+my_src=git://anongit.freedesktop.org/xorg/lib/libX11
+my_configure_opts="--enable-specs=false"
+do_your_job
+
+say "xorg:libxkbcommon"
+my_dir=libxkbcommon
+my_src=git://people.freedesktop.org/xorg/lib/libxkbcommon.git libxkbcommon
+my_configure_opts="--with-xkb-config-root=/usr/share/X11/xkb"
+do_your_job
+
+say "xorg:pixman"
+my_dir=pixman
+my_src=git://anongit.freedesktop.org/pixman
+my_configure_opts=
+do_your_job
+
+say "xorg:cairo"
+my_dir=cairo
+my_src=git://anongit.freedesktop.org/cairo
+my_configure_opts="--enable-gl --enable-xcb"
+do_your_job
cd ..
# WAYLAND-DEMOS
-say "wayland-demos" && [ ! -d wayland-demos ] && git clone git://anongit.freedesktop.org/wayland/wayland-demos
-cd wayland-demos && git pull && ./autogen.sh --prefix=$WLD && make && sudo -E make install && cd .. || exit 1
+say "wayland-demos"
+my_dir=wayland-demos
+my_src=git://anongit.freedesktop.org/wayland/wayland-demos
+my_configure_opts=
+do_your_job
say "DONE"