<commit_before>#!/bin/bash
# script to build naali and most deps.

set -e
set -x


viewer=$(dirname $(readlink -f $0))/..
deps=$viewer/../naali-deps
mkdir -p $deps
deps=$(cd $deps && pwd)
viewer=$(cd $viewer && pwd)

prefix=$deps/install
build=$deps/build
tarballs=$deps/tarballs
tags=$deps/tags



# -j<n> param for make, for how many processes to run concurrently

nprocs=`grep -c "^processor" /proc/cpuinfo` 

mkdir -p $tarballs $build $prefix/{lib,share,etc,include} $tags

export PATH=$prefix/bin:$PATH
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
export NAALI_DEP_PATH=$prefix
export LDFLAGS="-L$prefix/lib -Wl,-rpath -Wl,$prefix/lib"
export LIBRARY_PATH=$prefix/lib
export C_INCLUDE_PATH=$prefix/include
export CPLUS_INCLUDE_PATH=$prefix/include
export CC="ccache gcc"
export CXX="ccache g++"
export CCACHE_DIR=$deps/ccache
export TUNDRA_PYTHON_ENABLED=TRUE

private_ogre=true # build own ogre by default, since ubuntu shipped ogre is too old and/or built without thread support

if [ x$private_ogre != xtrue ]; then
    more="libogre-dev"
else
    more="nvidia-cg-toolkit" # ubuntu libogre-dev build-deps don't include cg
    export OGRE_HOME=$prefix
fi

if lsb_release -c | egrep -q "lucid|maverick|natty|oneiric|precise" && tty >/dev/null; then
        which aptitude > /dev/null 2>&1 || sudo apt-get install aptitude
	sudo aptitude -y install git-core python-dev libogg-dev libvorbis-dev \
	 build-essential g++ libboost-all-dev libois-dev \
	 ccache libqt4-dev python-dev freeglut3-dev \
	 libxml2-dev cmake libalut-dev libtheora-dev ed \
	 liboil0.3-dev mercurial unzip xsltproc $more
fi

what=bullet-2.79-rev2440
if test -f $tags/$what-done; then
    echo $what is done
else
    cd $build
    whatdir=${what%%-rev*}
    rm -rf $whatdir
    test -f $tarballs/$what.tgz || wget -P $tarballs http://bullet.googlecode.com/files/$what.tgz
    tar zxf $tarballs/$what.tgz
    cd $whatdir
    sed -i s/OpenCL// src/BulletMultiThreaded/GpuSoftBodySolvers/CMakeLists.txt
    cmake -DCMAKE_INSTALL_PREFIX=$prefix -DBUILD_DEMOS=OFF -DBUILD_{NVIDIA,AMD,MINICL}_OPENCL_DEMOS=OFF -DBUILD_CPU_DEMOS=OFF -DINSTALL_EXTRA_LIBS=ON -DCMAKE_CXX_FLAGS_RELEASE="-O2 -g -fPIC" .
    make -j $nprocs
    make install
    touch $tags/$what-done
fi

what=qtscriptgenerator
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    rm -rf $what
    git clone git://gitorious.org/qt-labs/$what.git
    cd $what

    cd generator
    qmake
    make -j $nprocs
    ./generator --include-paths=`qmake -query QT_INSTALL_HEADERS`
    cd ..

    cd qtbindings
    sed -i 's/qtscript_phonon //' qtbindings.pro 
    sed -i 's/qtscript_webkit //' qtbindings.pro 
    qmake
    make -j $nprocs
    cd ..
    cd ..
    touch $tags/$what-done
fi
mkdir -p $viewer/bin/qtplugins/script<commit_msg>Ubuntu build script: Copy a qtscriptgenerator build fix from the debian/ubuntu packages that makes webkit bindings work.<commit_after>#!/bin/bash
# script to build naali and most deps.

set -e
set -x


viewer=$(dirname $(readlink -f $0))/..
deps=$viewer/../naali-deps
mkdir -p $deps
deps=$(cd $deps && pwd)
viewer=$(cd $viewer && pwd)

prefix=$deps/install
build=$deps/build
tarballs=$deps/tarballs
tags=$deps/tags



# -j<n> param for make, for how many processes to run concurrently

nprocs=`grep -c "^processor" /proc/cpuinfo` 

mkdir -p $tarballs $build $prefix/{lib,share,etc,include} $tags

export PATH=$prefix/bin:$PATH
export PKG_CONFIG_PATH=$prefix/lib/pkgconfig
export NAALI_DEP_PATH=$prefix
export LDFLAGS="-L$prefix/lib -Wl,-rpath -Wl,$prefix/lib"
export LIBRARY_PATH=$prefix/lib
export C_INCLUDE_PATH=$prefix/include
export CPLUS_INCLUDE_PATH=$prefix/include
export CC="ccache gcc"
export CXX="ccache g++"
export CCACHE_DIR=$deps/ccache
export TUNDRA_PYTHON_ENABLED=TRUE

private_ogre=true # build own ogre by default, since ubuntu shipped ogre is too old and/or built without thread support

if [ x$private_ogre != xtrue ]; then
    more="libogre-dev"
else
    more="nvidia-cg-toolkit" # ubuntu libogre-dev build-deps don't include cg
    export OGRE_HOME=$prefix
fi

if lsb_release -c | egrep -q "lucid|maverick|natty|oneiric|precise" && tty >/dev/null; then
        which aptitude > /dev/null 2>&1 || sudo apt-get install aptitude
	sudo aptitude -y install git-core python-dev libogg-dev libvorbis-dev \
	 build-essential g++ libboost-all-dev libois-dev \
	 ccache libqt4-dev python-dev freeglut3-dev \
	 libxml2-dev cmake libalut-dev libtheora-dev ed \
	 liboil0.3-dev mercurial unzip xsltproc $more
fi

what=bullet-2.79-rev2440
if test -f $tags/$what-done; then
    echo $what is done
else
    cd $build
    whatdir=${what%%-rev*}
    rm -rf $whatdir
    test -f $tarballs/$what.tgz || wget -P $tarballs http://bullet.googlecode.com/files/$what.tgz
    tar zxf $tarballs/$what.tgz
    cd $whatdir
    sed -i s/OpenCL// src/BulletMultiThreaded/GpuSoftBodySolvers/CMakeLists.txt
    cmake -DCMAKE_INSTALL_PREFIX=$prefix -DBUILD_DEMOS=OFF -DBUILD_{NVIDIA,AMD,MINICL}_OPENCL_DEMOS=OFF -DBUILD_CPU_DEMOS=OFF -DINSTALL_EXTRA_LIBS=ON -DCMAKE_CXX_FLAGS_RELEASE="-O2 -g -fPIC" .
    make -j $nprocs
    make install
    touch $tags/$what-done
fi

what=qtscriptgenerator
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    rm -rf $what
    git clone git://gitorious.org/qt-labs/$what.git
    cd $what
    patch -l -p1 <<EOF
Description: Include QtWebkit and Phonon unconditionally.
 This is necessary as both aren't built by the Qt source.
Author: <NAME> <<EMAIL>>
Acked-By: <NAME> <<EMAIL>>
Last-Update: 2011-03-20

--- a/generator/qtscript_masterinclude.h
+++ b/generator/qtscript_masterinclude.h
@@ -53,13 +53,9 @@
 #  include <QtXmlPatterns/QtXmlPatterns>
 #endif
 
-#ifndef QT_NO_WEBKIT
 #  include <QtWebKit/QtWebKit>
-#endif
 
-#ifndef QT_NO_PHONON
 #  include <phonon/phonon>
-#endif
 
 #include "../qtbindings/qtscript_core/qtscriptconcurrent.h"
 
EOF
    cd generator
    qmake
    make -j $nprocs
    ./generator --include-paths=`qmake -query QT_INSTALL_HEADERS`
    cd ..

    cd qtbindings
    sed -i 's/qtscript_phonon //' qtbindings.pro
    qmake
    make -j $nprocs
    cd ..
    cd ..
    touch $tags/$what-done
fi
mkdir -p $viewer/bin/qtplugins/script
{'fraction_non_alphanumeric': 0.12316384180790961, 'fraction_numerical': 0.00774818401937046, 'mean_word_length': 3.683295540438398, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5422498', 'n_tokens_mistral': 2453, 'n_tokens_neox': 2289, 'n_words': 578}