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

set -e
set -x

# script to build naali and most deps.
#
# note: you need to enable the universe and multiverse software sources
# as this script attempts to get part of the deps using apt-get

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 OGRE_HOME=$prefix
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

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 libois-dev libxrandr-dev \
	 libspeex-dev nvidia-cg-toolkit subversion
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
cp -lf $build/$what/plugins/script/* $viewer/bin/qtplugins/script/


what=kNet
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    rm -rf kNet
    git clone https://github.com/juj/kNet
    cd kNet
    git checkout stable
    sed -e "s/USE_TINYXML TRUE/USE_TINYXML FALSE/" -e "s/kNet STATIC/kNet SHARED/" < CMakeLists.txt > x
    mv x CMakeLists.txt
    cmake . -DCMAKE_BUILD_TYPE=Debug
    make -j $nprocs
    cp lib/libkNet.so $prefix/lib/
    rsync -r include/* $prefix/include/
    touch $tags/$what-done
fi

what=ogre-safe-nocrashes
if test -f $tags/$what-done; then 
   echo "Testing whether there are new changes in $what"
   cd $build/$what
   res=`hg pull -u|grep "no changes found"`
   if [ -z "$res" ]; then
       echo "Changes detected in $what. Removing $what-done tag and forcing a rebuild."
       rm -f $tags/$what-done
   fi
fi
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    if [ ! -e "$what" ]; then
        echo "$what does not exist. Cloning a new copy..."
        hg clone https://bitbucket.org/clb/ogre-safe-nocrashes
    fi
    cd $what
    hg checkout v1-8 # Make sure we are in the right branch
    mkdir -p $what-build
    cd $what-build  
    cmake .. -DCMAKE_INSTALL_PREFIX=$prefix
    make -j $nprocs VERBOSE=1
    make install
    touch $tags/$what-done
fi<commit_msg>Actually restore fetching build deps for ogre build<commit_after>#!/bin/bash
# script to build naali and most deps.

set -e
set -x

# script to build naali and most deps.
#
# note: you need to enable the universe and multiverse software sources
# as this script attempts to get part of the deps using apt-get

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 OGRE_HOME=$prefix
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

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 libois-dev libxrandr-dev \
	 libspeex-dev nvidia-cg-toolkit subversion
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
cp -lf $build/$what/plugins/script/* $viewer/bin/qtplugins/script/


what=kNet
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    rm -rf kNet
    git clone https://github.com/juj/kNet
    cd kNet
    git checkout stable
    sed -e "s/USE_TINYXML TRUE/USE_TINYXML FALSE/" -e "s/kNet STATIC/kNet SHARED/" < CMakeLists.txt > x
    mv x CMakeLists.txt
    cmake . -DCMAKE_BUILD_TYPE=Debug
    make -j $nprocs
    cp lib/libkNet.so $prefix/lib/
    rsync -r include/* $prefix/include/
    touch $tags/$what-done
fi

what=ogre-safe-nocrashes
if test -f $tags/$what-done; then 
   echo "Testing whether there are new changes in $what"
   cd $build/$what
   res=`hg pull -u|grep "no changes found"`
   if [ -z "$res" ]; then
       echo "Changes detected in $what. Removing $what-done tag and forcing a rebuild."
       rm -f $tags/$what-done
   fi
fi
if test -f $tags/$what-done; then 
   echo $what is done
else
    cd $build
    if [ ! -e "$what" ]; then
        echo "$what does not exist. Cloning a new copy..."
        hg clone https://bitbucket.org/clb/ogre-safe-nocrashes
    fi
    if tty > /dev/null; then
	sudo apt-get build-dep libogre-dev
    fi
    cd $what
    hg checkout v1-8 # Make sure we are in the right branch
    mkdir -p $what-build
    cd $what-build  
    cmake .. -DCMAKE_INSTALL_PREFIX=$prefix
    make -j $nprocs VERBOSE=1
    make install
    touch $tags/$what-done
fi
{'fraction_non_alphanumeric': 0.12085206593877114, 'fraction_numerical': 0.0074930421751231, 'mean_word_length': 3.2237793851717904, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 32, 'https://': 4, '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': '1979230', 'n_tokens_mistral': 3622, 'n_tokens_neox': 3413, 'n_words': 945}