nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 643 lines 16 kB view raw
1# Build settings based on the upstream Xcode project. 2# See: https://github.com/apple-oss-distributions/cctools/blob/main/cctools.xcodeproj/project.pbxproj 3 4# Project settings 5project( 6 'cctools', 7 'c', 8 version : '@version@', 9 default_options : { 10 'c_args': [ 11 '-DCCTB_MACOS=YES', 12 '-DCCTB_PROJECT=cctools', 13 '-DCCTB_PROJVERS=cctools-@version@', 14 '-DCCTB_VERSION=@version@', 15 '-DCURRENT_PROJECT_VERSION="cctools-@version@"', 16 '-DCODEDIRECTORY_SUPPORT', 17 '-DLTO_SUPPORT', 18 ], 19 }, 20) 21 22fs = import('fs') 23 24# Options 25target_prefix = get_option('target_prefix') 26 27 28# Dependencies 29cc = meson.get_compiler('c') 30 31libcxx = cc.find_library('c++') 32libcodedirectory = cc.find_library('codedirectory') 33libprunetrie = cc.find_library('prunetrie') 34 35 36incdirs = include_directories('include') 37 38# Static libraries 39libstuff = static_library( 40 'stuff', 41 c_args : [ 42 '-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64 43 ], 44 include_directories : [incdirs, 'include/stuff'], 45 sources : [ 46 'libstuff/SymLoc.c', 47 'libstuff/align.c', 48 'libstuff/allocate.c', 49 'libstuff/apple_version.c', 50 'libstuff/arch.c', 51 'libstuff/arch_usage.c', 52 'libstuff/args.c', 53 'libstuff/best_arch.c', 54 'libstuff/breakout.c', 55 'libstuff/bytesex.c', 56 'libstuff/checkout.c', 57 'libstuff/code_directory.c', 58 'libstuff/coff_bytesex.c', 59 'libstuff/crc32.c', 60 'libstuff/depinfo.c', 61 'libstuff/diagnostics.c', 62 'libstuff/dylib_roots.c', 63 'libstuff/dylib_table.c', 64 'libstuff/errors.c', 65 'libstuff/execute.c', 66 'libstuff/fatal_arch.c', 67 'libstuff/fatals.c', 68 'libstuff/get_arch_from_host.c', 69 'libstuff/get_toc_byte_sex.c', 70 'libstuff/guess_short_name.c', 71 'libstuff/hash_string.c', 72 'libstuff/hppa.c', 73 'libstuff/llvm.c', 74 'libstuff/lto.c', 75 'libstuff/macosx_deployment_target.c', 76 'libstuff/ofile.c', 77 'libstuff/ofile_error.c', 78 'libstuff/ofile_get_word.c', 79 'libstuff/print.c', 80 'libstuff/reloc.c', 81 'libstuff/rnd.c', 82 'libstuff/seg_addr_table.c', 83 'libstuff/set_arch_flag_name.c', 84 'libstuff/swap_headers.c', 85 'libstuff/symbol_list.c', 86 'libstuff/unix_standard_mode.c', 87 'libstuff/version_number.c', 88 'libstuff/vm_flush_cache.c', 89 'libstuff/write64.c', 90 'libstuff/writeout.c', 91 'libstuff/xcode.c', 92 ], 93) 94 95libstuff_otool = static_library( 96 'stuff_otool', 97 c_args : [ 98 '-DCPU_TYPE_RISCV32=24', # Per src/abstraction/MachOFileAbstraction.hpp from ld64 99 ], 100 include_directories : [incdirs, 'include/stuff', 'otool'], 101 sources : [ 102 'libstuff/SymLoc.c', 103 'libstuff/align.c', 104 'libstuff/allocate.c', 105 'libstuff/apple_version.c', 106 'libstuff/arch.c', 107 'libstuff/arch_usage.c', 108 'libstuff/args.c', 109 'libstuff/best_arch.c', 110 'libstuff/breakout.c', 111 'libstuff/bytesex.c', 112 'libstuff/checkout.c', 113 'libstuff/code_directory.c', 114 'libstuff/coff_bytesex.c', 115 'libstuff/crc32.c', 116 'libstuff/depinfo.c', 117 'libstuff/diagnostics.c', 118 'libstuff/dylib_roots.c', 119 'libstuff/dylib_table.c', 120 'libstuff/errors.c', 121 'libstuff/execute.c', 122 'libstuff/fatal_arch.c', 123 'libstuff/fatals.c', 124 'libstuff/get_arch_from_host.c', 125 'libstuff/get_toc_byte_sex.c', 126 'libstuff/guess_short_name.c', 127 'libstuff/hash_string.c', 128 'libstuff/hppa.c', 129 'libstuff/llvm.c', 130 'libstuff/lto.c', 131 'libstuff/macosx_deployment_target.c', 132 'libstuff/ofile.c', 133 'libstuff/ofile_error.c', 134 'libstuff/ofile_get_word.c', 135 'libstuff/print.c', 136 'libstuff/reloc.c', 137 'libstuff/rnd.c', 138 'libstuff/seg_addr_table.c', 139 'libstuff/set_arch_flag_name.c', 140 'libstuff/swap_headers.c', 141 'libstuff/symbol_list.c', 142 'libstuff/unix_standard_mode.c', 143 'libstuff/version_number.c', 144 'libstuff/vm_flush_cache.c', 145 'libstuff/write64.c', 146 'libstuff/writeout.c', 147 'libstuff/xcode.c', 148 ], 149) 150 151 152# Binaries 153ar = executable( 154 f'@target_prefix@ar', 155 include_directories : incdirs, 156 install : true, 157 link_with : [libstuff], 158 sources : [ 159 'ar/append.c', 160 'ar/ar.c', 161 'ar/archive.c', 162 'ar/contents.c', 163 'ar/delete.c', 164 'ar/extract.c', 165 'ar/misc.c', 166 'ar/move.c', 167 'ar/print.c', 168 'ar/replace.c', 169 ], 170) 171install_man( 172 'ar/ar.1', 173 'ar/ar.5', 174) 175 176as = executable( 177 f'@target_prefix@gas', 178 include_directories : incdirs, 179 install : true, 180 link_with : [libstuff], 181 sources : ['as/driver.c'], 182) 183 184as_common = files( 185 'as/app.c', 186 'as/as.c', 187 'as/atof-generic.c', 188 'as/atof-ieee.c', 189 'as/dwarf2dbg.c', 190 'as/expr.c', 191 'as/fixes.c', 192 'as/flonum-const.c', 193 'as/flonum-copy.c', 194 'as/flonum-mult.c', 195 'as/frags.c', 196 'as/hash.c', 197 'as/hex-value.c', 198 'as/input-file.c', 199 'as/input-scrub.c', 200 'as/layout.c', 201 'as/messages.c', 202 'as/obstack.c', 203 'as/read.c', 204 'as/sections.c', 205 'as/symbols.c', 206 'as/write_object.c', 207 'as/xmalloc.c', 208) 209 210as_arm = executable( 211 'as-arm', 212 c_args : [ 213 '-DARM', 214 '-DNeXT_MOD', 215 ], 216 include_directories : [ 217 incdirs, 218 'as', 219 'include/gnu', 220 ], 221 install : true, 222 install_dir : 'libexec/as/arm', 223 link_with : [libstuff], 224 sources : [as_common, 'as/arm.c'], 225) 226 227as_i386 = executable( 228 'as-i386', 229 c_args : [ 230 '-DI386', 231 '-Di486', 232 '-Di586', 233 '-Di686', 234 '-DNeXT_MOD', 235 ], 236 include_directories : [ 237 incdirs, 238 'as', 239 'include/gnu', 240 ], 241 install : true, 242 install_dir : 'libexec/as/i386', 243 link_with : [libstuff], 244 sources : [as_common, 'as/i386.c'], 245) 246 247as_x86_64 = executable( 248 'as-x86_64', 249 c_args : [ 250 '-DI386', 251 '-Di486', 252 '-Di586', 253 '-Di686', 254 '-DARCH64', 255 '-DNeXT_MOD', 256 ], 257 include_directories : [ 258 incdirs, 259 'as', 260 'include/gnu' 261 ], 262 install : true, 263 install_dir : 'libexec/as/x86_64', 264 link_with : [libstuff], 265 sources : [as_common, 'as/i386.c'], 266) 267 268# # ld # excluded because ld64 is built separately 269 270bitcode_strip = executable( 271 f'@target_prefix@bitcode_strip', 272 dependencies : [libcodedirectory], 273 include_directories : incdirs, 274 install : true, 275 link_with : [libstuff], 276 sources : ['misc/bitcode_strip.c'], 277) 278install_man('man/bitcode_strip.1') 279 280check_dylib = executable( 281 f'@target_prefix@check_dylib', 282 include_directories : incdirs, 283 install : true, 284 link_with : [libstuff], 285 sources : ['misc/check_dylib.c'], 286) 287install_man('man/check_dylib.1') 288 289checksyms = executable( 290 f'@target_prefix@checksyms', 291 include_directories : incdirs, 292 install : true, 293 link_with : [libstuff], 294 sources : ['misc/checksyms.c'], 295) 296install_man('man/checksyms.1') 297 298cmpdylib = executable( 299 f'@target_prefix@cmpdylib', 300 include_directories : incdirs, 301 install : true, 302 link_with : [libstuff], 303 sources : ['misc/cmpdylib.c'], 304) 305install_man('man/cmpdylib.1') 306 307codesign_allocate = executable( 308 f'@target_prefix@codesign_allocate', 309 dependencies : [libcodedirectory], 310 include_directories : incdirs, 311 install : true, 312 link_with : [libstuff], 313 sources : ['misc/codesign_allocate.c'], 314) 315install_man('man/codesign_allocate.1') 316 317ctf_insert = executable( 318 f'@target_prefix@ctf_insert', 319 dependencies : [libcodedirectory], 320 include_directories : [incdirs, 'include/stuff'], 321 install : true, 322 link_with : [libstuff], 323 sources : ['misc/ctf_insert.c'], 324) 325install_man('man/ctf_insert.1') 326 327depinfo = executable( 328 f'@target_prefix@depinfo', 329 include_directories : incdirs, 330 install : true, 331 link_with : [libstuff], 332 sources : ['misc/depinfo.c'], 333) 334install_man('man/depinfo.1') 335 336diagtest = executable( 337 f'@target_prefix@diagtest', 338 include_directories : incdirs, 339 install : true, 340 link_with : [libstuff], 341 sources : ['misc/diagtest.c'], 342) 343install_man('man/diagtest.1') 344 345gprof = executable( 346 f'@target_prefix@gprof', 347 include_directories : incdirs, 348 install : true, 349 link_with : [libstuff], 350 sources : [ 351 'gprof/arcs.c', 352 'gprof/calls.c', 353 'gprof/dfn.c', 354 'gprof/getnfile.c', 355 'gprof/gprof.c', 356 'gprof/hertz.c', 357 'gprof/lookup.c', 358 'gprof/printgprof.c', 359 'gprof/printlist.c', 360 'gprof/scatter.c', 361 ], 362) 363install_man('man/gprof.1') 364 365# Not supported on 64-bit architectures 366# indr = executable( 367# f'@target_prefix@indr', 368# include_directories : incdirs, 369# sources : ['misc/indr.c'], 370# ) 371# install_man('man/indr.1') 372 373install_name_tool = executable( 374 f'@target_prefix@install_name_tool', 375 dependencies : [libcodedirectory], 376 include_directories : incdirs, 377 install : true, 378 link_with : [libstuff], 379 sources : ['misc/install_name_tool.c'], 380) 381install_man('man/install_name_tool.1') 382 383libtool = executable( 384 f'@target_prefix@libtool', 385 include_directories : incdirs, 386 install : true, 387 link_with : [libstuff], 388 sources : ['misc/libtool.c'], 389) 390install_man('man/libtool.1') 391 392lipo = executable( 393 f'@target_prefix@lipo', 394 include_directories : incdirs, 395 install : true, 396 link_with : [libstuff], 397 sources : ['misc/lipo.c'], 398) 399install_man('man/lipo.1') 400 401mtoc = executable( 402 f'@target_prefix@mtoc', 403 include_directories : incdirs, 404 install : true, 405 link_with : [libstuff], 406 sources : ['efitools/mtoc.c'], 407) 408install_man('man/mtoc.1') 409 410mtor = executable( 411 f'@target_prefix@mtor', 412 include_directories : incdirs, 413 install : true, 414 link_with : [libstuff], 415 sources : ['efitools/mtor.c'], 416) 417install_man('man/mtor.1') 418 419nm = executable( 420 f'@target_prefix@nm', 421 include_directories : incdirs, 422 install : true, 423 link_with : [libstuff], 424 sources : ['misc/nm.c'], 425) 426install_man('man/nm-classic.1') 427 428nmedit = executable( 429 f'@target_prefix@nmedit', 430 c_args : ['-DNMEDIT'], 431 dependencies : [libcodedirectory], 432 include_directories : incdirs, 433 install : true, 434 link_with : [libstuff], 435 sources : ['misc/strip.c'], 436) 437install_man('man/nmedit.1') 438 439otool = executable( 440 f'@target_prefix@otool', 441 c_args : ['-DEFI_SUPPORT'], 442 dependencies : [libcxx], 443 include_directories : incdirs, 444 install : true, 445 link_with : [libstuff], 446 sources : [ 447 'otool/arm64_disasm.c', 448 'otool/arm_disasm.c', 449 'otool/coff_print.c', 450 'otool/dyld_bind_info.c', 451 'otool/hppa_disasm.c', 452 'otool/i386_disasm.c', 453 'otool/i860_disasm.c', 454 'otool/m68k_disasm.c', 455 'otool/m88k_disasm.c', 456 'otool/main.c', 457 'otool/ofile_print.c', 458 'otool/ppc_disasm.c', 459 'otool/print_bitcode.c', 460 'otool/print_objc.c', 461 'otool/print_objc2_32bit.c', 462 'otool/print_objc2_64bit.c', 463 'otool/print_objc2_util.c', 464 'otool/sparc_disasm.c', 465 ], 466) 467install_man('man/otool-classic.1') 468 469pagestuff = executable( 470 f'@target_prefix@pagestuff', 471 include_directories : incdirs, 472 install : true, 473 link_with : [libstuff], 474 sources : ['misc/pagestuff.c'], 475) 476install_man('man/pagestuff.1') 477 478# ranlib is a symlink to libtool 479install_man( 480 'man/ranlib.1', 481 'man/ranlib.5', 482) 483 484redo_prebinding = executable( 485 f'@target_prefix@redo_prebinding', 486 dependencies : [libcodedirectory], 487 include_directories : incdirs, 488 install : true, 489 link_with : [libstuff], 490 sources : ['misc/redo_prebinding.c'], 491) 492install_man('man/redo_prebinding.1') 493 494seg_addr_table = executable( 495 f'@target_prefix@seg_addr_table', 496 include_directories : incdirs, 497 install : true, 498 link_with : [libstuff], 499 sources : ['misc/seg_addr_table.c'], 500) 501install_man('man/seg_addr_table.1') 502 503seg_hack = executable( 504 f'@target_prefix@seg_hack', 505 dependencies : [libcodedirectory], 506 include_directories : incdirs, 507 install : true, 508 link_with : [libstuff], 509 sources : ['misc/seg_hack.c'], 510) 511 512segedit = executable( 513 f'@target_prefix@segedit', 514 include_directories : incdirs, 515 install : true, 516 link_with : [libstuff], 517 sources : ['misc/segedit.c'], 518) 519install_man('man/segedit.1',) 520 521size = executable( 522 f'@target_prefix@size', 523 include_directories : incdirs, 524 install : true, 525 link_with : [libstuff], 526 sources : ['misc/size.c'], 527) 528install_man('man/size-classic.1') 529 530strings = executable( 531 f'@target_prefix@strings', 532 include_directories : incdirs, 533 install : true, 534 link_with : [libstuff], 535 sources : ['misc/strings.c'], 536) 537install_man('man/strings.1') 538 539strip = executable( 540 f'@target_prefix@strip', 541 c_args : ['-DTRIE_SUPPORT'], 542 dependencies : [libcxx, libcodedirectory, libprunetrie], 543 include_directories : incdirs, 544 install : true, 545 link_with : [libstuff], 546 sources : ['misc/strip.c'], 547) 548install_man('man/strip.1') 549 550vtool = executable( 551 f'@target_prefix@vtool', 552 dependencies : [libcodedirectory], 553 include_directories : [incdirs, 'include/stuff'], 554 install : true, 555 link_with : [libstuff], 556 sources : ['misc/vtool.c'], 557) 558install_man('man/vtool.1') 559 560 561# Development files 562# Static libraries 563libmacho = static_library( 564 'macho', 565 include_directories : incdirs, 566 sources : [ 567 'libmacho/arch.c', 568 'libmacho/get_end.c', 569 'libmacho/getsecbyname.c', 570 'libmacho/getsegbyname.c', 571 'libmacho/hppa_swap.c', 572 'libmacho/i386_swap.c', 573 'libmacho/i860_swap.c', 574 'libmacho/m68k_swap.c', 575 'libmacho/m88k_swap.c', 576 'libmacho/ppc_swap.c', 577 'libmacho/slot_name.c', 578 'libmacho/sparc_swap.c', 579 'libmacho/swap.c', 580 ], 581) 582 583libredo_prebinding = static_library( 584 'redo_prebinding', 585 c_args : ['-DLIBRARY_API'], 586 include_directories : incdirs, 587 sources : ['misc/redo_prebinding.c'], 588) 589install_man('man/redo_prebinding.3') 590 591 592# Development files 593# Based on the contents of the upstream SDK. 594install_headers( 595 'include/mach-o/arch.h', 596 'include/mach-o/fat.h', 597 'include/mach-o/getsect.h', 598 'include/mach-o/ldsyms.h', 599 'include/mach-o/loader.h', 600 'include/mach-o/nlist.h', 601 'include/mach-o/ranlib.h', 602 'include/mach-o/reloc.h', 603 'include/mach-o/stab.h', 604 'include/mach-o/swap.h', 605 subdir : 'mach-o', 606) 607 608# Some of these architectures are irrelevant, but the Libsystem derivation expects their headers to be present. 609# Not every arch has both headers, so tailor the lists for each that does. 610foreach arch : ['arm', 'arm64', 'hppa', 'i860', 'm88k', 'ppc', 'sparc', 'x86_64'] 611 install_headers( 612 f'include/mach-o/@arch@/reloc.h', 613 subdir : f'mach-o/@arch@', 614 ) 615endforeach 616foreach arch : ['hppa', 'i386', 'i860', 'm68k', 'm88k', 'ppc', 'sparc'] 617 install_headers( 618 f'include/mach-o/@arch@/swap.h', 619 subdir : f'mach-o/@arch@', 620 ) 621endforeach 622 623install_data( 624 'include/modules/mach-o.modulemap', 625 install_dir : get_option('includedir'), 626 rename : 'mach-o/module.map', 627) 628install_man( 629 'man/Mach-O.5', 630 'man/NSModule.3', 631 'man/NSObjectFileImage.3', 632 'man/NSObjectFileImage_priv.3', 633 'man/arch.3', 634 'man/dyld.3', 635 'man/end.3', 636 'man/get_end.3', 637 'man/getsectbyname.3', 638 'man/getsectbynamefromheader.3', 639 'man/getsectdata.3', 640 'man/getsectdatafromheader.3', 641 'man/getsegbyname.3', 642 'man/stab.5', 643)