-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure
executable file
·63 lines (54 loc) · 2.33 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
#!/usr/bin/env python
import os, grp
import socket
import imp
mk = imp.load_source('mk', 'build/priv/scripts/mk')
from argparse import ArgumentParser, RawDescriptionHelpFormatter
DESC="""
Configures this package to adapt to many kinds of systems.\n
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.\n
"""
EPILOGUE="""
The ERL_LIBS environment variable needs to include this (top level) directory
if you're planning to use the generated Makefile(s) to compile/build this
software. Use the supplied `setenv.sh' script in this case.
"""
HOST_HELPSTRING="""
The fully qualified host name of the target (for install) machine.\n
NB: this doesn't have to be the name of the host on which you're
building and/or configuring the sources.
"""
def configure(opts, args):
output = mk.Writer(opts)
output.show_stage('CONFIGURE', 'Generating Makefile(s)')
# TODO: use mk.release_directory(opts) + '*'
src = os.sep.join([mk.release_directory(opts), '*'])
targ = os.sep.join([opts.prefix, 'nodewatch'])
if opts.localdeps:
lcl = '-l'
else:
lcl = ''
if opts.verbose:
lcl += " -v"
make_vars = dict(map(lambda a: (a, getattr(opts, a)), ['user', 'group']) +
[('source', src), ('target', targ), ('local', lcl)])
mk.template('Makefile.in', 'Makefile', make_vars)
if __name__ == '__main__':
parser = mk.default_options(description=DESC,
epilog=EPILOGUE,
usage=mk.USAGE,
version='configure v%s' % mk.VSN)
parser.add_option('--prefix',
default='/opt',
help='install architecture-independent files in PREFIX')
parser.add_option('-u', '--with-user',
default=os.getlogin(), dest='user', type="string",
help='Normalise ownership permissions for USER')
parser.add_option('-g', '--with-group', dest='group', type="string",
default=grp.getgrgid(os.getegid()).gr_name,
help='Normalise ownership permissions for GROUP')
parser.add_option('-n', '--hostname',
default=socket.getfqdn(),
help=HOST_HELPSTRING)
configure(*parser.parse_args())