-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·142 lines (118 loc) · 3.01 KB
/
install.sh
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
##############################
# SrcDoc installation script #
##############################
# VERSION is the number of the library version with nothing prepended
# or appended
VERSION="0.1"
# VERSION_SUFFIX must have a dash ("-") prepended and nothing should be
# appended to the version number
VERSION_SUFFIX="-$VERSION"
function checked_eval()
{
echo $*
if ! eval $* ; then
echo "install.sh: Error - exiting"
exit 3
fi
}
# checks whether $1 command is available
function check_present()
{
eval "$1 --version >/dev/null 2>&1"
if [ $? != 127 ]; then
return 0;
else
return 1;
fi;
}
# processes a directory name in $REPLY; appends a slash if not already present
function process_dirname()
{
REPLY=`eval 'echo -n '$REPLY` # to have path/tidle expansion work
if [ ! ${REPLY:${#REPLY}-1:1} == '/' ]; then
REPLY=$REPLY/
fi
}
if check_present docbook2html; then
DOCBOOK2HTML_PRESENT=1
else
DOCBOOK2HTML_PRESENT=0
fi
if check_present docbook2pdf; then
DOCBOOK2PDF_PRESENT=1
else
DOCBOOK2PDF_PRESENT=0
fi
echo
echo "SrcDoc $VERSION installation script."
echo
echo "See the INSTALL file first."
echo
read -e -p "Enter the directory with PascalAdt 1.0.2 library binaries (default /usr/local/lib/): "
if [ $REPLY ]; then
process_dirname
LIB_DIR=$REPLY
else
LIB_DIR="/usr/local/lib/"
fi
read -e -p "Enter the directory with PascalAdt 1.0.2 .ppu files (default /usr/local/include/): "
if [ $REPLY ]; then
process_dirname
INCLUDE_DIR=$REPLY
else
INCLUDE_DIR="/usr/local/include/"
fi
read -e -p "Enter the target binary directory (default /usr/local/bin/): "
if [ $REPLY ]; then
process_dirname
BIN_DIR=$REPLY
else
BIN_DIR="/usr/local/bin/"
fi
MAKE_HTML=0
if [ $DOCBOOK2HTML_PRESENT == 1 ]; then
read -n 1 -p "Make HTML documentation? (y/n) "
echo
if [ "$REPLY" != "n" ]; then
MAKE_HTML=1
fi
fi
MAKE_PDF=0
if [ $DOCBOOK2PDF_PRESENT == 1 ]; then
read -n 1 -p "Make PDF documentation? (n/y) "
echo
if [ "$REPLY" == "y" ]; then
MAKE_PDF=1
fi
fi
if [ $MAKE_HTML == 1 -o $MAKE_PDF == 1 ]; then
read -e -p "Enter the target documentation directory (default /usr/local/doc/srcdoc/): "
if [ $REPLY ]; then
process_dirname
DOCS_DIR=$REPLY
else
DOCS_DIR="/usr/local/doc/srcdoc"
fi
fi
checked_eval make $1 INCLUDE_DIR=$INCLUDE_DIR LIB_DIR=$LIB_DIR
install srcdoc $BIN_DIR/srcdoc
if [ ! -d $DOCS_DIR ]; then
checked_eval mkdir -p $DOCS_DIR
fi
if [ \( ! -d ${DOCS_DIR}html/ \) -a \( $MAKE_HTML == 1 \) ]; then
checked_eval mkdir -p ${DOCS_DIR}html/
fi
if [ \( ! -d ${DOCS_DIR}pdf/ \) -a \( $MAKE_PDF == 1 \) ]; then
checked_eval mkdir -p ${DOCS_DIR}pdf/
fi
if [ $MAKE_HTML == 1 ]; then
checked_eval docbook2html -o ${DOCS_DIR}html/ docsrc/srcdoc.sgml
fi
if [ $MAKE_PDF == 1 ]; then
checked_eval docbook2pdf -o ${DOCS_DIR}pdf/ docsrc/srcdoc.sgml
fi
echo
echo "Installation finished."
echo
echo "Documentation is available at https://srcdoc.github.io"