[e9e2f9]: simple-setup.sh Maximize Restore History

Download this file

simple-setup.sh    123 lines (79 with data), 2.5 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/sh
# we like to debug
set -x
# settings for the script
BUILD_DIRECTORY="./simple-build/"
INSTALL_DIRECTORY="./simple-install/"
BUILD_PARALLEL_JOBS_NUMBER=4
# internal variables
INSTALL_DIR_ABSOLUTE="$PWD/$INSTALL_DIRECTORY"
echo $INSTALL_DIR_ABSOLUTE
PATH_SETUP_SCRIPT="$INSTALL_DIR_ABSOLUTE/bin/ktechlab-paths.sh"
LAUNCHER_SCRIPT="$INSTALL_DIR_ABSOLUTE/bin/ktechlab-launch.sh"
USER_SETUP_SCRIPT="$INSTALL_DIR_ABSOLUTE/bin/ktechlab-user-setup.sh"
#
echo "Script for building KTechLab in a simple way"
# check for CMakeLists.txt, for verifying if we are in the correct directory
if [ ! -e CMakeLists.txt ]
then
echo "Can't find CMakeLists.txt. Is the current directory "\
"KTechLab's source directory?" ;
echo "Exiting" ;
exit 1 ;
fi
# create the build directory
mkdir -p "$BUILD_DIRECTORY"
# create installation directory
mkdir -p "$INSTALL_DIRECTORY"
# go to the newly created build directory
cd "$BUILD_DIRECTORY"
# configure the build
cmake .. -DCMAKE_BUILD_TYPE=debugfull \
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR_ABSOLUTE"
# check for errors
if [ "$?" -eq "0" ]
then
echo "Buildsystem generation done."
else
echo "Buildsystem generation failed. Exiting."
exit 2;
fi
# build the stuff
make -j$BUILD_PARALLEL_JOBS_NUMBER
# check for errors
if [ "$?" -eq "0" ]
then
echo "Build done."
else
echo "Build failed. Exiting."
exit 3;
fi
# install
make install
# check for errors
if [ "$?" -eq "0" ]
then
echo "Install done."
else
echo "Install failed. Exiting."
exit 4;
fi
# create a setup script
echo "!/bin/sh" > $PATH_SETUP_SCRIPT
echo "export PATH=$INSTALL_DIR_ABSOLUTE/bin:$PATH" >> $PATH_SETUP_SCRIPT
echo "export LD_LIBRARY_PATH=$INSTALL_DIR_ABSOLUTE/lib/kde4:$INSTALL_DIR_ABSOLUTE/lib:$LD_LIBRARY_PATH" >> $PATH_SETUP_SCRIPT
echo "export XDG_DATA_DIRS=$INSTALL_DIR_ABSOLUTE/share:$XDG_DATA_DIRS" >> $PATH_SETUP_SCRIPT
echo "export QT_PLUGIN_PATH=$INSTALL_DIR_ABSOLUTE/lib/kde4:$QT_PLUGIN_PATH" >> "$PATH_SETUP_SCRIPT"
echo "export KDEDIRS=$INSTALL_DIR_ABSOLUTE:$KDEDIRS" >> $PATH_SETUP_SCRIPT
# create launcher script
echo "!/bin/sh" > $LAUNCHER_SCRIPT
echo ". $PATH_SETUP_SCRIPT" >> $LAUNCHER_SCRIPT
echo "ktechlab" >> $LAUNCHER_SCRIPT
# create user setup script
echo "!/bin/sh" > $USER_SETUP_SCRIPT
echo ". $PATH_SETUP_SCRIPT" >> $USER_SETUP_SCRIPT
echo "kbuildsycoca4" >> $USER_SETUP_SCRIPT
echo "update-mime-database $INSTALL_DIR_ABSOLUTE/share/mime" >> $USER_SETUP_SCRIPT
# run initial user setup
sh $USER_SETUP_SCRIPT
# done