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
|
#!/usr/bin/env python
# Copyright 2013 Ben Longbons <b.r.longbons@gmail.com>
#
# This file is part of The Mana World (Athena server)
#
# attoconf is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# attoconf is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with attoconf. If not, see <http://www.gnu.org/licenses/>.
from __future__ import print_function, division, absolute_import
import os
import sys
try:
from attoconf.version import require_version
except ImportError:
sys.exit('attoconf missing - please run: git submodule update --init')
else:
try:
require_version(0, 9)
except SystemExit as e:
e.code += '\nPlease run: git submodule update'
raise
from attoconf.classy import add_slots
from attoconf.lib.c import Cxx
from attoconf.lib.install import Install
from attoconf.lib.config_hash import ConfigHash
from attoconf.lib.templates import Templates
from attoconf.types import enum, filepath
yesno = enum('yes', 'no')
@add_slots
class Configuration(Cxx, Install, ConfigHash, Templates):
def general(self):
super(Configuration, self).general()
home = os.path.expanduser('~')
self.add_alias('--user', ['--prefix=%s' % home, '--enable-rpath=relative'],
help='alias for --prefix=$HOME --enable-rpath=relative', hidden=False)
self.add_alias('--dev', ['--user', '--enable-warnings', '--enable-abi6'],
help=None, hidden=False)
def paths(self):
super(Configuration, self).paths()
self.add_option('--debugdir', init='/.',
type=filepath, check=lambda build, DIR: None,
help='root for split debug files (often /usr/lib/debug)', hidden=False,
help_var='DIR')
def features(self):
super(Configuration, self).features()
self.add_bool_feature('warnings', init='no',
check=lambda build, ENABLE_WARNINGS: None,
help='Enable warnings (for development)')
self.add_bool_feature('abi6', init='no',
check=lambda build, ENABLE_ABI6: None,
help='Force a nonbuggy gcc ABI (for development)')
self.add_bool_feature('cygwin-hacks', init='no',
check=lambda build, ENABLE_CYGWIN_HACKS: None,
help='Work around bugs in certain cygwin versions')
self.add_bool_feature('debug', init='yes',
check=lambda build, ENABLE_DEBUG: None,
help='Install extra files useful for debugging')
self.add_option('--enable-rpath', init='none',
type=enum('none', 'relative', 'absolute'), check=lambda build, ENABLE_RPATH: None,
help='Use rpaths to find libraries', hidden=False)
def vars(self):
super(Configuration, self).vars()
self.add_option('GTEST_DIR', init='/usr/src/gtest',
# http://code.google.com/p/googletest/wiki/FAQ#Why_is_it_not_recommended_to_install_a_pre-compiled_copy_of_Goog
type=filepath, check=lambda build, GTEST_DIR: None,
help='Location of Google Test sources, must contain src/gtest-all.cc (linking to a precompiled library is NOT supported)', hidden=False)
def add_bool_feature(self, arg, hidden=False, **kwargs):
positive = '--enable-' + arg
negative = '--disable-' + arg
self.add_option(positive, type=yesno, hidden=hidden, **kwargs)
# TODO: instead reveal one of the aliases and hide the main
# this requires messing with help slightly
self.add_alias(positive, [positive + '=yes'], help=None, hidden=True)
self.add_alias(negative, [positive + '=no'], help=None, hidden=True)
def main():
srcdir = os.path.dirname(sys.argv[0])
proj = Configuration(
srcdir=srcdir,
package='tmwa',
package_name='The Mana World (Athena server)',
template_files=['Makefile'],
)
proj.jiggle()
build = proj.build('.')
build.configure(sys.argv[1:], os.environ)
if __name__ == '__main__':
main()
|