configure

changeset 371
88bcf9fbdd07
child 416
92ce569b9b73
equal deleted inserted replaced
370:75e7917761c0 371:88bcf9fbdd07
1 #!/bin/sh
2
3 SQUISH=./buildscripts/squish
4 PROSODY_URL=https://hg.prosody.im/0.9/raw-file/tip/
5 PREFIX="/usr/local"
6
7 LUA_VERSION=5.1
8 LUA_INTERPRETER=lua$LUA_VERSION
9
10 if which $LUA_INTERPRETER>/dev/null; then
11 LUA_DIR=$($LUA_INTERPRETER -e 'print((package.path:match("'"${PREFIX}"'[^;]+%?%.lua"):gsub("/%?%.lua$", "")))')
12 else
13 LUA_DIR="$PREFIX/share/lua/$LUA_VERSION"
14 fi
15
16 # Help
17
18 show_help() {
19 cat <<EOF
20 Configure Prosody prior to building.
21
22 --help This help.
23 --prefix Installation path prefix (used when installing)
24 Default: $PREFIX
25 --lua-lib-dir=DIR You can also specify Lua's libraries dir.
26 Default: $LUA_DIR
27 --squish Path to squish utility (used for building)
28 Default: $SQUISH
29 --prosody-rev Prosody revision to pull files from
30 Default: tip
31 --prosody-url URL to pull Prosody files from (not compatible with --prosody-rev)
32 Default: $PROSODY_URL
33 EOF
34 }
35
36
37 while [ "$1" ]
38 do
39 value="`echo $1 | sed 's/[^=]*=\(.*\)/\1/'`"
40 if echo "$value" | grep -q "~"
41 then
42 echo
43 echo '*WARNING*: the "~" sign is not expanded in flags.'
44 echo 'If you mean the home directory, use $HOME instead.'
45 echo
46 fi
47 case "$1" in
48 --help)
49 show_help
50 exit 0
51 ;;
52 --lua-lib-dir=*)
53 LUA_LIBDIR="$value"
54 ;;
55 --with-squish=*)
56 SQUISH="$value"
57 ;;
58 --prosody-rev=*)
59 PROSODY_REV="$value"
60 PROSODY_REV_SET=yes
61 ;;
62 --prosody-url=*)
63 PROSODY_URL="$value"
64 PROSODY_URL_SET=yes
65 ;;
66 *)
67 echo "Error: Unknown flag: $1"
68 exit 1
69 ;;
70 esac
71 shift
72 done
73
74 # Sanity-check options
75
76 if ! test -x "$SQUISH"; then
77 echo "FATAL: Unable to find/use squish: $SQUISH";
78 exit 1;
79 fi
80
81 if [ "$PROSODY_URL_SET" = "yes" -a "$PROSODY_REV_SET" = "yes" ]; then
82 echo "FATAL: You can only specify one of --prosody-rev and --prosody-url, not both"
83 exit 1;
84 fi
85
86 if [ "$PROSODY_REV_SET" = "yes" ]; then
87 PROSODY_URL="https://hg.prosody.im/trunk/raw-file/${PROSODY_REV}/"
88 fi
89
90 cat <<EOF >config.unix
91
92 # This file was automatically generated by the configure script.
93 # Run "./configure --help" for details.
94
95 SQUISH=./buildscripts/squish
96 PROSODY_URL=$PROSODY_URL
97 LUA_DIR=$LUA_DIR
98 EOF
99
100 echo
101 echo "Using squish from: $SQUISH"
102 echo "Installing verse.lua to: $LUA_DIR"
103 echo "Fetching Prosody files from: $PROSODY_URL"
104 echo
105 echo "Configured successfully. Please run 'make' to proceed."

mercurial