template_install.sh 3.86 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh
# this is <install.sh>
# ----------------------------------------------------------------------------
# $Id$
# 
# Copyright (c) 2013 by Thomas Forbriger (BFO Schiltach) 
# 
# compile and install package
# 
# REVISIONS and CHANGES 
#    23/10/2013   V1.0   Thomas Forbriger
# 
# ============================================================================
14
# the following part of install.sh is independent of the actual package
15
# ---------------------------------------------------------------------
thomas.forbriger's avatar
thomas.forbriger committed
16
#
thomas.forbriger's avatar
thomas.forbriger committed
17
18
19
20
21
22
# shell function to report variables
repvar()
{
  found=$(printenv $1 | wc -l)
  if test $found -gt 0
  then
thomas.forbriger's avatar
thomas.forbriger committed
23
    echo "  $1=$(printenv $1)"
thomas.forbriger's avatar
thomas.forbriger committed
24
  else
thomas.forbriger's avatar
thomas.forbriger committed
25
    echo "  not set: $1"
thomas.forbriger's avatar
thomas.forbriger committed
26
27
28
29
    return 2
  fi
}
#
30
echo '******* install.sh $Revision$ *******'
thomas.forbriger's avatar
thomas.forbriger committed
31
#
32
33
34
35
36
37
38
39
cd $(dirname $0)
SRCROOT=$(pwd)
if test ! -x $SRCROOT/install.sh
then
  echo "ERROR: $SRCROOT/install.sh is missing"
  echo "       call install.sh from within the directory in which it is located"
  exit 2
fi
thomas.forbriger's avatar
thomas.forbriger committed
40
41
42
# report to user
echo "This is $SRCROOT/install.sh"
echo "going to install a snapshot package from TFSoftware."
thomas.forbriger's avatar
thomas.forbriger committed
43
echo "See also: README.1st"
thomas.forbriger's avatar
thomas.forbriger committed
44
45
# read environment variables
echo
thomas.forbriger's avatar
thomas.forbriger committed
46
echo "Reading environment variable settings from ./install.bashrc"
thomas.forbriger's avatar
thomas.forbriger committed
47
echo "(you may adjust ./install.bashrc to your needs)."
48
# target directories are defined in install.bashrc
thomas.forbriger's avatar
thomas.forbriger committed
49
50
test -s ./install.bashrc && . ./install.bashrc || \
  {
thomas.forbriger's avatar
thomas.forbriger committed
51
    echo
thomas.forbriger's avatar
thomas.forbriger committed
52
53
54
55
56
    echo "./install.bashrc returned with a non-zero exit status."
    echo "It apparently failed to set environment variables."
    echo "aborting $0..."; exit 2
  }
# test and report environment variables
thomas.forbriger's avatar
thomas.forbriger committed
57
echo
thomas.forbriger's avatar
thomas.forbriger committed
58
59
60
61
echo "Environment variables used in TFSoftware Makefiles as found in your"
echo "shell environment or set by ./install.bashrc (not all of them might"
echo "be required for the current package):"
MISSING=0
62
MISSVAR=""
63
64
echo
echo "Following variables are used by all packages!:"
thomas.forbriger's avatar
thomas.forbriger committed
65
66
67
repvar LOCBINDIR || { MISSING=1; MISSVAR="$MISSVAR LOCBINDIR"; }
repvar LOCLIBDIR || { MISSING=1; MISSVAR="$MISSVAR LOCLIBDIR"; }
repvar LOCINCLUDEDIR || { MISSING=1; MISSVAR="$MISSVAR LOCINCLUDEDIR"; }
68
69
70
71
72
73
74
75
76
77
78
if test 0$MISSING -gt 0
then
	echo
	echo 'WARNING!'
	echo "The following variables are not set:"
	echo $MISSVAR | fold -w 70 -s | sed -e "s/^/  /"
fi
MISSING=0
MISSVAR=""
echo
echo "Following variables might be set automatically if missing:"
thomas.forbriger's avatar
thomas.forbriger committed
79
80
81
repvar CC || { MISSING=1; MISSVAR="$MISSVAR CC"; }
repvar CXX || { MISSING=1; MISSVAR="$MISSVAR CXX"; }
repvar FC || { MISSING=1; MISSVAR="$MISSVAR FC"; }
82
83
84
85
86
87
88
89
90
91
92
93
if test 0$MISSING -gt 0
then
	echo
	echo 'WARNING!'
	echo "The following variables are not set:"
	echo $MISSVAR | fold -w 70 -s | sed -e "s/^/  /"
fi
MISSING=0
MISSVAR=""
echo
echo "Following variables are optional or not used by all packages:"
echo "(check README.compile for their purpose)"
thomas.forbriger's avatar
thomas.forbriger committed
94
95
repvar TF_LINK_FORTRAN || { MISSING=1; MISSVAR="$MISSVAR TF_LINK_FORTRAN"; }
repvar TF_LINK_PGPLOT || { MISSING=1; MISSVAR="$MISSVAR TF_LINK_PGPLOT"; }
96
repvar PGPLOT_DIR || { MISSING=1; MISSVAR="$MISSVAR PGPLOT_DIR"; }
thomas.forbriger's avatar
thomas.forbriger committed
97
98
99
repvar TF_WWWBASEDIR || { MISSING=1; MISSVAR="$MISSVAR TF_WWWBASEDIR"; }
repvar TF_BROWSER || { MISSING=1; MISSVAR="$MISSVAR TF_BROWSER"; }
repvar LD_LIBRARY_PATH || { MISSING=1; MISSVAR="$MISSVAR LD_LIBRARY_PATH"; }
thomas.forbriger's avatar
thomas.forbriger committed
100
101
if test 0$MISSING -gt 0
then
102
103
104
105
	echo
	echo 'WARNING!'
	echo "The following variables are not set:"
	echo $MISSVAR | fold -w 70 -s | sed -e "s/^/  /"
thomas.forbriger's avatar
thomas.forbriger committed
106
107
108
fi
if test 0$(printenv LD_LIBRARY_PATH | tr ':' '\n' | grep $LOCLIBDIR | wc -l) -lt 1
then
thomas.forbriger's avatar
thomas.forbriger committed
109
  echo
110
  echo 'WARNING!'
thomas.forbriger's avatar
thomas.forbriger committed
111
112
  echo "$LOCLIBDIR"
  echo "is not present in variable LD_LIBRARY_PATH!"
thomas.forbriger's avatar
thomas.forbriger committed
113
114
115
116
117
  echo "The binary executables being compiled, linked against dynamic"
  echo "libraries in $LOCLIBDIR,"
  echo "and installed in $LOCBINDIR"
  echo "probably will fail to execute. Please check README.compile"
  echo "if in doubt."
thomas.forbriger's avatar
thomas.forbriger committed
118
fi
119
120
# ============================================================================
# package specific contents are added below this line
121
# ---------------------------------------------------