ó °~VVc@@s¶ddlmZddlZddlZddljZddljZddlTd„Z d„Z d„Z d„Z de fd „ƒYZd „Zd „Zed kr²eƒndS( i(tabsolute_importN(t*cC@s|jddƒ}|S(s cmake_quote_string(value) -> str Return a quoted form of the given value that is suitable for use in CMake language files. s\s\\(treplace(tvalue((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytcmake_quote_string s cC@s|jddƒ}|S(s‹ cmake_quote_path(value) -> str Return a quoted form of the given value that is suitable for use in CMake language files. s\t/(R(R((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytcmake_quote_paths cC@s|jddƒS(s§ mk_quote_string_for_target(target_name) -> str Return a quoted form of the given target_name suitable for including in a Makefile as a target name. t:s\:(R(R((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytmk_quote_string_for_target(s cC@s&tjj|ƒs"tj|ƒndS(sv make_install_dir(path) -> None Create the given directory path for installation, including any parents. N(tostpathtexiststmakedirs(R ((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytmake_install_dir3stLLVMProjectInfocB@szeZed„ƒZed„ƒZd„Zd„Zd„Zd„Zd„Z e d„Z d„Z d „Z d „ZRS( c@s‡‡fd†‰ˆdƒS(Nc3@s¶tjjˆ|dƒ}tjj|ƒs?td|fƒntj||ƒ\}}x|D] }|Vq^WxB|jdƒD]1}x(ˆtjj||ƒƒD] }|VqŸWq}WdS(Ns LLVMBuild.txts!missing LLVMBuild.txt file at: %rtsubdirectories(R R tjoinR tfatalt componentinfotload_from_pathtget_list(tsubpathtllvmbuild_pathtcommont info_itertinfotsubdirtitem(tllvmbuild_source_roottrecurse(sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyRCs    "R((R((RRsD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytload_infos_from_pathAscC@s"ttj|ƒƒ}t||ƒS(N(tlistRR(t source_rootRtinfos((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyRWscC@s.||_t|ƒ|_d|_d|_dS(N(R Rtcomponent_infostNonetcomponent_info_maptordered_component_infos(tselfR R"((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyt__init__^s  c@sjiˆ_xeˆjD]Z}ˆjj|jƒ}|d k r]td|j|j|jfƒn|ˆj|j None Validate that the project components are well-defined. Among other things, this checks that: - Components have valid references. - Components references do not form cycles. We also construct the map from component names to info, and the topological ordering of components. s+found duplicate component %r (at %r and %r)talls0project is not allowed to define 'all' components$ROOTs0project is not allowed to define $ROOT componentRc@su||krEdjd„|Dƒƒ}td|j||jfƒn|ˆkrUdSˆj|ƒ|jdk rˆjj|jƒ}|dkr²td|j|jdfƒn|j|ƒnxœ|j ƒD]Ž\}}ˆjj|ƒ}|dkrtd|j||fƒn|j ||fƒ|j |ƒˆ|||ƒ|j|ƒ|j ƒqÏWˆj j |ƒdS(Ns -> cs@s(|]\}}d|j|fVqdS(s%r (%s)N(tname(t.0trelationtci((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys Žss+found cycle to %r after following: %s -> %ss.component %r has invalid reference %r (via %r)tparent(RRR)tremoveR-R#R$tgettset_parent_instancetget_component_referencestappendtaddtpopR%(R,t current_stackt current_settcycle_descriptionR-R+t referent_nametreferent(tcomponents_to_visitR&tvisit_component_info(sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyR;‰s4        tkeycS@s|jS(N(R)(tc((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyt»sicS@s|jS(N(R)(R=((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyR>ÁsN(R$R"R/R)R#RRRtGroupComponentInfoR2R%tsortedtsettchildrentsort(R&R,texistingR=((R:R&R;sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytvalidate_componentses.    /   c@s'd‡fd†‰ˆ|jdƒdS(Nic@sEdd||j|jfGHx"|jD]}ˆ||dƒq&WdS(Ns %s%-40s (%s)s i(R)t type_nameRB(tnodetdepthR=(tvisit(sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyRIÄss$ROOT(R$(R&((RIsD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyt print_treeÃscC@s¬i}xI|jD]>}|jdkr+qn|j|jgƒ|g||jåsssubdirectories = %s t Rs component_%diitt;t[s] iþÿÿÿs LLVMBuild.txttws;===- %s %s-*- Conf -*--===;t.t-iPs%s ; ; The LLVM Compiler Infrastructure ; ; This file is distributed under the University of Illinois Open Source ; License. See LICENSE.TXT for details. ; ;===------------------------------------------------------------------------===; ; ; This is an LLVMBuild description file for the components in this subdirectory. ; ; For more information on the LLVMBuild system, please see: ; ; http://llvm.org/docs/LLVMBuild.html ; ;===------------------------------------------------------------------------===; s[%s] iÿÿÿÿs (R"R-R#R/RR R tdirnameRAR3tbasenametitemsRCRR@R2tlentget_llvmbuild_fragmentt startswithtAssertionErrorR R topent _source_pathtendswithtclosetwrite(R&t output_patht info_basedirR,tsubpath_subdirst parent_patht parent_listRR!t fragmentsRtfragmenttnum_common_fragmentsR)tdirectory_pathtft comments_mapt comment_blocktlnt file_patht header_fmtt header_namet header_padt header_stringtcomment((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytwrite_componentsÊsx'            c C@s0i}x%|jD]}|jdkr:|j|kr:qn|jƒ}|r\|j r\qn|jdkrqqn|jƒ}|jdks›|jdkr³|jƒ}|j}n d}t }g|j D]} |j | jƒ^qÉ} x&|j D]} || dj |ƒqòW||| |f||jssR(cs@s'|]\}}}}t|ƒVqdS(N(RU(R*t_tdeps((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys |siROs//===- llvm-build generated file --------------------------------*- C++ -*-===// // // Component Library Depenedency Table // // Automatically generated file, do not edit! // //===----------------------------------------------------------------------===// sstruct AvailableComponent { s! /// The name of the component. s const char *Name; s s< /// The name of the library for this component (or NULL). s const char *Library; s* /// Whether the component is installed. s bool IsInstalled; sB /// The list of libraries required when linking this component. s% const char *RequiredLibraries[%d]; s} AvailableComponents[%d] = { t0s "lib%s.a"s { "%s", %s, %d, { %s } }, s, cs@s|]}d|VqdS(s"%s"N((R*tdep((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys ¢ss}; (sLibraryRrRtRu(R%RFR)tget_parent_target_grouptenabledtget_llvmconfig_component_nametget_prefixed_library_namet installedR#tTruetrequired_librariesR$tadd_to_library_groupsR2RtvaluesRARCtmaxR R R RRRYR]RURR\(R&R^tenabled_optional_componentstentriesR=ttgtllvmconfig_component_namet library_namet is_installedRzt#required_llvmconfig_component_namest root_entriesRwRxtmax_required_librariesRgR)trequired_namestlibrary_name_as_cstr((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytwrite_library_table>sz     &                     cc@s™|jdkst‚x}|jD]r}|j|}|jdkrL|Vqn|jdkr|sl|Vqnx"|j|tƒD] }|VqWqqWdS(sl get_required_libraries_for_component(component_info) -> iter Given a Library component info descriptor, return an iterator over all of the directly required libraries for linking with this component. If traverse_groups is True, then library and target groups will be traversed to include their required libraries. RsRtRuN(sLibrarys LibraryGroups TargetGroup(s LibraryGroups TargetGroup(RFRXRR$t$get_required_libraries_for_componentR€(R&R,ttraverse_groupsR)Rztres((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyR‘§s  cc@stƒ}xT|jD]I}tjj|j|jddƒ}||kr|V|j|ƒqqWxœtj j ƒD]‹}t |dƒs‹qpnt |dƒ}|s¦qpntjj |ƒdd krÏ|d }n|j|jƒrptjj|ƒrp|VqpqpWdS( sò get_fragment_dependencies() -> iter Compute the list of files (as absolute paths) on which the output fragments depend (i.e., files for which a modification should trigger a rebuild of the fragment). is LLVMBuild.txtt__file__s.pycs.pyos.pydiÿÿÿÿN(s.pycs.pyos.pyd(RAR"R R RR RR3tsystmodulesRƒthasattrtgetattrtsplitextRWR (R&t build_pathsR,tptmoduleR ((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytget_fragment_dependenciesÆs  "  $c C@sIt|jƒƒ}ttjj|ƒƒt|dƒ}d}tjj|ƒ}ddt||dfƒ}|||f}|j d|ƒ|j dƒx(|D] }|j dt |ƒfƒq¢W|j d ƒxe|j D]Z} | j d krøqÝn|j d | j ƒd jtd „|j| ƒDƒƒƒfƒqÝW|jƒdS(sg write_cmake_fragment(output_path) -> None Generate a CMake fragment which includes all of the collated LLVMBuild information in a format that is easily digestible by a CMake. The exact contents of this are closely tied to how the CMake configuration integrates LLVMBuild, see CMakeLists.txt in the top-level. ROsA#===-- %s - LLVMBuild Configuration for LLVM %s-*- CMake -*--===#RQiPRLs%s # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # #===------------------------------------------------------------------------===# # # This file contains the LLVMBuild project information in a format easily # consumed by the CMake based build system. # # This file is autogenerated by llvm-build, do not edit! # #===------------------------------------------------------------------------===# s¦ # LLVMBuild CMake fragment dependencies. # # CMake has no builtin way to declare that the configuration depends on # a particular file. However, a side effect of configure_file is to add # said input file to CMake's internal dependency list. So, we use that # and a dummy output file to communicate the dependency information to # CMake. # # FIXME: File a CMake RFE to get a properly supported version of this # feature. sUconfigure_file("%s" ${CMAKE_CURRENT_BINARY_DIR}/DummyConfigureOutput) sÇ # Explicit library dependency information. # # The following property assignments effectively create a map from component # names to required libraries, in a way that is easily accessed from CMake. Rss7set_property(GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_%s %s) RKcs@s|]}|jƒVqdS(N(R~(R*Rz((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys ;sN(RRR R R RRRYRSRUR]RR%RFR~RR@R‘R\( R&R^t dependenciesRgRlRmRnRoRzR,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytwrite_cmake_fragmentïs4    "c C@sTt|jƒƒ}ttjj|ƒƒt|dƒ}d}tjj|ƒ}ddt||dfƒ}|||f}|j d|ƒ|j dƒ|j dƒ|j d ƒ|j d t |ƒfƒx"|D]}|j d |fƒqÖW|j d ƒ|j d ƒx(|D] }|j dt |ƒfƒqW|j dƒ|j ƒdS(sf write_make_fragment(output_path) -> None Generate a Makefile fragment which includes all of the collated LLVMBuild information in a format that is easily digestible by a Makefile. The exact contents of this are closely tied to how the LLVM Makefiles integrate LLVMBuild, see Makefile.rules in the top-level. ROsD#===-- %s - LLVMBuild Configuration for LLVM %s-*- Makefile -*--===#RQiPRLs %s # # The LLVM Compiler Infrastructure # # This file is distributed under the University of Illinois Open Source # License. See LICENSE.TXT for details. # #===------------------------------------------------------------------------===# # # This file contains the LLVMBuild project information in a format easily # consumed by the Makefile based build system. # # This file is autogenerated by llvm-build, do not edit! # #===------------------------------------------------------------------------===# s¯# Clients must explicitly enable LLVMBUILD_INCLUDE_DEPENDENCIES to get # these dependencies. This is a compromise to help improve the # performance of recursive Make systems. s+ifeq ($(LLVMBUILD_INCLUDE_DEPENDENCIES),1) s6# The dependencies for this Makefile fragment itself. s%s: \ s %s \ s sY# The dummy targets to allow proper regeneration even when files are moved or # removed. s%s: sendif N( RRR R R RRRYRSRUR]RR\( R&R^RžRgRlRmRnRoRz((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytwrite_make_fragment@s.        (t__name__t __module__t staticmethodRRR'RERJRqRtFalseR‘RRŸR (((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyR@s  ^  t i  ) Qc@s™td„|jDƒƒ}idd6dd6dd6j|j|jƒ}|dkr[d}n^|j|ƒ}|dkr|jd|jfƒn|jdkr¹|jd|jfƒn|jdkr×|jƒ}n¯d |jkrø|jj ƒ}n|jj d ƒ}g}xs|D]k}|j|ƒ} | dkrO|jd |fƒn| jdkru|jd |fƒn|j | ƒqW‡fd †} td„|jDƒƒ‰| dƒ} | dƒ} | dƒ} | dƒ}x*|D]"}| j j |j ƒt |_qåW|rG|jrG| j j |j ƒ| j j d|j ƒn|r…|jr…|jr…|j j dƒ|j j | j ƒn|j j dƒdS(s\add_magic_target_components(project, opts) -> None Add the "magic" target based components to the project, which can only be determined based on the target configuration options. This currently is responsible for populating the required_libraries list of the "all-targets", "Native", "NativeCodeGen", and "Engine" components. cs@s-|]#}|jdkr|j|fVqdS(RuN(RFR)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys stX86tx86tx86_64tUnknowns*invalid native target: %r (not in project)Rus(invalid native target: %r (not a target)RKRMs-invalid target to enable: %r (not in project)s+invalid target to enable: %r (not a target)c@sŸˆj|ƒ}|dkr/td|fƒn|jdkrRtd|fƒn|jrrtd|dfƒn|jr’td|dfƒnt|_|S(Ns0expected project to contain special %r componentRts-special component %r should be a LibraryGroups,special component %r must have empty %r listRR‚(R/R#RRFRR‚R€t_is_special_group(R)R(tinfo_map(sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytfind_special_group¿s    cs@s|]}|j|fVqdS(N(R)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys Óss all-targetstNativet NativeCodeGentEngines %sCodeGentJITt InterpreterN(tdictR"R#R/t native_targetterrorRFtenable_targetsRƒtsplitR2RR)R€R|thas_jit(tparsertprojecttoptstavailable_targetstnative_target_nameR²R´tenable_target_namesR)ttargetR«t all_targetst native_grouptnative_codegen_groupt engine_groupR,((RªsD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytadd_magic_target_components„s^                   c C@sxddlm}m}|dƒ}||dƒ}|jddddd d d d d dddƒ|jddddd dd dddd d ƒ|jddddd d d dd dddƒ|j|ƒ||dƒ}|jddddd dd ddtƒ|jddddd dd dddd d ƒ|jddddd d d d d dddƒ|jdd!dd"d d d d#d dddƒ|jdd$dd%d d d d&d dddƒ|jdd'dd(d d)d d*d d+ddƒ|j|ƒ||d,ƒ}|jdd-dd.d d/d d0d dddƒ|jdd1dd2d d3d d4d dddƒ|jdd5dd6d d3d d7d dddƒ|j|ƒ|jƒ\}}|j}|r÷t j j t j j |d8d9d:ƒƒsv|j d;|ƒqvnt j jtƒ}t j j|ƒ}t j j|ƒ} t j j| ƒ}t j j t j j |d8d9d:ƒƒsv|j d<ƒn|jp‚|} tj|| ƒ} t|| |ƒ| jƒ|jrÇ| jƒn|jrã| j|jƒn|jr| j|j|jƒn|jr!| j|jƒn|jr=| j|jƒn|jrt|js_|j d=ƒng| jD]} | jd>kri| ^qi} d?d@j dA„| DƒƒfdBd@j dC„| DƒƒfdDd@j dE„| DƒƒfdFd@j dG„| Dƒƒfg}xq|jD]c}t j j ||dHƒ}t j j |j|ƒ}t j!|||ƒ}|s t"dI|ƒq q WndS(JNi(t OptionParsert OptionGroupsusage: %prog [options]s Input OptionsRLs --source-roottdestR tmetavartPATHthelps/Path to the LLVM source (inferred if not given)tactiontstoretdefaults--llvmbuild-source-rootRs=If given, an alternate path to search for LLVMBuild.txt filess --build-roott build_roots2Path to the build directory (if needed) [%default]sOutput Optionss --print-treeRJs/Print out the project component tree [%default]t store_trues--write-llvmbuildtwrite_llvmbuilds)Write out the LLVMBuild.txt files to PATHs--write-library-tableRs.Write the C++ library dependency table to PATHs--write-cmake-fragmentRŸs+Write the CMake project information to PATHs--write-make-fragmentR s.Write the Makefile project information to PATHs--configure-target-def-filetconfigure_target_def_filessJConfigure the given file at SUBPATH (relative to the inferred or given source root, and with a '.in' suffix) by replacing certain substitution variables with lists of targets that support certain features (for example, targets with AsmPrinters) and write the result to the build root (as given by --build-root) at the same SUBPATHtSUBPATHR2sConfiguration Optionss--native-targetR²tNAMEs?Treat the named target as the 'native' one, if given [%default]s--enable-targetsR´tNAMESs]Enable the given space or semi-colon separated list of targets, or all targets if not presents--enable-optional-componentstoptional_componentssJEnable the given space or semi-colon separated list of optional componentstlibtIRs Function.cppsinvalid LLVM source root: %rs0unable to infer LLVM source root, please specifys@must specify --build-root when using --configure-target-def-fileRus@LLVM_ENUM_TARGETS@RKcs@s|]}d|jVqdS(sLLVM_TARGET(%s)N(R)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys mss@LLVM_ENUM_ASM_PRINTERS@cs@s%|]}|jrd|jVqdS(sLLVM_ASM_PRINTER(%s)N(thas_asmprinterR)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys pss@LLVM_ENUM_ASM_PARSERS@cs@s%|]}|jrd|jVqdS(sLLVM_ASM_PARSER(%s)N(t has_asmparserR)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys tss@LLVM_ENUM_DISASSEMBLERS@cs@s%|]}|jrd|jVqdS(sLLVM_DISASSEMBLER(%s)N(thas_disassemblerR)(R*R,((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pys xss.ins!configured file %r hasn't changed(#toptparseRÃRÄt add_optionR#tadd_option_groupR¤t parse_argsR R R R RR³RRR”RRRRÂRERJRÎRqRRÓR RŸRÏRÌR"RFt configutiltconfigure_filetnote(RÃRÄR·tgroupR¹targsR Rtllvm_build_patht utils_pathRt project_infoR,Rºt substitutionsRtinpathtoutpathtresult((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pytmainîsÐ                                         t__main__(t __future__RR R•tllvmbuild.componentinfoRtllvmbuild.configutilRÝtllvmbuild.utilRRRR tobjectRRÂRéR¡(((sD/home/saiko/haskell/LibClang/llvm/utils/llvm-build/llvmbuild/main.pyts      ÿÿF j –