-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure
executable file
·159 lines (148 loc) · 3.26 KB
/
configure
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#!/usr/bin/env bash
VERSION=0.3.1
PACKAGE=tomboy
prefix=/usr/local
config=RELEASE_X86
configurations=" DEBUG_X86 RELEASE_X86 APPSTORE_X86"
common_packages=" monomac;0.0.0.0 nunit;2.4"
usage ()
{
echo "Usage : configure [OPTION]... [--config=CONFIG]"
echo
echo "Options:"
echo " --prefix=PREFIX install architecture-independent files in PREFIX"
echo " [/usr/local]"
echo " --bindir=DIR user executables [PREFIX/bin]"
echo " --datadir=DIR read-only architecture-independent data [PREFIX/share]"
echo " --libdir=DIR object code libraries [PREFIX/lib]"
echo
echo "Configurations available :"
for c in $configurations; do
if [ "$c" = "$config" ]; then
echo " $c (Default)"
else
echo " $c"
fi
done
}
validate_config ()
{
test -z "$1" && return 0
for c in $configurations; do
if [ "$c" = "$1" ]; then
return 1
fi
done
return 0
}
check_package ()
{
name=`echo $1 | cut -d\; -f1`
version=`echo $1 | cut -d\; -f2`
echo -n "Checking for package '$name'.." | tee -a config.log
pkg-config --atleast-version=$version $name
if [ $? -ne 0 ]; then
echo " ERROR: Package named '$name' >= $version not found." | tee -a config.log
echo "Try adjusting your PKG_CONFIG_PATH environment variable." | tee -a config.log
return 1
fi
echo " found." | tee -a config.log
}
check_required_packages ()
{
echo "Looking for required packages" | tee config.log
var=required_packages_$config
for pkg in $common_packages ${!var}; do
check_package $pkg
retval=$?
[ $retval -ne 0 ] && return $retval
done
return 0
}
while test x$1 != x; do
case $1 in
--prefix=*)
prefix=`echo $1 | sed 's/--prefix=//'`
;;
--prefix)
shift
prefix=$1
;;
--libdir=*)
libdir=`echo $1 | sed 's/--libdir=//'`
;;
--libdir)
shift
libdir=$1
;;
--bindir=*)
bindir=`echo $1 | sed 's/--bindir=//'`
;;
--bindir)
shift
bindir=$1
;;
--datadir=*)
datadir=`echo $1 | sed 's/--datadir=//'`
;;
--datadir)
shift
datadir=$1
;;
--config=*)
conf=`echo $1 | sed 's/--config=//'`
validate_config "$conf"
if [ $? -eq 1 ]; then
config=$conf
else
echo "Invalid config name - $conf"
usage
exit 1
fi
;;
--help)
usage
exit
;;
*)
echo Unknown argument $1 >&2
usage
exit 1
;;
esac
shift
done
check_required_packages
[ $? -eq 1 ] && exit 1
if [ -z "$libdir" ]; then
libdir=$prefix/lib
fi
if [ -z "$bindir" ]; then
bindir=$prefix/bin
fi
if [ -z "$datadir" ]; then
datadir=$prefix/share
fi
echo "prefix=$prefix" > config.make
echo "libdir=$libdir" >> config.make
echo "bindir=$bindir" >> config.make
echo "datadir=$datadir" >> config.make
echo "RUNTIME=mono" >> config.make
echo "ASSEMBLY_VERSION=$VERSION.0.0" >> config.make
echo "VERSION=$VERSION" >> config.make
echo "PACKAGE=$PACKAGE" >> config.make
echo "CONFIG=$config" >> config.make
echo
echo "$PACKAGE has been configured with "
echo " prefix = $prefix"
if [ "$libdir" != "$prefix/lib" ]; then
echo " libdir = $libdir"
fi
if [ "$bindir" != "$prefix/bin" ]; then
echo " bindir = $bindir"
fi
if [ "$datadir" != "$prefix/share" ]; then
echo " datadir = $datadir"
fi
echo " config = $config"
echo