3
3
"""
4
4
Configuration program for botan
5
5
6
- (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017 Jack Lloyd
6
+ (C) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018 Jack Lloyd
7
7
(C) 2015,2016,2017 Simon Warta (Kullo GmbH)
8
8
9
9
Botan is released under the Simplified BSD License (see license.txt)
@@ -411,6 +411,9 @@ def process_command_line(args): # pylint: disable=too-many-locals
411
411
build_group .add_option ('--with-external-libdir' , metavar = 'DIR' , default = '' ,
412
412
help = 'use DIR for external libs' )
413
413
414
+ build_group .add_option ('--with-sysroot-dir' , metavar = 'DIR' , default = '' ,
415
+ help = 'use DIR for system root while cross-compiling' )
416
+
414
417
build_group .add_option ('--with-openmp' , default = False , action = 'store_true' ,
415
418
help = 'enable use of OpenMP' )
416
419
@@ -460,6 +463,12 @@ def process_command_line(args): # pylint: disable=too-many-locals
460
463
build_group .add_option ('--with-fuzzer-lib' , metavar = 'LIB' , default = None , dest = 'fuzzer_lib' ,
461
464
help = 'additionally link in LIB' )
462
465
466
+ build_group .add_option ('--test-mode' , action = 'store_true' , default = False ,
467
+ help = optparse .SUPPRESS_HELP )
468
+
469
+ build_group .add_option ('--with-debug-asserts' , action = 'store_true' , default = False ,
470
+ help = optparse .SUPPRESS_HELP )
471
+
463
472
docs_group = optparse .OptionGroup (parser , 'Documentation Options' )
464
473
465
474
docs_group .add_option ('--with-documentation' , action = 'store_true' ,
@@ -677,7 +686,7 @@ def py_var(group):
677
686
for (key , val ) in name_val_pairs .items ():
678
687
out .__dict__ [key ] = val
679
688
680
- def lexed_tokens (): # Convert to an interator
689
+ def lexed_tokens (): # Convert to an iterator
681
690
while True :
682
691
token = lexer .get_token ()
683
692
if token != lexer .eof :
@@ -1055,6 +1064,7 @@ def __init__(self, infofile):
1055
1064
'output_to_exe' : '-o ' ,
1056
1065
'add_include_dir_option' : '-I' ,
1057
1066
'add_lib_dir_option' : '-L' ,
1067
+ 'add_sysroot_option' : '' ,
1058
1068
'add_lib_option' : '-l' ,
1059
1069
'add_framework_option' : '-framework ' ,
1060
1070
'preproc_flags' : '-E' ,
@@ -1080,6 +1090,7 @@ def __init__(self, infofile):
1080
1090
self .add_include_dir_option = lex .add_include_dir_option
1081
1091
self .add_lib_dir_option = lex .add_lib_dir_option
1082
1092
self .add_lib_option = lex .add_lib_option
1093
+ self .add_sysroot_option = lex .add_sysroot_option
1083
1094
self .ar_command = lex .ar_command
1084
1095
self .ar_options = lex .ar_options
1085
1096
self .ar_output_to = lex .ar_output_to
@@ -1756,6 +1767,13 @@ def configure_command_line():
1756
1767
def cmake_escape (s ):
1757
1768
return s .replace ('(' , '\\ (' ).replace (')' , '\\ )' )
1758
1769
1770
+ def sysroot_option ():
1771
+ if options .with_sysroot_dir == '' :
1772
+ return ''
1773
+ if cc .add_sysroot_option == '' :
1774
+ logging .error ("This compiler doesn't support --sysroot option" )
1775
+ return cc .add_sysroot_option + options .with_sysroot_dir
1776
+
1759
1777
def ar_command ():
1760
1778
if options .ar_command :
1761
1779
return options .ar_command
@@ -1789,6 +1807,11 @@ def join_with_build_dir(path):
1789
1807
return path
1790
1808
return os .path .join (build_dir , path )
1791
1809
1810
+ def shared_lib_uses_symlinks ():
1811
+ if options .os in ['windows' , 'openbsd' ]:
1812
+ return False
1813
+ return True
1814
+
1792
1815
variables = {
1793
1816
'version_major' : Version .major (),
1794
1817
'version_minor' : Version .minor (),
@@ -1848,11 +1871,13 @@ def join_with_build_dir(path):
1848
1871
'makefile_path' : os .path .join (build_paths .build_dir , '..' , 'Makefile' ),
1849
1872
1850
1873
'build_static_lib' : options .build_static_lib ,
1874
+ 'build_shared_lib' : options .build_shared_lib ,
1875
+
1851
1876
'build_fuzzers' : options .build_fuzzers ,
1852
1877
1853
- 'build_shared_lib' : options .build_shared_lib ,
1854
- 'build_unix_shared_lib' : options . build_shared_lib and options . compiler != 'msvc' ,
1855
- 'build_msvc_shared_lib ' : options .build_shared_lib and options . compiler == 'msvc' ,
1878
+ 'build_coverage' : options .with_coverage_info or options . with_coverage ,
1879
+
1880
+ 'symlink_shared_lib ' : options .build_shared_lib and shared_lib_uses_symlinks () ,
1856
1881
1857
1882
'libobj_dir' : build_paths .libobj_dir ,
1858
1883
'cliobj_dir' : build_paths .cliobj_dir ,
@@ -1897,6 +1922,7 @@ def join_with_build_dir(path):
1897
1922
'dash_c' : cc .compile_flags ,
1898
1923
1899
1924
'cc_lang_flags' : cc .cc_lang_flags (),
1925
+ 'cc_sysroot' : sysroot_option (),
1900
1926
'cc_compile_flags' : options .cxxflags or cc .cc_compile_flags (options ),
1901
1927
'ldflags' : options .ldflags or '' ,
1902
1928
'cc_warning_flags' : cc .cc_warning_flags (options ),
@@ -1940,7 +1966,8 @@ def join_with_build_dir(path):
1940
1966
1941
1967
'with_valgrind' : options .with_valgrind ,
1942
1968
'with_openmp' : options .with_openmp ,
1943
- 'with_debug_asserts' : options .debug_mode ,
1969
+ 'with_debug_asserts' : options .with_debug_asserts ,
1970
+ 'test_mode' : options .test_mode ,
1944
1971
1945
1972
'mod_list' : sorted ([m .basename for m in modules ])
1946
1973
}
@@ -2150,7 +2177,7 @@ def _resolve_dependencies_for_all_modules(self):
2150
2177
successfully_loaded = set ()
2151
2178
2152
2179
for modname in self ._to_load :
2153
- # This will try to recusively load all dependencies of modname
2180
+ # This will try to recursively load all dependencies of modname
2154
2181
ok , modules = self .resolve_dependencies (available_modules , dependency_table , modname )
2155
2182
if ok :
2156
2183
successfully_loaded .add (modname )
@@ -2898,8 +2925,14 @@ def calculate_cc_min_version(options, ccinfo, source_paths):
2898
2925
ccinfo .basename , cc_output ))
2899
2926
return "0.0"
2900
2927
2901
- cc_version = "%d.%d" % (int (match .group (1 ), 0 ), int (match .group (2 ), 0 ))
2928
+ major_version = int (match .group (1 ), 0 )
2929
+ minor_version = int (match .group (2 ), 0 )
2930
+ cc_version = "%d.%d" % (major_version , minor_version )
2902
2931
logging .info ('Auto-detected compiler version %s' % (cc_version ))
2932
+
2933
+ if ccinfo .basename == 'msvc' :
2934
+ if major_version == 18 :
2935
+ logging .warning ('MSVC 2013 support is deprecated and will be removed in a future release' )
2903
2936
return cc_version
2904
2937
2905
2938
def check_compiler_arch (options , ccinfo , archinfo , source_paths ):
0 commit comments