Changeset 988 for vendor/current/buildtools/wafsamba/wscript
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/buildtools/wafsamba/wscript
r740 r988 3 3 # this is a base set of waf rules that everything else pulls in first 4 4 5 import sys, wafsamba, Configure, Logs6 import Options, os, preproc7 from samba_utils import *5 import os, sys 6 import wafsamba, Configure, Logs, Options, Utils 7 from samba_utils import os_path_relpath 8 8 from optparse import SUPPRESS_HELP 9 9 … … 28 28 action="store", dest='BUNDLED_LIBS', default='') 29 29 30 gr.add_option('--private-libraries', 31 help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private. Can be 'NONE' or 'ALL' [auto]"), 32 action="store", dest='PRIVATE_LIBS', default='') 33 30 34 extension_default = Options.options['PRIVATE_EXTENSION_DEFAULT'] 31 35 gr.add_option('--private-library-extension', … … 38 42 action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception) 39 43 40 builtin_defau ilt = Options.options['BUILTIN_LIBRARIES_DEFAULT']44 builtin_default = Options.options['BUILTIN_LIBRARIES_DEFAULT'] 41 45 gr.add_option('--builtin-libraries', 42 help=("command separated list of libraries to build directly into binaries [%s]" % builtin_defau ilt),43 action="store", dest='BUILTIN_LIBRARIES', default=builtin_defau ilt)46 help=("command separated list of libraries to build directly into binaries [%s]" % builtin_default), 47 action="store", dest='BUILTIN_LIBRARIES', default=builtin_default) 44 48 45 49 gr.add_option('--minimum-library-version', … … 47 51 action="store", dest='MINIMUM_LIBRARY_VERSION', default='') 48 52 49 gr.add_option('--disable-shared',50 help=("Disable all use of shared libraries"),51 action="store_true", dest='disable_shared', default=False)52 53 gr.add_option('--disable-rpath', 53 54 help=("Disable use of rpath for build binaries"), … … 74 75 action="store", dest='PRIVATELIBDIR', default=None) 75 76 77 opt.add_option('--with-libiconv', 78 help='additional directory to search for libiconv', 79 action='store', dest='iconv_open', default='/usr/local', 80 match = ['Checking for library iconv', 'Checking for iconv_open', 'Checking for header iconv.h']) 81 opt.add_option('--without-gettext', 82 help=("Disable use of gettext"), 83 action="store_true", dest='disable_gettext', default=False) 84 76 85 gr = opt.option_group('developer options') 77 86 … … 82 91 help='enable automatic reconfigure on build', 83 92 action='store_true', dest='enable_auto_reconfigure') 93 gr.add_option('--enable-debug', 94 help=("Turn on debugging symbols"), 95 action="store_true", dest='debug', default=False) 84 96 gr.add_option('--enable-developer', 85 97 help=("Turn on developer warnings and debugging"), 86 98 action="store_true", dest='developer', default=False) 99 def picky_developer_callback(option, opt_str, value, parser): 100 parser.values.developer = True 101 parser.values.picky_developer = True 87 102 gr.add_option('--picky-developer', 88 103 help=("Treat all warnings as errors (enable -Werror)"), 89 action="store_true", dest='picky_developer', default=False) 104 action="callback", callback=picky_developer_callback, 105 dest='picky_developer', default=False) 90 106 gr.add_option('--fatal-errors', 91 107 help=("Stop compilation on first error (enable -Wfatal-errors)"), … … 103 119 help=("mark version with + if local git changes"), 104 120 action='store_true', dest='GIT_LOCAL_CHANGES', default=False) 121 gr.add_option('--address-sanitizer', 122 help=("Enable address sanitizer compile and linker flags"), 123 action="store_true", dest='address_sanitizer', default=False) 105 124 106 125 gr.add_option('--abi-check', … … 121 140 help=("check symbols in object files against project rules"), 122 141 action='store_true', dest='SYMBOLCHECK', default=False) 142 143 gr.add_option('--dup-symbol-check', 144 help=("check for duplicate symbols in object files and system libs (must be configured with --enable-developer)"), 145 action='store_true', dest='DUP_SYMBOLCHECK', default=False) 123 146 124 147 gr.add_option('--why-needed', … … 153 176 help=SUPPRESS_HELP, 154 177 action='store', dest='AUTOCONF_HOST', default='') 178 opt.add_option('--target', 179 help=SUPPRESS_HELP, 180 action='store', dest='AUTOCONF_TARGET', default='') 155 181 opt.add_option('--program-prefix', 156 182 help=SUPPRESS_HELP, … … 159 185 help=SUPPRESS_HELP, 160 186 action='store_true', dest='AUTOCONF_DISABLE_DEPENDENCY_TRACKING', default=False) 187 opt.add_option('--disable-silent-rules', 188 help=SUPPRESS_HELP, 189 action='store_true', dest='AUTOCONF_DISABLE_SILENT_RULES', default=False) 161 190 162 191 gr = opt.option_group('dist options') … … 168 197 type='string', action='store', dest='TAG_RELEASE') 169 198 170 171 @wafsamba.runonce 199 opt.add_option('--extra-python', type=str, 200 help=("build selected libraries for the specified " 201 "additional version of Python " 202 "(example: --extra-python=/usr/bin/python3)"), 203 metavar="PYTHON", dest='EXTRA_PYTHON', default=None) 204 205 206 @Utils.run_once 172 207 def configure(conf): 173 208 conf.env.hlist = [] … … 182 217 conf.check_tool('gnu_dirs') 183 218 conf.check_tool('wafsamba') 219 conf.check_tool('print_commands') 184 220 185 221 conf.CHECK_CC_ENV() 186 222 187 223 conf.check_tool('compiler_cc') 224 225 conf.CHECK_STANDARD_LIBPATH() 188 226 189 227 # we need git for 'waf dist' … … 192 230 # older gcc versions (< 4.4) does not work with gccdeps, so we have to see if the .d file is generated 193 231 if Options.options.enable_gccdeps: 232 # stale file removal - the configuration may pick up the old .pyc file 233 p = os.path.join(conf.srcdir, 'buildtools/wafsamba/gccdeps.pyc') 234 if os.path.exists(p): 235 os.remove(p) 236 194 237 from TaskGen import feature, after 195 238 @feature('testd') … … 206 249 try: 207 250 try: 208 conf.check(features='c ctestd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')251 conf.check(features='c testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD') 209 252 except: 210 253 pass … … 221 264 conf.env.PRIVATELIBDIR = Options.options.PRIVATELIBDIR 222 265 conf.env.BUNDLED_LIBS = Options.options.BUNDLED_LIBS.split(',') 266 conf.env.PRIVATE_LIBS = Options.options.PRIVATE_LIBS.split(',') 223 267 conf.env.BUILTIN_LIBRARIES = Options.options.BUILTIN_LIBRARIES.split(',') 224 conf.env.DISABLE_SHARED = Options.options.disable_shared225 268 conf.env.NONSHARED_BINARIES = Options.options.NONSHARED_BINARIES.split(',') 226 269 … … 236 279 conf.env.AUTOCONF_HOST = Options.options.AUTOCONF_HOST 237 280 conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX 281 282 conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON 238 283 239 284 if (conf.env.AUTOCONF_HOST and … … 271 316 msg='Checking simple C program') 272 317 273 # see if we can build shared libs 274 if not conf.CHECK_LIBRARY_SUPPORT(): 275 conf.env.DISABLE_SHARED = True 318 # Try to find the right extra flags for -Werror behaviour 319 for f in ["-Werror", # GCC 320 "-errwarn=%all", # Sun Studio 321 "-qhalt=w", # IBM xlc 322 "-w2", # Tru64 323 ]: 324 if conf.CHECK_CFLAGS([f], ''' 325 '''): 326 if not 'WERROR_CFLAGS' in conf.env: 327 conf.env['WERROR_CFLAGS'] = [] 328 conf.env['WERROR_CFLAGS'].extend([f]) 329 break 330 331 # check which compiler/linker flags are needed for rpath support 332 if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']): 333 conf.env['RPATH_ST'] = '-Wl,-R,%s' 276 334 277 335 # check for rpath 278 if not conf.env.DISABLE_SHARED andconf.CHECK_LIBRARY_SUPPORT(rpath=True):336 if conf.CHECK_LIBRARY_SUPPORT(rpath=True): 279 337 support_rpath = True 280 338 conf.env.RPATH_ON_BUILD = not Options.options.disable_rpath_build … … 296 354 conf.env.PRIVATELIBDIR = conf.env.LIBDIR 297 355 298 if (not conf.env.DISABLE_SHARED and 299 not Options.options.disable_symbol_versions and 356 if (not Options.options.disable_symbol_versions and 300 357 conf.CHECK_LIBRARY_SUPPORT(rpath=support_rpath, 301 358 version_script=True, … … 305 362 conf.env.HAVE_LD_VERSION_SCRIPT = False 306 363 307 if sys.platform == "aix5": 364 if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS): 365 conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden' 366 conf.CHECK_CODE('''int main(void) { return 0; } 367 __attribute__((visibility("default"))) void vis_foo2(void) {}''', 368 cflags=conf.env.VISIBILITY_CFLAGS, 369 define='HAVE_VISIBILITY_ATTR', addmain=False) 370 371 # check HAVE_CONSTRUCTOR_ATTRIBUTE 372 conf.CHECK_CODE(''' 373 void test_constructor_attribute(void) __attribute__ ((constructor)); 374 375 void test_constructor_attribute(void) 376 { 377 return; 378 } 379 380 int main(void) { 381 return 0; 382 } 383 ''', 384 'HAVE_CONSTRUCTOR_ATTRIBUTE', 385 addmain=False, 386 msg='Checking for library constructor support') 387 388 # check HAVE_DESTRUCTOR_ATTRIBUTE 389 conf.CHECK_CODE(''' 390 void test_destructor_attribute(void) __attribute__ ((destructor)); 391 392 void test_destructor_attribute(void) 393 { 394 return; 395 } 396 397 int main(void) { 398 return 0; 399 } 400 ''', 401 'HAVE_DESTRUCTOR_ATTRIBUTE', 402 addmain=False, 403 msg='Checking for library destructor support') 404 405 if sys.platform.startswith('aix'): 308 406 conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True) 309 407 # Might not be needed if ALL_SOURCE is defined … … 335 433 336 434 # check for pkgconfig 337 conf. check_cfg(atleast_pkgconfig_version='0.0.0')435 conf.CHECK_CFG(atleast_pkgconfig_version='0.0.0') 338 436 339 437 conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True) 340 438 conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True) 439 440 # on Tru64 certain features are only available with _OSF_SOURCE set to 1 441 # and _XOPEN_SOURCE set to 600 442 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1': 443 conf.DEFINE('_OSF_SOURCE', 1, add_to_cflags=True) 444 conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True) 445 446 # SCM_RIGHTS is only avail if _XOPEN_SOURCE iÑ defined on IRIX 447 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'IRIX': 448 conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True) 449 conf.DEFINE('_BSD_TYPES', 1, add_to_cflags=True) 450 451 # Try to find the right extra flags for C99 initialisers 452 for f in ["", "-AC99", "-qlanglvl=extc99", "-qlanglvl=stdc99", "-c99"]: 453 if conf.CHECK_CFLAGS([f], ''' 454 struct foo {int x;char y;}; 455 struct foo bar = { .y = 'X', .x = 1 }; 456 '''): 457 if f != "": 458 conf.ADD_CFLAGS(f) 459 break 341 460 342 461 # get the base headers we'll use for the rest of the tests … … 344 463 add_headers=True) 345 464 conf.CHECK_HEADERS('strings.h inttypes.h stdint.h unistd.h minix/config.h', add_headers=True) 346 conf.CHECK_HEADERS('ctype.h standards.h stdbool.h stdint.h stdarg.h vararg.h', add_headers=True) 465 conf.CHECK_HEADERS('ctype.h', add_headers=True) 466 467 if sys.platform != 'darwin': 468 conf.CHECK_HEADERS('standards.h', add_headers=True) 469 470 conf.CHECK_HEADERS('stdbool.h stdint.h stdarg.h vararg.h', add_headers=True) 347 471 conf.CHECK_HEADERS('limits.h assert.h') 348 472 349 473 # see if we need special largefile flags 350 conf.CHECK_LARGEFILE() 474 if not conf.CHECK_LARGEFILE(): 475 raise Utils.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8') 351 476 352 477 if 'HAVE_STDDEF_H' in conf.env and 'HAVE_STDLIB_H' in conf.env: … … 365 490 conf.define('SHLIBEXT', "so", quote=True) 366 491 367 conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]', 368 execute=True, 369 define='WORDS_BIGENDIAN') 492 # First try a header check for cross-compile friendlyness 493 conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER 494 #define B __BYTE_ORDER 495 #elif defined(BYTE_ORDER) 496 #define B BYTE_ORDER 497 #endif 498 499 #ifdef __LITTLE_ENDIAN 500 #define LITTLE __LITTLE_ENDIAN 501 #elif defined(LITTLE_ENDIAN) 502 #define LITTLE LITTLE_ENDIAN 503 #endif 504 505 #if !defined(LITTLE) || !defined(B) || LITTLE != B 506 #error Not little endian. 507 #endif 508 int main(void) { return 0; }""", 509 addmain=False, 510 headers="endian.h sys/endian.h", 511 define="HAVE_LITTLE_ENDIAN") 512 conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER 513 #define B __BYTE_ORDER 514 #elif defined(BYTE_ORDER) 515 #define B BYTE_ORDER 516 #endif 517 518 #ifdef __BIG_ENDIAN 519 #define BIG __BIG_ENDIAN 520 #elif defined(BIG_ENDIAN) 521 #define BIG BIG_ENDIAN 522 #endif 523 524 #if !defined(BIG) || !defined(B) || BIG != B 525 #error Not big endian. 526 #endif 527 int main(void) { return 0; }""", 528 addmain=False, 529 headers="endian.h sys/endian.h", 530 define="HAVE_BIG_ENDIAN") 531 532 if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): 533 # That didn't work! Do runtime test. 534 conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; 535 u.i = 0x01020304; 536 return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""", 537 addmain=True, execute=True, 538 define='HAVE_LITTLE_ENDIAN', 539 msg="Checking for HAVE_LITTLE_ENDIAN - runtime") 540 conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u; 541 u.i = 0x01020304; 542 return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""", 543 addmain=True, execute=True, 544 define='HAVE_BIG_ENDIAN', 545 msg="Checking for HAVE_BIG_ENDIAN - runtime") 546 547 # Extra sanity check. 548 if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"): 549 Logs.error("Failed endian determination. The PDP-11 is back?") 550 sys.exit(1) 551 else: 552 if conf.CONFIG_SET("HAVE_BIG_ENDIAN"): 553 conf.DEFINE('WORDS_BIGENDIAN', 1) 370 554 371 555 # check if signal() takes a void function
Note:
See TracChangeset
for help on using the changeset viewer.