+
    UBisp                    j   ^ RI Ht ^ RIHt ^RIHtHtHtHt ^RI	H
t
HtHtHtHtHtHtHt ^RIHt ^RIHtHt ^RIHt ^ RIHt ^ R	IHt ^ R
It^ R
It^ R
It^ R
It ] PB                  '       d%   ^ RI"H#t# ^RI$H%t% ^RI&H't' ^RI(H)t) ^RI*H+t+ ^RIH,t,  ! R R4      t- ! R R]-4      t. ! R R]4      t/R
# )    )annotations)Path)ExternalDependencyDependencyExceptionsort_libpathsDependencyTypeName)EnvironmentVariables
OrderedSet
PerMachine
Popen_safePopen_safe_loggedMachineChoice	join_argsMesonException)	OptionKey)find_external_programExternalProgram)mlog)PurePath)	lru_cacheN)Literal)ImmutableListProtocol)Environment)EnvironOrDict)PkgConfigDefineType)DependencyObjectKWsc                  J   ] tR t^t$ Rt]! / / 4      tR]R&   ]! / / 4      tR]R&   ]! RR4      t	R]R&   ]
R	 R
 l4       t]
R"R R ll4       t]
R#R R ll4       t]
R$R R ll4       t]
R%R R ll4       tR R ltR R ltR R ltR$R R lltR&R R lltR R ltR R  ltR!tR# )'PkgConfigInterfacez/Base class wrapping a pkg-config implementationzjPerMachine[T.Dict[T.Optional[T.Tuple[str, ...]], T.Union[Literal[False], T.Optional[PkgConfigInterface]]]]
class_implzdPerMachine[T.Dict[T.Optional[T.Tuple[str, ...]], T.Union[Literal[False], T.Optional[PkgConfigCLI]]]]class_cli_implNz'PerMachine[T.Optional[ExternalProgram]]pkg_bin_per_machinec               $    V ^8  d   QhRRRRRR/# )   pkg_binr   for_machiner   returnNone )formats   "F/usr/lib/python3.14/site-packages/mesonbuild/dependencies/pkgconfig.py__annotate__PkgConfigInterface.__annotate__'   s'     F Fo FM FVZ F    c                	    \         P                  V,          '       d   \        R V R24      hV \         P                  V&   R# )z)Tried to override pkg-config for machine zP but it was already initialized.
pkg-config must be overridden before it's used.N)r   r   r   r!   )r$   r%   s   &&r*   set_program_override'PkgConfigInterface.set_program_override&   sG    ((55 #L[M ZT "T U U>E..{;r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   envr   r%   r   silentboolextra_pathsT.Optional[T.List[str]]r&   zT.Optional[PkgConfigInterface]r(   )r)   s   "r*   r+   r,   .   s1      k  t 5A_r-   c                   V P                  4       '       d   TM\        P                  pVe   \        V4      MRp\        P
                  V,          P                  VR4      pVRJ d   \        WV\        P                  V,          V4      pVP                  4       '       g   RpV'       g4   V'       g,   \        P                  ! R\        P                  ! R4      4       V\        P
                  V,          V&   V# )z,Return a pkg-config implementation singletonNFFound pkg-config:NO)is_cross_buildr   HOSTtupler   r   getPkgConfigCLIr!   foundr   logred)r2   r%   r3   r5   extra_paths_keyimpls   &&&&  r*   instancePkgConfigInterface.instance-   s     &)%7%7%9%9k}?Q?Q0;0G%,T!,,[9==ouU5=&:L:`:`al:moz{D::<<,dhhtn=JN))+6Gr-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r2   r   r%   r   r5   r6   r3   r4   r&   T.Optional[PkgConfigCLI]r(   )r)   s   "r*   r+   r,   >   s2     8 8+ 8M 8188&>8r-   c                   V P                  4       '       d   TM\        P                  p\        P	                  WV4      pV'       d   \        V\        4      '       g   Ve   \        V4      MRp\        P                  V,          P                  VR4      pVRJ dV   \        WV\        P                  V,          V4      pVP                  4       '       g   RpV\        P                  V,          V&   \        P                  ! RV4      # )zReturn the CLI pkg-config implementation singleton
Even when we use another implementation internally, external tools might
still need the CLI implementation.
NFrG   )r:   r   r;   r   rD   
isinstancer>   r<   r    r=   r!   r?   Tcast)r2   r%   r5   r3   rC   rB   s   &&&&  r*   _cliPkgConfigInterface._cli=   s     &)%7%7%9%9k}?Q?Q!**3VD
4664?4KeK0QUO%44[AEEoW\]Du}#Cf>P>d>dep>qs~zz||DRV"11+>Ovv0$77r-   c          
     ,    V ^8  d   QhRRRRRRRRR	R
/# )r#   r2   r   r%   r   uninstalledr4   r5   r6   r&   r	   r(   )r)   s   "r*   r+   r,   S   s8     L L[ L} L4 L4L@TLr-   c                	t    \         P                  WV4      pV'       d   VP                  V4      # \        4       # N)r   rL   _get_envr	   )r2   r%   rO   r5   clis   &&&& r*   get_envPkgConfigInterface.get_envR   s0     !%%cD,/s||K(K5I5KKr-   c          
     ,    V ^8  d   QhRRRRRRRRR	R/# )
r#   environr   r2   r   r%   r   rO   r4   r&   r(   )r)   s   "r*   r+   r,   Y   s8     H H= H{ H H#H0=Hr-   c                	b    \         P                  W4      pV'       d   VP                  W4      # T # rQ   )r   rL   
_setup_env)rW   r2   r%   rO   rS   s   &&&& r*   	setup_envPkgConfigInterface.setup_envX   s*     !%%c77:s~~g3GGr-   c               $    V ^8  d   QhRRRRRR/# )r#   r2   r   r%   r   r&   r'   r(   )r)   s   "r*   r+   r,   ^   s!     ' 'K 'm ' 'r-   c                	    Wn         W n        R # rQ   r2   r%   )selfr2   r%   s   &&&r*   __init__PkgConfigInterface.__init__^   s    &r-   c                   V ^8  d   QhRR/# r#   r&   r4   r(   )r)   s   "r*   r+   r,   b   s     " "t "r-   c                    \         h)z&Return whether pkg-config is supportedNotImplementedErrorr_   s   &r*   r?   PkgConfigInterface.foundb       !!r-   c                    V ^8  d   QhRRRR/# r#   namestrr&   T.Optional[str]r(   )r)   s   "r*   r+   r,   f   s     " "C "O "r-   c                    \         h)z*Return module version or None if not foundre   )r_   rl   s   &&r*   versionPkgConfigInterface.versionf   ri   r-   c               (    V ^8  d   QhRRRRRRRR/# 	r#   rl   rm   allow_systemr4   define_variabler   r&   ImmutableListProtocol[str]r(   )r)   s   "r*   r+   r,   j   s*     " "3 "d " 3"?Y"r-   c                    \         h)zRReturn module cflags
@allow_system: If False, remove default system include paths
re   )r_   rl   rt   ru   s   &&&&r*   cflagsPkgConfigInterface.cflagsj   s
    
 "!r-   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# 
r#   rl   rm   staticr4   rt   ru   r   r&   rv   r(   )r)   s   "r*   r+   r,   q   s1     " " "d "$ "1"=W"r-   c                    \         h)zReturn module libs
@static: If True, also include private libraries
@allow_system: If False, remove default system libraries search paths
re   )r_   rl   r|   rt   ru   s   &&&&&r*   libsPkgConfigInterface.libsq   s
     "!r-   c               (    V ^8  d   QhRRRRRRRR/# r#   rl   rm   variable_nameru   r   r&   rn   r(   )r)   s   "r*   r+   r,   y   s*     " "S " ""5":I"r-   c                    \         h)z9Return module variable or None if variable is not definedre   )r_   rl   r   ru   s   &&&&r*   variablePkgConfigInterface.variabley   s
     "!r-   c                   V ^8  d   QhRR/# r#   r&   rv   r(   )r)   s   "r*   r+   r,   ~   s     " "4 "r-   c                    \         h)z'Return all available pkg-config modulesre   rg   s   &r*   list_allPkgConfigInterface.list_all~   ri   r-   r^   rQ   )NFFNFFFN)__name__
__module____qualname____firstlineno____doc__r   r   __annotations__r    r!   staticmethodr/   rD   rL   rT   rZ   r`   r?   rp   rx   r~   r   r   __static_attributes__r(   r-   r*   r   r      s    9 ~H  IK  MO  ~PJz  P |F  GI  KM  |NNx  NCMdTXCY@YF F   8 8( L L
 H H
'"""""
" "r-   r   c                  v  a  ] tR t^tRtR!R V 3R llltR R lt]! RR7      R R	 l4       t]	R
 R l4       t
]! RR7      R"R R ll4       t]! RR7      R#R R ll4       t]! RR7      R R l4       t]! RR7      R R l4       t]	R R l4       tR$R R lltR R ltR%R R lltR%R R lltR$R R lltR tV ;t# )&r>   zpkg-config CLI implementationNc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r#   r2   r   r%   r   r3   r4   pkgbinT.Optional[ExternalProgram]r5   r6   r&   r'   r(   )r)   s   "r*   r+   PkgConfigCLI.__annotate__   s9     - -K -m -T -4-5-AE-r-   c           	     	  < \         SV `  W4       V P                  V4       V P                  '       d   V'       g|   \        P
                  ! R \        P                  ! R4      \        P                  ! RV P                  P                  4        R24      \        P                  ! V P                  4      4       T;'       g    . V n        R# )r8   YES()N)superr`   _detect_pkgbinr   r   r@   greenboldget_pathbluepkgbin_versionr5   )r_   r2   r%   r3   r   r5   	__class__s   &&&&&&r*   r`   PkgConfigCLI.__init__   s     	*F#;;;vHH($**U*;TYY4;;K_K_KaJbbcGd=egkgpgpqu  rE  rE  hF  G&,,"r-   c                   V ^8  d   QhRR/# rc   r(   )r)   s   "r*   r+   r      s     ! !t !r-   c                	,    \        V P                  4      # rQ   )r4   r   rg   s   &r*   r?   PkgConfigCLI.found   s    DKK  r-   )maxsizec                    V ^8  d   QhRRRR/# rk   r(   )r)   s   "r*   r+   r      s     - -C -O -r-   c                	    \         P                  ! R V: RV P                  P                  4       : 24       V P	                  RV.4      w  r#pV^ 8X  d   V# R# )zDetermining dependency z with pkg-config executable z--modversionN)r   debugr   r   _call_pkgbin)r_   rl   retrp   _s   &&   r*   rp   PkgConfigCLI.version   sX    

,TH4PQUQ\Q\QeQeQgPjkl++^T,BCa(w,,r-   c                    V ^8  d   QhRRRR/# )r#   ru   r   r&   T.List[str]r(   )r)   s   "r*   r+   r      s      /B { r-   c                	z    . pV '       d1   V  F*  pVP                  R RP                  V4      ,           4       K,  	  V# )z--define-variable==)appendjoin)ru   r   pairs   &  r*   _define_variable_args"PkgConfigCLI._define_variable_args   s3    '

/#((4.@A (
r-   c               (    V ^8  d   QhRRRRRRRR/# rs   r(   )r)   s   "r*   r+   r      s*     % %3 %d % 3%?Y%r-   c                	"   R pV'       d$   \         P                  P                  4       pRVR&   . pWPP                  V4      ,          pVRV.,          pV P	                  WTR7      w  rgpV^ 8w  d   \        RV RV R24      hV P                  V4      # )N1PKG_CONFIG_ALLOW_SYSTEM_CFLAGSz--cflagsr2   zCould not generate cflags for :

)osrW   copyr   r   r   _split_args)	r_   rl   rt   ru   r2   argsr   outerrs	   &&&&     r*   rx   PkgConfigCLI.cflags   s     **//#C47C01**?;;T""))$)8#!8%(FtfCPSuTV&WXX$$r-   c          
     ,    V ^8  d   QhRRRRRRRRRR	/# r{   r(   )r)   s   "r*   r+   r      s1     % % %d %$ %1%=W%r-   c                	T   R pV'       d$   \         P                  P                  4       pRVR&   . pW`P                  V4      ,          pV'       d   VP	                  R4       VRV.,          pV P                  WeR7      w  rxp	V^ 8w  d   \        RV RV	 R24      hV P                  V4      # )	Nr   PKG_CONFIG_ALLOW_SYSTEM_LIBSz--staticz--libsr   zCould not generate libs for r   r   )r   rW   r   r   r   r   r   r   )
r_   rl   r|   rt   ru   r2   r   r   r   r   s
   &&&&&     r*   r~   PkgConfigCLI.libs   s     **//#C25C./**?;;KK
#4  ))$)8#!8%(DTF#cURT&UVV$$r-   c               (    V ^8  d   QhRRRRRRRR/# r   r(   )r)   s   "r*   r+   r      s*      S  "5:Ir-   c                	   . pW@P                  V4      ,          pVR V,           V.,          pV P                  V4      w  rVpV^ 8w  d   \        RV RV R24      hVP                  4       pV'       gI   V P                  RV.4      w  rVp	\        P
                  ! RV R2V\        P                  4      '       g   R# \        P                  ! RV R	V 24       V# )
z--variable=zCould not get variable for r   r   z--print-variables^$NzGot pkg-config variable z : )	r   r   r   stripresearch	MULTILINEr   r   )
r_   rl   r   ru   r   r   r   r   r   r   s
   &&&&      r*   r   PkgConfigCLI.variable   s     **?;;.55))$/#!8%(CD6SEQS&TUU99; ++-@$,GHKCa99-2CFF

-m_CzJKr-   c                   V ^8  d   QhRR/# r   r(   )r)   s   "r*   r+   r      s     > >4 >r-   c                	    V P                  R .4      w  rpV^ 8w  d   \        RV R24      hVP                  4        Uu. uF  qDP                  R^4      ^ ,          NK  	  up# u upi )z
--list-allzcould not list modules:
r    )r   r   
splitlinessplit)r_   r   r   r   is   &    r*   r   PkgConfigCLI.list_all   se    ))<.9#!8%(A#b&IJJ,/NN,<=,<qQ"",<===s   !A"c                    V ^8  d   QhRRRR/# )r#   cmdrm   r&   r   r(   )r)   s   "r*   r+   r      s            r-   c                	.    \         P                  ! V 4      # rQ   )shlexr   )r   s   &r*   r   PkgConfigCLI._split_args   s     {{3r-   c                    V ^8  d   QhRRRR/# )r#   r   r   r&   r'   r(   )r)   s   "r*   r+   r      s      %@ D r-   c           	     	   a  R  V 3R llpV'       d   V! V4      '       d   R# \        S P                  S P                  RRS P                  P                  RR7       F  pV! V4      '       g   K   R# 	  RS n        R# )c                    V ^8  d   QhRRRR/# )r#   potential_pkgbinr   r&   r4   r(   )r)   s   "r*   r+   1PkgConfigCLI._detect_pkgbin.<locals>.__annotate__   s     	 	 	4 	r-   c                Z   < SP                  V 4      pV'       d   V Sn        VSn        R # R# )TF)_check_pkgconfigr   r   )r   version_if_okr_   s   & r*   validate-PkgConfigCLI._detect_pkgbin.<locals>.validate   s,     112BCM.&3#r-   Nz
pkg-configz
Pkg-configF)allow_default_for_cross)r   r2   r%   default_pkgconfigr   )r_   r   r   r   s   f&  r*   r   PkgConfigCLI._detect_pkgbin   sm    	 	 hv&& 5dhh@P@PR^`l6:hh6P6Pjo!q())!q r-   c                    V ^8  d   QhRRRR/# )r#   r   r   r&   rn   r(   )r)   s   "r*   r+   r      s       ? r-   c                	L   VP                  4       '       g'   \        P                  ! R VP                  : 24       R# RP	                  VP                  4       4      p \        VP                  4       R.,           4      ^,          pRV9   d   \        P                  ! RV: R24       R# \        VP                  4       R.,           4      R,          w  rEVP                  ^ 8w  d   \        P                  ! RV: R	24       R#  VP                  4       #   \         d     \        P                  ! R
T: R24        R# \         d_    RT: R2pT P                  P                  P                  P                  4       '       g
   TR,          p\        P                  ! T4        R# i ; i)z Did not find pkg-config by name Nr   z--helpz	Pure-PerlzFound pkg-config z7 but it is Strawberry Perl and thus broken. Ignoring...z	--version:r   r#   Nz but it failed when ranzWe thought we found pkg-config z! but now it's not there. How odd!z' but didn't have permissions to run it.zO

On Unix-like systems this is often caused by scripts that are not executable.)r?   r   r@   rl   r   get_commandr   
returncodewarningFileNotFoundErrorPermissionErrorr2   machinesbuild
is_windowsr   )r_   r   command_as_stringhelptextpr   msgs   &&     r*   r   PkgConfigCLI._check_pkgconfig   sc   ||~~HH7GHHHV%7%7%9:	!&"4"4"6("CDQGHh&,->,AAxyz 2 2 4} DEcJFA||q 01B0EE\]^ ! yy{ ! 	LL:;L:OOqrs 	%&7%::bcC88$$**5577jjLL	s,   A
D )AD &F#;F#;F# F#"F#c                    V ^8  d   QhRRRR/# )r#   rO   r4   r&   r	   r(   )r)   s   "r*   r+   r   
  s      D 5I r-   c                	t   \        4       p\        R V P                  R7      pV P                  P                  P
                  P                  V4      p\        V\        4      '       g   Q hW@P                  ,           pV'       dQ   V P                  P                  4       pVe3   \        VR4      P                  4       pWu9  d   VP                  ^ V4       VP                  RV4       V P                  P                  V P                  ,          P!                  4       pV'       d   VP                  RV.4       V P                  P                  V P                  ,          P#                  4       p	V	'       d   VP                  RV	4       VP                  R\%        V P&                  P)                  4       4      .4       V# )pkg_config_pathmachinezmeson-uninstalledPKG_CONFIG_PATHPKG_CONFIG_SYSROOT_DIRPKG_CONFIG_LIBDIR
PKG_CONFIG)r	   r   r%   r2   coredataoptstoreget_value_forrI   listr5   get_build_dirr   as_posixinsertset
propertiesget_sys_rootget_pkg_config_libdirr   r   r   )
r_   rO   r2   keypathlistr5   bpathuninstalled_pathsysrootpkg_config_libdir_props
   &&        r*   rR   PkgConfigCLI._get_env
  sL   "$)43C3CD88$$--;;C@(D))))#+.>.>#>HH**,E #'/B#C#L#L#N #6&&q*:;!;/((%%d&6&67DDFGG,wi8!%!4!4T5E5E!F!\!\!^!GG')?@y)@)@)BCDE
r-   c               $    V ^8  d   QhRRRRRR/# )r#   r2   r   rO   r4   r&   zT.Dict[str, str]r(   )r)   s   "r*   r+   r   !  s"      m $ K[ r-   c                	    V P                  V4      pVP                  V4      pVP                  4        F:  w  rEVP                  R 4      '       g   K  \        P
                  ! RV RV 24       K<  	  V# )PKG_zenv[z]: )rR   rT   items
startswithr   r   )r_   r2   rO   envvarsr  values   &&&   r*   rY   PkgConfigCLI._setup_env!  s_    --,ooc"))+JC~~f%%

T#c%12 & 
r-   c               $    V ^8  d   QhRRRRRR/# )r#   r   r   r2   zT.Optional[EnvironOrDict]r&   zT.Tuple[int, str, str]r(   )r)   s   "r*   r+   r   *  s#     6 6 63L 6Xn 6r-   c                	R   \        V P                  \        4      '       g   Q hT;'       g    \        P                  pV P                  V4      pV P                  P                  4       V,           p\        W2R 7      w  rEpVP                  VP                  4       VP                  4       3# )r   )
rI   r   r   r   rW   rY   r   r   r   r   )r_   r   r2   r   r   r   r   s   &&&    r*   r   PkgConfigCLI._call_pkgbin*  sz    $++7777RZZooc"kk%%'$.'5||SYY[#))+55r-   )r5   r   r   NNr   r   rQ   r   )r   r   r   r   r   r`   r?   r   rp   r   r   rx   r~   r   r   r   r   r   rR   rY   r   r   __classcell__r   s   @r*   r>   r>      s    '- -! t- -
   t% % t% %  t $ t> >    
$2.6 6r-   r>   c                     a  ] tR tRtR#R V 3R llltR R ltR R ltR	 R
 ltR R ltR R lt	R R lt
R R ltR R ltR R lt]R R l4       tRRRRRRRRRRRRRR/R  R! lltR"tV ;t# )$PkgConfigDependencyi3  Nc               0    V ^8  d   QhRRRRRRRRR	R
RR/# )r#   rl   rm   environmentr   kwargsr   languagern   r5   r6   r&   r'   r(   )r)   s   "r*   r+    PkgConfigDependency.__annotate__5  s:     $  $ S $ { $ DW $ *$ 5$ AE$ r-   c                	  < \         S
V `  \        R 4      W#VR7       Wn        RV n        T;'       g    . V n        \        P                  V P                  V P                  V P                  V P
                  4      pV'       gF   RV P                   R2pV P                  '       d   \        V4      h\        P                  ! V4       R# W`n        V P                  P!                  V4      pVf   R# Wn        RV n         V P%                  4        V P'                  4        R#   \         dV   p	\        P                  ! RT RT	 24       T P                  '       d   h . T n        . T n        RT n        Yn         Rp	?	R# Rp	?	ii ; i)		pkgconfig)r-  FzPkg-config for machine z not found. Giving up.NTzPkg-config error with 'z': )r   r`   r   rl   
is_libtoolr5   r   rD   r2   r%   r3   requiredr   r   r   r0  rp   is_found
_set_cargs	_set_libscompile_args	link_argsreason)r_   rl   r+  r,  r-  r5   r0  r   rp   er   s   &&&&&&    r*   r`   PkgConfigDependency.__init__5  s;    	+K8+X`a	&,,"&//$:J:JDKKY]YiYij	+D,<,<+==STC}}})#..JJsO"..((.?	 OONN" 	 JJ0c!=>}}}$&!!# %	 s   = D E?*A
E::E?c                   V ^8  d   QhRR/# r#   r&   rm   r(   )r)   s   "r*   r+   r.  [  s     + +# +r-   c                	    R pVP                  V P                  P                  V P                  V P                  V P
                  4      # )z<{0} {1}: {2} {3}>)r)   r   r   rl   r3  version_reqs)r_   ss   & r*   __repr__PkgConfigDependency.__repr__[  s9     xx//DMM))+ 	+r-   c                    V ^8  d   QhRRRR/# )r#   r   rv   r&   r   r(   )r)   s   "r*   r+   r.  `  s      )C  r-   c                N   V P                   P                  P                  P                  4       '       g   VP	                  4       # . pV EFW  p\        4       pVP                  R4      '       d    \        VR,          4      P                  pRpMVP                  R4      '       d    \        VR,          4      P                  pRpMvVP                  R4      '       d   \        V4      P                  pRpMGVP                  R4      '       g   \        V4      ^8  d!   V^,          R8X  d   VP                  R	R
4      p\        V4      ^8  dG   \        V^,          4      ^8X  d0   XP                  V^,          RP                  VR,          4      4      pVP                  V4       EKZ  	  V# )z
Both MSVC and native Python on Windows cannot handle MinGW-esque /c/foo
paths so convert them to C:/foo. We cannot resolve other paths starting
with / like /home/foo so leave them as-is so that the user gets an
error/warning from the compiler/linker.
z-L/r#   NNz-L{}:/{}z-I/z-I{}:/{}/z{}:/{}:z\ r   )-Lz-I)r2   r   r   r   r   r<   r  r   partslenreplacer)   r   r   )r_   r   	convertedargpargstmpls   &&    r*   _convert_mingw_paths(PkgConfigDependency._convert_mingw_paths`  s<    xx  &&113399;	C',wE~~e$$ R)//!&& R)//!$$ ++--#c(Q,3q6S=kk%-5zA~#eAh-1"4kk%(CHHU2Y,?@S!% & r-   c                   V ^8  d   QhRR/# r#   r&   r'   r(   )r)   s   "r*   r+   r.    s     > >D >r-   c                	    R pV P                   R8X  d   RpV P                  P                  V P                  V4      pV P	                  V4      V n        R# )FfortranTN)r-  r0  rx   rl   rO  r6  )r_   rt   rx   s   &  r*   r4  PkgConfigDependency._set_cargs  sG    ==I%  L&&tyy,? 55f=r-   c               $    V ^8  d   QhRRRRRR/# )r#   libs_inrv   raw_libs_inr&   z!T.Tuple[T.List[str], T.List[str]]r(   )r)   s   "r*   r+   r.    s-     U( U($> U(Mg U(  mN U(r-   c                
   \        4       pV P                  V4      pV F  pVP                  R4      '       g   K  VP                  R4      '       d   K5  VR,          p\        P                  P                  V4      '       g9   \        P                  P                  V P                  P                  4       V4      pVP                  V4       K  	  V P                  P                  P                  P                  \        RV P                  R7      4      pV P                  V4      p\        \        \!        V4      V4      4      p\        4       pV P                  V4      p	V	 F]  pVP                  R4      '       d   K  VP                  R4      '       g   K5  VR,          V9  g   KE  VP                  VR,          4       K_  	  \!        V4      \!        V4      ,           p
\        4       p. p. pV	 EF5  pVP                  R4      '       d   EMVP                  R4      '       d   K6  VP                  R4      '       d   W9   d   KU  VR,          pRpV
 FL  p\        P                  P                  VV4      p\        P                  P#                  V4      '       g   KJ  Tp M	  VfK   W9   d   K  \$        P&                  ! RP)                  WP*                  4      4       VP-                  V4       EM$TpEM VP                  R	4      '       d   W9   d   EK$  V P.                  '       d1   V P.                  P1                  VR,          WP2                  R
R7      pMRpVeF   VP                  V4       V'       d*   V^ ,          P                  R	4      '       g
   V^ ,          pEMvEK  W9   d   EK  V P4                  '       d8   \$        P&                  ! RP)                  VR,          V P*                  4      4       VP-                  V4       EMVP7                  R4      '       d   V P9                  V4      p\        P                  P                  \        P                  P;                  V4      V4      p\        P                  P#                  V4      '       g?   \        P                  P                  \        P                  P;                  V4      RV4      p\        P                  P#                  V4      '       g   \=        RV R24      hRV n        TpW9   d   EK$  VP-                  V4       EK8  	  V'       d!   V Uu. uF  pRV,           NK  	  upV,           pW3# u upi )a  
@libs_in: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs
@raw_libs_in: pkg-config --libs

We always look for the file ourselves instead of depending on the
compiler to find it with -lfoo or foo.lib (if possible) because:
1. We want to be able to select static or shared
2. We need the full path of the library to calculate RPATH values
3. De-dup of libraries is easier when we have absolute paths

Libraries that are provided by the toolchain or are not found by
find_library() will be added with -L -l pairs.
rG  rD  r  r  z-l::   NNNzJLibrary {!r} not found for dependency {!r}, may not be successfully linkedz-lF)lib_prefix_warningzOStatic library {!r} not found for dependency {!r}, may not be statically linkedz.laz.libszGot a libtools specific "zD" dependenciesbut we could not compute the actual sharedlibrary pathT)z-L-lz-L-L) r
   rO  r  r   pathisabsr   r2   r  addr  r	  r
  r   r%   r   r  existsr   r   r)   rl   r   clib_compilerfind_librarylibtyper|   endswithextract_libtool_shlibdirnamer   r1  )r_   rW  rX  prefix_libpathsraw_link_argsrL  r\  r  system_libpaths	full_argslibpaths
libs_foundlibs_notfoundr7  liblibfilename	foundnamelibdirtargetr   shared_libname
shared_liblps   &&&                    r*   _search_libs PkgConfigDependency._search_libs  s1   2 ,6<11+> C~~d##CNN;K,L,L2www}}T**77<<(>(>(@$GD##D) !  (,xx'8'8'A'A'O'OPYZkuy  vF  vF  QG  (H33OD$]43H/%Z[+5<--g6	C~~.//~~d##B(F##CG,  (4+@@&0l
	C~~.//%%&& $!"g 	&FWW\\&+>Fww~~f--$*		 '
 $+  &BBH&V_V_B`b!((-#C%%$%%%--::B<<E ; SD  D#NN3' #Aw11$77"&q'C  + {{{ &@@Fs2wPTPYPY@Z\!((-e$$!%!;!;C!@WW\\"''//#*>O
ww~~j11!#bggooc.BG^!\Jww~~j11-0I# O= /= > > #' #S!a d  .==_r_=	II'' >s   0Uc                   V ^8  d   QhRR/# rR  r(   )r)   s   "r*   r+   r.    s     O O4 Or-   c                	
   V P                   P                  V P                  V P                  R R7      pV P                   P                  V P                  V P                  RR7      pV P	                  W4      w  V n        V n        R# )T)rt   FN)r0  r~   rl   r|   ru  r7  rg  )r_   r~   raw_libss   &  r*   r5  PkgConfigDependency._set_libs  sf     ~~""499dkk"M >>&&tyy$++E&R-1->->t-N**r-   c               $    V ^8  d   QhRRRRRR/# )r#   la_filerm   	fieldnamer&   rn   r(   )r)   s   "r*   r+   r.  )  s!      S S _ r-   c                	   \        VR R7      ;_uu_ 4       pV FH  pVP                  4       P                  R4      pV^ ,          V8X  g   K2  V^,          ^R u uuRRR4       # 	  RRR4       R#   + '       g   i     R# ; i)zutf-8)encodingr   N)openr   r   )r_   r|  r}  flinearrs   &&&   r*   extract_field!PkgConfigDependency.extract_field)  sk    'G,,jjl((-q6Y&q6!B<'	 -, -
  -,
 s   0A/A/#A//B 	c                    V ^8  d   QhRRRR/# r#   r|  rm   r&   rn   r(   )r)   s   "r*   r+   r.  1       5 5C 5O 5r-   c                	&    V P                  VR 4      # )dlnamer  r_   r|  s   &&r*   extract_dlname_field(PkgConfigDependency.extract_dlname_field1      !!'844r-   c                    V ^8  d   QhRRRR/# r  r(   )r)   s   "r*   r+   r.  4  r  r-   c                	&    V P                  VR 4      # )rp  r  r  s   &&r*   extract_libdir_field(PkgConfigDependency.extract_libdir_field4  r  r-   c                    V ^8  d   QhRRRR/# r  r(   )r)   s   "r*   r+   r.  7  s     ( (S (_ (r-   c                   V P                  V4      pVf   R# V P                  P                  V P                  ,          P	                  4       '       dV   \
        P                  P                  V4      pV P                  V4      pVf   V# \
        P                  P                  WC4      # \
        P                  P                  V4      # )zG
Returns the path to the shared library
corresponding to this .la file
N)
r  r2   r   r%   	is_darwinr   r\  basenamer  r   )r_   r|  r  
dlbasenamerp  s   &&   r*   rd  )PkgConfigDependency.extract_libtool_shlib7  s    
 **73> 88T--.88::))&1J..w7F~!!77<<33 ww''r-   c                   V ^8  d   QhRR/# r<  r(   )r)   s   "r*   r+   r.  M  s      s r-   c                 	    R # )r0  r(   r(   r-   r*   	log_triedPkgConfigDependency.log_triedL  s    r-   cmaker0  
configtoolinternalsystemdefault_valuepkgconfig_definec               8    V ^8  d   QhRRRRRRRRRRRRRR	R
R/# )r#   r  rn   r0  r  r  r  r  r  r   r&   rm   r(   )r)   s   "r*   r+   r.  P  sZ     m m_ m m!0mCRm,mDSm (;m GJmr-   c               	    V'       d/    V P                   P                  V P                  W'4      pVe   V#  Ve   V# \        RV : 24      h  \         d     L"i ; i)Nz>Could not get pkg-config variable and no default provided for )r0  r   rl   r   )	r_   r  r0  r  r  r  r  r  r   s	   &$$$$$$$ r*   get_variable PkgConfigDependency.get_variableP  sm     >>22499iZ'#O ( $  !$bcgbj"kll	 ' s   +A AA)
r6  r5   r3  r1  r7  rl   r0  rg  r8  rp   r%  )r   r   r   r   r`   r@  rO  r4  ru  r5  r  r  r  rd  r   r  r  r   r&  r'  s   @r*   r)  r)  3  s    $  $ L+
>>U(nO55(*  mt mZ^ m37mUYm/3mVZm >Bm mr-   r)  )0
__future__r   pathlibr   baser   r   r   r   mesonlibr	   r
   r   r   r   r   r   r   optionsr   programsr   r    r   r   	functoolsr   r   r   r   typingrJ   TYPE_CHECKINGtyping_extensionsr   _typingr   r+  r   
utils.corer   interpreter.type_checkingr   r   r   r>   r)  r(   r-   r*   <module>r     s    #  \ \3 3 3  =    	 	  ???)/)*?)b" b"Hn6% n6bjm, jmr-   