Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # Where to do all the stuff, should be changed to needs
- directory=$HOME/Buildsystem
- # The other options usually don't need to be changed.
- srcDir=$directory/src
- instDir=$directory/inst
- buildDir=$directory/build
- makeKrita=on
- makeKarbon=off
- makeWords=off
- makeTables=off
- makeStage=off
- makeKThesaurus=off
- makeKexi=off
- makePlan=off
- makeFlow=off
- makeBraindump=off
- numCores=$((`cat /proc/cpuinfo | grep processor | wc -l`))
- # Number of cores² works best almost always.
- numThreads=$(($numCores*$numCores))
- packageManager=
- if command -v apt-get &>/dev/null ; then
- packageManager=aptget
- elif command -v zypper &>/dev/null ; then
- packageManager=zypper
- else
- echo ":: This script has currently only support for dependency installation on openSUSE and relatives of Debian. You'll need to install the dependencies yourself."
- fi
- project=calligra
- gitRepo=git://anongit.kde.org/$project
- CMakeParameters="-DBUILD_words=$makeWords -DBUILD_tables=$makeTables -DBUILD_stage=$makeStage -DBUILD_kthesaurus=$makeKThesaurus -DBUILD_kexi=$makeKexi -DBUILD_plan=$makePlan -DBUILD_flow=$makeFlow -DBUILD_braindump=$makeBraindump -DBUILD_krita=$makeKrita -DBUILD_karbon=$makeKarbon -DBUILD_koconverter=off -DCMAKE_INSTALL_PREFIX=$instDir -DBUILD_cstester=OFF -DBUILD_koabstraction=OFF -DBUILD_f-office=OFF -DCMAKE_BUILD_TYPE=RelWithDebInfo"
- _install_dependencies_zypper()
- {
- sudo zypper install git
- sudo zypper si -d koffice2 calligra
- }
- _install_dependencies_aptget()
- {
- sudo apt-get install git
- sudo apt-get build-dep koffice2 calligra
- }
- _configure()
- {
- echo ":: Configurating"
- cd $buildDir/$project
- cmake $srcDir/$project $CMakeParameters
- }
- _setup()
- {
- mkdir -p $srcDir/$project
- mkdir -p $buildDir/$project
- mkdir -p $instDir/bin
- cd $srcDir
- echo ":: Starting cloning machine... The source code will be cloned from $gitRepo."
- git clone $gitRepo $project
- if [ -z "$packageManager" ] ; then
- echo ":: Skipping installation of building dependencies, unknown package manager. You will need to do this step manually."
- else
- echo ":: Installing packages required for building, you may be asked for your password. (Maybe even twice.)"
- _install_dependencies_$packageManager
- fi
- _configure
- echo ":: Add newly created paths to ~/.bashrc"
- echo "export KDEDIRS=\$KDEDIRS:$instDir" >> ~/.bashrc
- echo "export PATH=\$PATH:$instDir/bin" >> ~/.bashrc
- }
- _build()
- {
- echo ":: Building"
- cd $buildDir/$project
- make install -j$numThreads
- kbuildsycoca4
- }
- _update()
- {
- cd $srcDir/$project
- git pull origin master
- cmake $buildDir/$project
- }
- echo ":: This script will help you to configure, compile and install the latest non-stable version of $project."
- echo ":: Make sure to remove the stable version of $project before using this script."
- if [ -z "$1" ] ; then
- echo ":: If you run this script for the first time run:"
- echo ":: $0 setup"
- echo ":: It will setup the required build-system in $directory. You want it elsewhere? Then edit this script."
- elif [ "$1" = "setup" ] ; then
- echo ":: Setting up the buildsystem for $project in $directory."
- _setup
- echo ":: Setup finished! Now run"
- echo ":: $0 build"
- echo ":: to configurate the code. (This will be neccesary to build the stuff.)"
- elif [ "$1" = "build" ] ; then
- _build
- echo ":: Now you can simply run the newest versions of the applications by typing the name of it in the konsole. It will also show up in your KMenu, awesome!"
- echo ":: Whenever you need an newer build, type"
- echo ":: $0 update"
- elif [ "$1" = "update" ] ; then
- _update
- _build
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement