etrunko

build-e17.sh

Aug 29th, 2012
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.54 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ####
  4. #### Globals
  5. ####
  6.  
  7. [ -z "$PREFIX" ] && PREFIX="/usr"
  8. [ -z "$MAKEFLAGS" ] && MAKEFLAGS="-j -l 10"
  9. [ -z "$MAKE" ] && MAKE="chrt --idle 0 make"
  10.  
  11. ####
  12. #### Functions
  13. ####
  14.  
  15. function _pushd() {
  16.     pushd ./$mod_dir/$1 > /dev/null
  17. }
  18.  
  19. function _popd() {
  20.     popd > /dev/null
  21. }
  22.  
  23. function die() {
  24.     echo $@
  25.     exit 1
  26. }
  27.  
  28. function cleanup() {
  29.     local mod=$1
  30.  
  31.     [ -d "$mod" ] || return
  32.  
  33.     echo "cleanup $mod..."
  34.  
  35.     _pushd $mod
  36.         if [ -f Makefile ]; then
  37.             $MAKE uninstall > /dev/null 2>&1
  38.             $MAKE distclean > /dev/null 2>&1
  39.         fi
  40.         rm -rf autom4te.cache
  41.         git clean -d -x -f > /dev/null 2>&1
  42.         [ -d po/ ] && git checkout po/ > /dev/null 2>&1
  43.     _popd
  44. }
  45.  
  46. function clone() {
  47.     local mod=$1
  48.     echo "clone $mod..."
  49.  
  50.     local GIT_ROOT="git://gitorious.org/enlightenment"
  51.  
  52.     case $mod in
  53.         *)
  54.             mod_path=""
  55.             ;;
  56.     esac
  57.  
  58.     [ -z "$mod_path" ] && GIT_URI=$GIT_ROOT/$mod || GIT_URI=$GIT_ROOT/$mod_path/$mod
  59.  
  60.     $E_PROXY_CMD git clone $GIT_URI > /dev/null 2>&1 || die "Error cloning $mod from $GIT_URI"
  61. }
  62.  
  63. function update() {
  64.     local mod=$1
  65.  
  66.     if [ ! -d "$mod" ]; then
  67.         clone $mod
  68.         return
  69.     fi
  70.  
  71.     echo "update $mod..."
  72.     _pushd $mod
  73.         $E_PROXY_CMD git pull --rebase > /dev/null 2>&1 || die "Error updating $mod"
  74.     _popd
  75. }
  76.  
  77. function prepare_build() {
  78.     local arch=`which arch`
  79.     [ $? -eq 0 ]          && ARCH=`$arch`           || ARCH=""
  80.     [ $ARCH == "x86_64" ] && LIBDIR="$PREFIX/lib64" || LIBDIR="$PREFIX/lib"
  81.     [ $PREFIX == "/usr" ] && SYSCONFDIR="/etc"      || SYSCONFDIR="$PREFIX/etc"
  82.     [ $PREFIX == "/usr" ] && LOCALSTATEDIR="/var"   || LOCALSTATEDIR="$PREFIX/var"
  83.  
  84.     export PKG_CONFIG_PATH="$LIBDIR/pkgconfig:$PKG_CONFIG_PATH"
  85.     export LD_LIBRARY_PATH="$LIBDIR:$LD_LIBRARY_PATH"
  86.     export PATH="$PREFIX/bin:$PATH"
  87.  
  88.     CONFIG_OPTIONS="--prefix=$PREFIX --libdir=$LIBDIR --sysconfdir=$SYSCONFDIR --localstatedir=$LOCALSTATEDIR"
  89.  
  90.     E_BUILD_FLAGS="-W -Wall -Wextra -march=native -ffast-math"
  91.     CFLAGS+="$E_BUILD_FLAGS"
  92.     CXXFLAGS+="$E_BUILD_FLAGS"
  93.  
  94.     ACLOCAL_INCLUDE_DIR="$PREFIX/share/aclocal"
  95.     [ -d $ACLOCAL_INCLUDE_DIR ] || mkdir -p $ACLOCAL_INCLUDE_DIR > /dev/null 2>&1
  96.     export ACLOCAL="aclocal -I$ACLOCAL_INCLUDE_DIR"
  97. }
  98.  
  99. function build() {
  100.     local mod=$1
  101.     local mod_config_options=""
  102.     echo "build $mod..."
  103.  
  104.     case $mod in
  105.         evas)
  106.             mod_config_options=" \
  107.                --enable-software-16-x11 \
  108.                --enable-gl-xlib \
  109.                --enable-pthreads \
  110.                --enable-cpu-sse3 \
  111.                --enable-gl-flavor-gles \
  112.                --enable-gles-variety-sgx \
  113.            "
  114.             ;;
  115.         ecore)
  116.             mod_config_options=" \
  117.                --enable-ecore-evas-software-16-x11 \
  118.                --enable-ecore-evas-opengl-x11 \
  119.            "
  120.             ;;
  121.         epdf)
  122.             mod_config_options=" \
  123.                --enable-poppler \
  124.                --disable-mupdf \
  125.            "
  126.             ;;
  127.         elementary)
  128.             mod_config_options=" \
  129.                --disable-quick-launch \
  130.            "
  131.             ;;
  132.         e_dbus)
  133.             mod_config_options=" \
  134.                --disable-edbus-performance-test \
  135.            "
  136.             ;;
  137.         *)
  138.             mod_config_options=""
  139.             ;;
  140.     esac
  141.  
  142.     _pushd $mod
  143.         [ ! -f Makefile ] && E_NO_CONFIGURE=""
  144.  
  145.         if [ -z "$E_NO_CONFIGURE" ] && [ -x ./autogen.sh ]; then
  146.             rm -f m4/libtool.m4
  147.             ./autogen.sh $CONFIG_OPTIONS $mod_config_options $E_CONFIG_OPTIONS >> build.log 2>&1 || die "$mod: error running autogen.sh"
  148.         fi
  149.  
  150.         $MAKE >> build.log 2>&1 || die "$mod: error building"
  151.         $MAKE install >> build.log 2>&1 || die "$mod: error installing"
  152.     _popd
  153.  
  154. }
  155.  
  156. function run_all() {
  157.     local func=$1
  158.     for module in $E_MODULES; do
  159.         $func $module
  160.     done
  161. }
  162.  
  163. ####
  164. #### Begin
  165. ####
  166.  
  167. [ -z "$E_MODULES" ] && E_MODULES=" \
  168.    eina \
  169.    eet \
  170.    evas \
  171.    ecore \
  172.    eio \
  173.    embryo \
  174.    edje \
  175.    e_dbus \
  176.    efreet \
  177.    eeze \
  178.    emotion \
  179.    epdf \
  180.    ethumb \
  181.    elementary \
  182.    e \
  183.    terminology \
  184. "
  185.  
  186. # Cleanup (set E_NO_CLEANUP to bypass)
  187. if [ -z "$E_NO_CLEANUP" ]; then
  188.     run_all cleanup
  189. fi
  190.  
  191. # Update SVN (set E_NO_UPDATE_SVN to bypass)
  192. if [ -z "$E_NO_UPDATE" ]; then
  193.     run_all update
  194. fi
  195.  
  196. # Build
  197. if [ -z "$E_NO_BUILD" ]; then
  198.     prepare_build
  199.     run_all build
  200. fi
Advertisement
Add Comment
Please, Sign In to add comment