
    <h$                    |   S SK Jr  S SKrS SKrS SKrS SKrSSKJrJ	r	  SSKJ
r
  SSKJrJr  SSKJr  SS	KJrJrJr  SS
KJrJrJrJrJr  SSKJrJr  SSKJr  \R8                  (       a.  SSKJr  SSKJr  SSK J!r!  S SK"J#r#   " S S\#5      r$ " S S\#5      r% " S S\RL                  5      r' " S S\5      r(SS jr)g)    )annotationsN   )ExtensionModule
ModuleInfo)ModuleReturnValue   )mesonlibbuild)mlog)DEPEND_FILES_KW
DEPENDS_KWINCLUDE_DIRECTORIES)ContainerTypeInfo
FeatureNew	KwargInfotyped_kwargstyped_pos_args)MachineChoiceMesonException)ExternalProgram)ModuleState)Compiler)Interpreter)	TypedDictc                  >    \ rS rSr% S\S'   S\S'   S\S'   S\S	'   S
rg)CompileResources   T.List[mesonlib.FileOrString]depend_files6T.List[T.Union[build.BuildTarget, build.CustomTarget]]dependsz'T.List[T.Union[str, build.IncludeDirs]]include_directorieszT.List[str]args N__name__
__module____qualname____firstlineno____annotations____static_attributes__r$       {/mnt/mint/home/seanl/mnt/public/Repos/ladybird/Build/vcpkg/downloads/tools/meson-1.9.0-d1fcc2/mesonbuild/modules/windows.pyr   r      s    33GGDDr,   r   c                  R    \ rS rSr% S\S'   S\S'   S\S'   S\S	'   S
\S'   S\S'   Srg)RcKwargs#   stroutputz?T.List[T.Union[mesonlib.FileOrString, build.CustomTargetIndex]]inputzT.Optional[str]depfiler   r   r    r!   z%T.List[T.Union[str, ExternalProgram]]commandr$   Nr%   r$   r,   r-   r/   r/   #   s%    NN  33GG66r,   r/   c                       \ rS rSrSrSrSrSrg)ResourceCompilerType+   r   r      r$   N)r&   r'   r(   r)   windresrcwrcr+   r$   r,   r-   r7   r7   +   s    G	
B
Cr,   r7   c                  2  ^  \ rS rSr\" S5      rSU 4S jjrSS jrSS jr\	" S\
\R                  \R                  \R                  4SS9\" S\R$                  " S	S
9\R$                  " S	S
9\\" S\" \\
5      / SS95            SS j5       5       rSrU =r$ )WindowsModule0   windowsc                   > [         TU ]  U5        S U l        U R                  R	                  SU R
                  05        g )Ncompile_resources)super__init___rescompmethodsupdaterB   )selfinterpreter	__class__s     r-   rD   WindowsModule.__init__4   s9    %TX!7!7
 	r,   c                @    S H  nX!;   d  M
  X   s  $    [        S5      e)N)ccppz2Resource compilation requires a C or C++ compiler.)r   )rH   	compilersls      r-   detect_compilerWindowsModule.detect_compiler;   s'    A~ |#  QRRr,   c                    [         R                  nU R                  (       a  U R                  $ [        R                  " UR
                  US5      nU(       a  UR                  5       (       d  U R                  UR
                  R                  R                  U   5      nUR                  S;   d+  UR                  (       a%  UR                  R                  S;   a  [        SSS9nO
[        SSS9nUR                  5       (       d  [        S5      eSS	[        R                  4SS
[        R                  4SS[        R                  4SS[        R                   44 H  u  pVn["        R$                  " UR'                  5       U/-   5      u  pn
[(        R*                  " Xi[(        R,                  5      nU(       d  M_  [.        R0                  " SUR3                  5       -  5        X74U l          U R                  $    [        S5      e)Nr:   >   msvcclang-clintel-cl>   linklld-linkr;   T)silentz(Could not find Windows resource compilerz/?z"^.*Microsoft.*Resource Compiler.*$zLLVM Resource Converter.*$z	--versionz^.*GNU windres.*$z^.*Wine Resource Compiler.*$zWindows resource compiler: %sz5Could not determine type of Windows resource compiler)r   HOSTrE   r   from_bin_listenvironmentfoundrQ   coredatarO   idlinkerr   r7   r;   r:   r<   r	   
Popen_safeget_commandresearch	MULTILINEr   loggroup)rH   statefor_machinerescompcompargmatchrc_typepoems               r-   _find_resource_compiler%WindowsModule._find_resource_compilerA   s    $((====  "//0A0A;PYZgmmoo''(9(9(B(B(L(L[(YZDww::t{{t{{~~auOu)$t<))DA}} !KLL ;=Q=T=TU35I5L5LM13G3O3OP<>R>V>VW	&
!S ))'*=*=*?3%*GHGA!		%BLL1Aq81779DE!( 2 }}&
 !!XYYr,   zwindows.compile_resourcesr   )varargsmin_varargsz0.47.0)sincer#   T)defaultlistifyc                &  ^^ US   R                  5       nUS   nUS   nU H  n[        U[        R                  5      (       d  M$  UTR	                  [        R
                  " S/ S[        R                  R                  SU R                  R                  R                  U5      5      /5      /5      -  nM     UTR	                  US   5      -  nU R                  T5      u  pU	[        R                  :X  a
  Sn
U/ S	Q-   nO^U	[        R                  :X  aA  S
n
USS/-   nSnU H/  nSU;   d  M  [         R"                  " UR%                  U5      SS9  M1     O	S
n
U/ SQ-   n/ nSUU4S jjnU" 5        GH  u  nnnUR'                  SS5      R'                  SS5      R'                  SS5      nUR'                  SS5      R'                  SS5      R'                  SS5      nU SU
 3n/ nUR)                  U5        UR+                  U5        S nU	[        R                  :X  a  U S3nUR+                  / SQ5        UR)                  [        R                  " UTR,                  TR.                  TR0                  UU/U/UUUSS95        GM     [3        X/5      $ )Nr#   r   r!    Fz@BUILD_ROOT@r"   res)z/nologoz/fo@OUTPUT@@INPUT@rp   r}   @OUTPUT@zArgument {!r} has a space which may not work with windres due to a MinGW bug: https://sourceware.org/bugzilla/show_bug.cgi?id=4933 )fatal)r}   z-or~   c               3    >#    TS    GH  n [        U [        5      (       a0  [        R                  R	                  TR
                  U 5      X 4v   MI  [        U [        R                  5      (       a!  U R                  5       U R                  U 4v   M  [        U [        R                  5      (       a  [        R                  " SSTR                  TR                  S9  U R!                  5        SU R"                  R%                  5       R'                  U R(                  5       3SU R+                  5        3U 4v   GM2  [-        U R%                  5       5      S:  a+  [        R                  " SSTR                  TR                  S9  [/        U R%                  5       5       H'  u  pU R!                  5        SU 3SU SU 3X   4v   M)     GM     g 7f)	Nr   zBwindows.compile_resource CustomTargetIndex in positional argumentsz0.61.0)location_windows_compile_resources_r   zSwindows.compile_resource CustomTarget with multiple outputs in positional arguments)
isinstancer1   ospathjoinsubdirr	   Filerelative_namefnamer
   CustomTargetIndexr   
single_use
subprojectcurrent_nodeget_idtargetget_outputsindexr2   get_filenamelen	enumerate)srcioutr#   rh   s      r-   	get_names2WindowsModule.compile_resources.<locals>.get_names   s    Awc3'''',,u||S93CCX]]33++-syy#==U%<%<==))*npx*/*:*:UEWEWY "jjl^1SZZ-C-C-E-K-KCJJ-W,XY78H8H8J7KLcS S 3??,-1"--  /D.68H8HSXSeSeg"+COO,="> "%as37QRSQTTUVYUZ5[]`]ccc #?! s   G
G/r   \:z_@BASENAME@.z.d)z--preprocessor-arg=-MDz--preprocessor-arg=-MQ@OUTPUT@z--preprocessor-arg=-MF@DEPFILE@zCompiling Windows resource {})r4   r   extra_dependsdescription)returnzST.Iterable[T.Tuple[str, str, T.Union[str, mesonlib.File, build.CustomTargetIndex]]])copyr   r
   CustomTargetget_include_argsIncludeDirsr   r   r   rI   backendget_target_dirrs   r7   r;   r:   r   warningformatreplaceappendextendr   r   r\   r   )rH   rh   r#   kwargs
extra_argswrc_depend_fileswrc_dependsdrj   rescomp_typesuffixres_argsrr   rl   res_targetsr   namename_formattedr   r2   r5   r4   s    ``                   r-   rB   WindowsModule.compile_resourcesi   s    F^((*
!.1Y'A!U//00e44%%b"ebggll>SWScScSkSkSzSz{|S}6~5  A6  
 
 	e,,V4I-JKK
 $ < <U C/222 F!$IIH1999 F!Y
$;;HTA!#:LL#e< " F!$AAH24	d 	d, *3%D.#<<S)11$<DDS#ND+33C=EEdCPXXY\^abNv\&2F=?GNN7#NN8$'+G3;;;#HB-  C D u11  !!-);  ! *5< !m<<r,   )rE   )rI   'Interpreter')rO   zT.Dict[str, 'Compiler']r   z
'Compiler')rh   'ModuleState'r   z.T.Tuple[ExternalProgram, ResourceCompilerType])rh   r   r#   zYT.Tuple[T.List[T.Union[str, mesonlib.File, build.CustomTarget, build.CustomTargetIndex]]]r   z'CompileResources'r   r   )r&   r'   r(   r)   r   INFOrD   rQ   rs   r   r1   r	   r   r
   r   r   r   r   evolver   r   r   r   listrB   r+   __classcell__)rJ   s   @r-   r>   r>   0   s    i DS&P /#x}}eN`N`bgbyby9z  IJ  K#X.)&+D#6DQY= yY="4Y=9JY= KY=r,   r>   c                    [        U 5      $ )N)r>   )interps    r-   
initializer      s      r,   )r   r   r   r>   )*
__future__r   enumr   rc   typingTr{   r   r   r   r	   r
   r   interpreter.type_checkingr   r   r   interpreterbase.decoratorsr   r   r   r   r   r   r   programsr   TYPE_CHECKINGr   rO   r   rI   r   typing_extensionsr   r   r/   Enumr7   r>   r   r$   r,   r-   <module>r      s    #  	 	  *    X X o o 4 &??$)+9 79 7499 
Z=O Z=x!r,   