2018-12-14 09:17:36 +00:00
|
|
|
from conans import ConanFile
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
# Thanks stackoverflow: https://stackoverflow.com/a/3041990
|
|
|
|
|
def query_yes_no(question, default="yes"):
|
|
|
|
|
"""Ask a yes/no question via raw_input() and return their answer.
|
|
|
|
|
|
|
|
|
|
"question" is a string that is presented to the user.
|
|
|
|
|
"default" is the presumed answer if the user just hits <Enter>.
|
|
|
|
|
It must be "yes" (the default), "no" or None (meaning
|
|
|
|
|
an answer is required of the user).
|
|
|
|
|
|
|
|
|
|
The "answer" return value is True for "yes" or False for "no".
|
|
|
|
|
"""
|
|
|
|
|
valid = {"yes": True, "y": True, "ye": True,
|
|
|
|
|
"no": False, "n": False}
|
|
|
|
|
if default is None:
|
|
|
|
|
prompt = " [y/n] "
|
|
|
|
|
elif default == "yes":
|
|
|
|
|
prompt = " [Y/n] "
|
|
|
|
|
elif default == "no":
|
|
|
|
|
prompt = " [y/N] "
|
|
|
|
|
else:
|
|
|
|
|
raise ValueError("invalid default answer: '%s'" % default)
|
|
|
|
|
|
2019-01-17 23:14:36 +00:00
|
|
|
global input
|
|
|
|
|
try: input = raw_input
|
|
|
|
|
except NameError: pass
|
|
|
|
|
|
2018-12-14 09:17:36 +00:00
|
|
|
while True:
|
|
|
|
|
sys.stdout.write(question + prompt)
|
2019-01-17 23:14:36 +00:00
|
|
|
choice = input().lower()
|
2018-12-14 09:17:36 +00:00
|
|
|
if default is not None and choice == '':
|
|
|
|
|
return valid[default]
|
|
|
|
|
elif choice in valid:
|
|
|
|
|
return valid[choice]
|
|
|
|
|
else:
|
|
|
|
|
sys.stdout.write("Please respond with 'yes' or 'no' "
|
|
|
|
|
"(or 'y' or 'n').\n")
|
|
|
|
|
|
|
|
|
|
class DecafConan(ConanFile):
|
|
|
|
|
generators = "cmake"
|
|
|
|
|
settings = 'os'
|
|
|
|
|
options = {
|
2018-12-15 14:43:00 +00:00
|
|
|
'silent': [True, False],
|
|
|
|
|
'ffmpeg': [True, False],
|
|
|
|
|
'curl': [True, False],
|
|
|
|
|
'openssl': [True, False],
|
|
|
|
|
'sdl2': [True, False],
|
|
|
|
|
'zlib': [True, False],
|
2019-12-17 11:29:44 +00:00
|
|
|
'libuv': [True, False],
|
|
|
|
|
'cares': [True, False],
|
2018-12-14 09:17:36 +00:00
|
|
|
}
|
|
|
|
|
default_options = {
|
2018-12-15 14:43:00 +00:00
|
|
|
'silent': False,
|
|
|
|
|
'ffmpeg': True,
|
|
|
|
|
'curl': True,
|
|
|
|
|
'openssl': True,
|
|
|
|
|
'sdl2': True,
|
|
|
|
|
'zlib': True,
|
2019-12-17 11:29:44 +00:00
|
|
|
'libuv': True,
|
|
|
|
|
'cares': True,
|
2018-12-14 09:17:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def requirements(self):
|
|
|
|
|
dependency_list = [
|
2020-04-11 12:22:34 +01:00
|
|
|
('c-ares/1.15.0', 'yes' if self.options.cares else 'no'),
|
|
|
|
|
('libcurl/7.69.1', 'yes' if self.options.curl else 'no'),
|
|
|
|
|
('libuv/1.34.2', 'yes' if self.options.libuv else 'no'),
|
2021-07-18 10:19:09 +01:00
|
|
|
('openssl/1.1.1h', 'yes' if self.options.openssl else 'no'),
|
2021-07-17 15:11:48 +01:00
|
|
|
('sdl/2.0.14', 'yes' if self.options.sdl2 else 'no'),
|
2019-12-17 11:29:44 +00:00
|
|
|
('zlib/1.2.11', 'yes' if self.options.zlib else 'no'),
|
2018-12-14 09:17:36 +00:00
|
|
|
]
|
2019-11-05 22:34:41 +00:00
|
|
|
overrides = [
|
2021-07-18 10:19:09 +01:00
|
|
|
'openssl/1.1.1h',
|
2019-12-17 11:29:44 +00:00
|
|
|
'zlib/1.2.11',
|
2019-11-05 22:34:41 +00:00
|
|
|
]
|
2018-12-14 09:17:36 +00:00
|
|
|
|
2018-12-18 14:30:53 -08:00
|
|
|
print('Enabled dependencies:')
|
2018-12-15 14:43:00 +00:00
|
|
|
for dependency, enabled in dependency_list:
|
|
|
|
|
if enabled == 'yes':
|
2018-12-18 14:30:53 -08:00
|
|
|
print("%s" % (dependency))
|
|
|
|
|
print('')
|
2018-12-14 09:17:36 +00:00
|
|
|
|
2018-12-18 14:30:53 -08:00
|
|
|
print('Disabled dependencies:')
|
2018-12-15 14:43:00 +00:00
|
|
|
for dependency, enabled in dependency_list:
|
|
|
|
|
if enabled == 'no':
|
2018-12-18 14:30:53 -08:00
|
|
|
print("%s" % (dependency))
|
|
|
|
|
print('')
|
2018-12-14 09:17:36 +00:00
|
|
|
|
2018-12-15 14:43:00 +00:00
|
|
|
silent = self.options.silent
|
|
|
|
|
if not silent:
|
|
|
|
|
silent = not query_yes_no('Customise which dependencies to acquire from Conan?', default='no')
|
2018-12-14 09:17:36 +00:00
|
|
|
|
2018-12-15 14:43:00 +00:00
|
|
|
for dependency, enabled in dependency_list:
|
|
|
|
|
if (silent and enabled == 'yes') or \
|
|
|
|
|
(not silent and query_yes_no(dependency, default=enabled)):
|
2019-11-05 22:34:41 +00:00
|
|
|
if dependency in overrides:
|
|
|
|
|
self.requires(dependency, override=True)
|
|
|
|
|
else:
|
|
|
|
|
self.requires(dependency)
|