--- /dev/null
+#+TITLE: Building IAHWC backend for weston
+
+* Building the Weston Plugin:
+
+Setting up the env for weston:
+#+BEGIN_SRC bash
+export WLD=$HOME/wl-install # change this to another location if you prefer
+export LD_LIBRARY_PATH=$WLD/lib
+export PKG_CONFIG_PATH=$WLD/lib/pkgconfig/:$WLD/share/pkgconfig/
+export PATH=$WLD/bin:$PATH
+export ACLOCAL_PATH=$WLD/share/aclocal
+export ACLOCAL="aclocal -I $ACLOCAL_PATH"
+mkdir -p $WLD/share/aclocal # needed by autotools
+#+END_SRC
+
+Source the above env in the shell.
+Dependencies for building weston (to be built in the same order):
+- libdrm
+- Wayland
+- Wayland protocol
+- Mesa
+- Libunwind (needed for debugging)
+- Libinput
+- libva
+- vaapi
+- Hwcomposer
+- Weston
+
+* Building Libdrm
+#+BEGIN_SRC bash
+git clone https://github.com/intel/external-libdrm libdrm
+cd libdrm
+./autogen.sh --disable-radeon --disable-nouveau --disable-amdgpu --enable-udev --enable-libkms --prefix=$WLD
+make -j5 && make install
+cd ..
+#+END_SRC
+
+* Building Wayland
+#+BEGIN_SRC bash
+git clone git://anongit.freedesktop.org/wayland/wayland wayland
+cd wayland
+./autogen.sh --prefix=$WLD --disable-documentation
+make && make install
+cd ..
+#+END_SRC
+
+* Building Wayland-protocols
+#+BEGIN_SRC bash
+git clone git://anongit.freedesktop.org/wayland/wayland-protocols wayland-protocols
+cd wayland-protocols
+./autogen.sh --prefix=$WLD
+make install
+cd ..
+#+END_SRC
+
+* Building libunwind (for debugging only)
+#+BEGIN_SRC bash
+git clone git://git.sv.gnu.org/libunwind libunwind
+cd libunwind
+./autogen.sh --prefix=$WLD
+make && make install
+cd ..
+#+END_SRC
+
+* Building libinput
+#+BEGIN_SRC bash
+git clone git://anongit.freedesktop.org/git/wayland/libinput libinput
+cd libinput
+meson --prefix=$WLD -Dlibwacom=false -Ddocumentation=false -Ddebug-gui=false -Dtests=false builddir/
+ninja -C builddir/
+ninja -C builddir/ install
+cd ..
+#+END_SRC
+
+* Building Mesa
+#+BEGIN_SRC bash
+git clone https://github.com/intel/external-mesa mesa
+cd mesa
+git clean -xfd
+./autogen.sh --prefix=$WLD --with-platforms=surfaceless,drm,wayland,x11 --disable-dri3\
+ --enable-shared-glapi --disable-glx --disable-glx-tls --enable-gbm\
+ --without-gallium-drivers --with-dri-drivers=i965
+make -j5 install
+cd ..
+#+END_SRC
+
+* Building libva
+#+BEGIN_SRC bash
+git clone https://github.com/android-ia/libva.git libva
+cd libva
+./autogen.sh --prefix=$WLD
+make -j5 && make install
+cd ..
+#+END_SRC
+
+* Building VA-API
+#+BEGIN_SRC bash
+git clone https://github.com/android-ia/vaapi.git vaapi
+cd vaapi
+./autogen.sh --prefix=$WLD
+make -j5 && make install
+cd ..
+#+END_SRC
+
+* Building Weston and IAHWC
+#+BEGIN_SRC bash
+git clone https://anongit.freedesktop.org/git/wayland/weston.git weston
+git clone https://github.com/intel/IA-Hardware-Composer.git iahwc
+cd iahwc
+os/linux/weston/build_script.sh --apply-patches --weston-dir=/tmp/weston --iahwc-dir=$(pwd) --build
+#+END_SRC
+
+* Using the build_script.sh
+Please run ./build_script.sh --help for more details
# these variables can be changed using --weston-dir and
# --iahwc-dir options to the script. see --help.
+# copied from the grub-mkconfig_lib script
+print_option_help () {
+ if test x$print_option_help_wc = x; then
+ if wc -L </dev/null > /dev/null 2>&1; then
+ print_option_help_wc=-L
+ elif wc -m </dev/null > /dev/null 2>&1; then
+ print_option_help_wc=-m
+ else
+ print_option_help_wc=-b
+ fi
+ fi
+ if test x$grub_have_fmt = x; then
+ if fmt -w 40 </dev/null > /dev/null 2>&1; then
+ grub_have_fmt=y;
+ else
+ grub_have_fmt=n;
+ fi
+ fi
+ print_option_help_lead=" $1"
+ print_option_help_lspace="$(echo "$print_option_help_lead" | wc $print_option_help_wc)"
+ print_option_help_fill="$((26 - print_option_help_lspace))"
+ printf "%s" "$print_option_help_lead"
+ if test $print_option_help_fill -le 0; then
+ print_option_help_nl=y
+ echo
+ else
+ print_option_help_i=0;
+ while test $print_option_help_i -lt $print_option_help_fill; do
+ printf " "
+ print_option_help_i=$((print_option_help_i+1))
+ done
+ print_option_help_nl=n
+ fi
+ if test x$grub_have_fmt = xy; then
+ print_option_help_split="$(echo "$2" | fmt -w 50)"
+ else
+ print_option_help_split="$2"
+ fi
+ if test x$print_option_help_nl = xy; then
+ echo "$print_option_help_split" | awk \
+ '{ print " " $0; }'
+ else
+ echo "$print_option_help_split" | awk 'BEGIN { n = 0 }
+ { if (n == 1) print " " $0; else print $0; n = 1 ; }'
+ fi
+}
+
function print_help() {
- #fill in help
- echo "HELP"
+ self=`basename $0`
+
+ gettext "Usage: ${self} [OPTION]"; echo
+ gettext "Build iahwc and weston"
+ echo
+ print_option_help "--apply-patches" "apply all the required patches on weston"
+ print_option_help "--build-iahwc" "build IAHWC"
+ print_option_help "--build-weston" "build WESTON"
+ print_option_help "--build" "build both"
+ print_option_help "--iahwc-dir=" "path to iahwc source"
+ print_option_help "--weston-dir=" "path to weston source"
+ print_option_help "-j=, --parallel=" "number of threads to be used while building"
+ print_option_help "-h, --help" "print this message and exit"
+ echo
+ gettext "Report issues at https://github.com/intel/IA-Hardware-Composer/issues"; echo
+ echo
exit;
}