Annotate

configure @ 461:fa5c40e5e079

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