| 1 | #!/bin/bash |
|---|
| 2 | # |
|---|
| 3 | # Installs tools and libraries needed to run, compile or develop ARB on Ubuntu. |
|---|
| 4 | # |
|---|
| 5 | # Tested with: |
|---|
| 6 | # * Ubuntu 16.04 (Xenial Xerus) |
|---|
| 7 | # |
|---|
| 8 | # Previous version of this script is available at |
|---|
| 9 | # http://bugs.arb-home.de/export/14409/trunk/SH/arb_installubuntu4arb.sh |
|---|
| 10 | # |
|---|
| 11 | # [ May as well work with other ubuntu flavors or debian. |
|---|
| 12 | # Please report working tests and/or send needed changes to devel@arb-home.de |
|---|
| 13 | # ] |
|---|
| 14 | |
|---|
| 15 | listwords() { |
|---|
| 16 | if [ ! -z "$1" ]; then |
|---|
| 17 | echo " $1" |
|---|
| 18 | shift |
|---|
| 19 | listwords $* |
|---|
| 20 | fi |
|---|
| 21 | } |
|---|
| 22 | |
|---|
| 23 | if [ -z "$1" ]; then |
|---|
| 24 | echo "" |
|---|
| 25 | echo "Usage: arb_installubuntu4arb.sh what" |
|---|
| 26 | echo "" |
|---|
| 27 | echo "what installs" |
|---|
| 28 | echo "" |
|---|
| 29 | echo "arb_noOpenGL things needed to run the Non-openGL-version of ARB" |
|---|
| 30 | echo "arb_OpenGL things needed to run the openGL-version of ARB" |
|---|
| 31 | echo "" |
|---|
| 32 | echo "compile_noOpenGL things needed to compile and run the Non-openGL-version of ARB" |
|---|
| 33 | echo "compile_OpenGL things needed to compile and run the openGL-version of ARB" |
|---|
| 34 | echo "" |
|---|
| 35 | echo "develop install 'compile_OpenGL' plus some optional development tools" |
|---|
| 36 | echo "devdox install 'develop' plus things needed for doxygen (big)" |
|---|
| 37 | echo "" |
|---|
| 38 | else |
|---|
| 39 | ARB_PACKAGES=/tmp/$USER.arb_installubuntu4arb |
|---|
| 40 | if [ "$1" == "echo" ]; then |
|---|
| 41 | if [ "$2" == "arb_noOpenGL" ]; then |
|---|
| 42 | echo \ |
|---|
| 43 | gnuplot \ |
|---|
| 44 | gv \ |
|---|
| 45 | libmotif-common \ |
|---|
| 46 | libxerces-c3.1 \ |
|---|
| 47 | transfig \ |
|---|
| 48 | xterm \ |
|---|
| 49 | |
|---|
| 50 | # treetool |
|---|
| 51 | |
|---|
| 52 | elif [ "$2" == "arb_OpenGL" ]; then |
|---|
| 53 | $0 echo arb_noOpenGL |
|---|
| 54 | echo \ |
|---|
| 55 | libpng12-0 \ |
|---|
| 56 | |
|---|
| 57 | elif [ "$2" == "compile_common" ]; then |
|---|
| 58 | echo \ |
|---|
| 59 | g++ \ |
|---|
| 60 | libglib2.0-dev \ |
|---|
| 61 | libmotif-dev \ |
|---|
| 62 | libreadline-dev \ |
|---|
| 63 | libtiff5-dev \ |
|---|
| 64 | libx11-dev \ |
|---|
| 65 | libxaw7-dev \ |
|---|
| 66 | libxext-dev \ |
|---|
| 67 | libxerces-c-dev \ |
|---|
| 68 | libxml2-utils \ |
|---|
| 69 | libxpm-dev \ |
|---|
| 70 | libxt-dev \ |
|---|
| 71 | lynx \ |
|---|
| 72 | x11proto-print-dev \ |
|---|
| 73 | xsltproc \ |
|---|
| 74 | xutils-dev \ |
|---|
| 75 | |
|---|
| 76 | elif [ "$2" == "compile_noOpenGL" ]; then |
|---|
| 77 | $0 echo arb_noOpenGL |
|---|
| 78 | $0 echo compile_common |
|---|
| 79 | |
|---|
| 80 | elif [ "$2" == "compile_OpenGL" ]; then |
|---|
| 81 | $0 echo arb_OpenGL |
|---|
| 82 | $0 echo compile_common |
|---|
| 83 | echo \ |
|---|
| 84 | freeglut3-dev \ |
|---|
| 85 | libglew-dev \ |
|---|
| 86 | libpng12-dev \ |
|---|
| 87 | |
|---|
| 88 | echo \ |
|---|
| 89 | libglw-mesa-arb \ |
|---|
| 90 | >> $ARB_PACKAGES |
|---|
| 91 | |
|---|
| 92 | elif [ "$2" == "develop" ]; then |
|---|
| 93 | $0 echo compile_OpenGL |
|---|
| 94 | echo \ |
|---|
| 95 | valgrind \ |
|---|
| 96 | pixmap \ |
|---|
| 97 | exuberant-ctags \ |
|---|
| 98 | |
|---|
| 99 | elif [ "$2" == "devdox" ]; then |
|---|
| 100 | $0 echo develop |
|---|
| 101 | echo \ |
|---|
| 102 | doxygen \ |
|---|
| 103 | texlive-latex-base \ |
|---|
| 104 | texlive-base-bin \ |
|---|
| 105 | |
|---|
| 106 | else |
|---|
| 107 | echo error_unknown_target_$2 |
|---|
| 108 | fi |
|---|
| 109 | else |
|---|
| 110 | echo "Ubuntu for ARB installer" |
|---|
| 111 | test -f $ARB_PACKAGES && rm $ARB_PACKAGES |
|---|
| 112 | PACKAGES=`$0 echo $1` |
|---|
| 113 | ALLPACKAGES=`echo $PACKAGES;test -f $ARB_PACKAGES && cat $ARB_PACKAGES` |
|---|
| 114 | echo "Packages needed for '$1': `echo $ALLPACKAGES | wc -w`" |
|---|
| 115 | # listwords $PACKAGES |
|---|
| 116 | |
|---|
| 117 | echo '-------------------- [apt start]' |
|---|
| 118 | apt-get -y install $PACKAGES |
|---|
| 119 | echo '-------------------- [apt end]' |
|---|
| 120 | |
|---|
| 121 | if [ -f $ARB_PACKAGES ]; then |
|---|
| 122 | echo "Packages provided by ARB developers: `cat $ARB_PACKAGES | wc -w`" |
|---|
| 123 | listwords `cat $ARB_PACKAGES` |
|---|
| 124 | DISTRIB=`cat /etc/lsb-release | grep DISTRIB_CODENAME | perl -npe 's/^.*=//'` |
|---|
| 125 | SOURCE="deb http://dev.arb-home.de/debian $DISTRIB non-free" |
|---|
| 126 | echo '-------------------- [apt start]' |
|---|
| 127 | apt-get install \ |
|---|
| 128 | `cat $ARB_PACKAGES` \ |
|---|
| 129 | || ( \ |
|---|
| 130 | echo "-----------------------------------------" ;\ |
|---|
| 131 | echo "Install of arb-specific libraries failed!" ;\ |
|---|
| 132 | echo "Did you add the line" ;\ |
|---|
| 133 | echo "$SOURCE" ;\ |
|---|
| 134 | echo "to /etc/apt/sources.list, e.g. using" ;\ |
|---|
| 135 | echo "" ;\ |
|---|
| 136 | echo "sudo apt-add-repository '$SOURCE'" ;\ |
|---|
| 137 | echo "sudo apt-get update" ;\ |
|---|
| 138 | echo "???" ;\ |
|---|
| 139 | ) |
|---|
| 140 | echo '-------------------- [apt end]' |
|---|
| 141 | fi |
|---|
| 142 | test -f $ARB_PACKAGES && rm $ARB_PACKAGES |
|---|
| 143 | fi |
|---|
| 144 | fi |
|---|