HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991108/root/usr/lib/python3/dist-packages/gyp/__pycache__/
Upload File :
Current File : //proc/1991108/root/usr/lib/python3/dist-packages/gyp/__pycache__/xcode_emulation.cpython-311.pyc
�

K��bh��D�dZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlm
Z
dadadd�ZGd�de��Zd�ZGd	�d
e��ZGd�de��Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd�Zd�Zd�Z d�Z!	dd�Z"d d�Z#d�Z$d�Z%d�Z&dS)!z~
This module contains classes that help to emulate xcodebuild behavior on top of
other build systems, such as make and ninja.
�)�print_functionN)�GypErrorc��d|i}|r||d<|S)zConstructs a dictionary with expansion for $(ARCHS_STANDARD) variable,
  and optionally for $(ARCHS_STANDARD_INCLUDING_64_BIT).�$(ARCHS_STANDARD)�"$(ARCHS_STANDARD_INCLUDING_64_BIT)�)�archs�archs_including_64_bit�mappings   �5/usr/lib/python3/dist-packages/gyp/xcode_emulation.py�XcodeArchsVariableMappingr
!s'��!�%�(�'��K�4J�G�0�1�	�.�c�J�eZdZdZejd��Zd�Zd�Zd�Z	d�Z
dS)�XcodeArchsDefaultz�A class to resolve ARCHS variable from xcode_settings, resolving Xcode
  macros and implementing filtering by VALID_ARCHS. The expansion of macros
  depends on the SDKROOT used ("macosx", "iphoneos", "iphonesimulator") and
  on the version of Xcode.
  z\$\([a-zA-Z_][a-zA-Z0-9_]*\)$c�,�|f|_|||d�|_dS)N)�mac�ios�iossim)�_default�_archs)�self�defaultr�iphonesimulator�iphoneoss     r�__init__zXcodeArchsDefault.__init__3s ���J�D�M��h�/�J�J�D�K�K�Krc��|���}d|vr
|jdSd|vr
|jdS|jdS)zDReturns the dictionary of variable mapping depending on the SDKROOT.rrrrr)�lowerr)r�sdkroots  r�_VariableMappingz"XcodeArchsDefault._VariableMapping7sL���m�m�o�o�G��W���
�[��
��	�g�	%�	%�
�[��
"�"�
�[��
�rc�J�|�|��}g}|D]�}|j�|��rS|}	||}|D]}||vr|�|����F#t$r}td|z��Yd}~�gd}~wwxYw||vr|�|����|S)z=Expands variables references in ARCHS, and remove duplicates.z,Warning: Ignoring unsupported variable "%s".N)r�variable_pattern�match�append�KeyError�print)	rr	r�variable_mapping�expanded_archs�arch�variable�variable_expansion�es	         r�_ExpandArchszXcodeArchsDefault._ExpandArchsAs����,�,�W�5�5���N��$�$��	
�	�	$�	$�T�	*�	*�
$���	K�/��9�
�(�*�*�d��>�)�)��#�#�D�)�)�)��*���	K�	K�	K�
�>��I�
J�
J�
J�
J�
J�
J�
J�
J�����	K�����~�%�%����d�#�#�#���s�&A � 
B�*B�Bc��|�|p|j|pd��}|r"g}|D]}||vr|�|���|}|S)z�Expands variables references in ARCHS, and filter by VALID_ARCHS if it
    is defined (if not set, Xcode accept any value in ARCHS, otherwise, only
    values present in VALID_ARCHS are kept).�)r,rr#)rr	�valid_archsrr'�filtered_archsr(s       r�ActiveArchszXcodeArchsDefault.ActiveArchsSsk���&�&�u�'=��
�w�}�"�M�M�N��&��n� �&�&�$��;���
�
�
��
%�
%�
%��%�n��rN)�__name__�
__module__�__qualname__�__doc__�re�compiler!rrr,r1rrrrr)sr�������� �R�Z� @�A�A��K�K�K� � � ����$����rrc
��trtSt��\}}|dkr=tdtdg��tdg��tdg����an�|dkrFtdtdgdg��tdgddg��tddggd	�����anFtdtdgdg��tddgddg��tgd	�gd	�����atS)
a�Returns the |XcodeArchsDefault| object to use to expand ARCHS for the
  installed version of Xcode. The default values used by Xcode for ARCHS
  and the expansion of the variables depends on the version of Xcode used.

  For all version anterior to Xcode 5.0 or posterior to Xcode 5.1 included
  uses $(ARCHS_STANDARD) if ARCHS is unset, while Xcode 5.0 to 5.0.2 uses
  $(ARCHS_STANDARD_INCLUDING_64_BIT). This variable was added to Xcode 5.0
  and deprecated with Xcode 5.1.

  For "macosx" SDKROOT, all version starting with Xcode 5.0 includes 64-bit
  architecture as part of $(ARCHS_STANDARD) and default to only building it.

  For "iphoneos" and "iphonesimulator" SDKROOT, 64-bit architectures are part
  of $(ARCHS_STANDARD_INCLUDING_64_BIT) from Xcode 5.0. From Xcode 5.1, they
  are also part of $(ARCHS_STANDARD).

  All thoses rules are coded in the construction of the |XcodeArchsDefault|
  object to use depending on the version of Xcode detected. The object is
  for performance reason.�0500r�i386�armv7�0510r�x86_64�armv7s)r;r>�arm64)�XCODE_ARCHS_DEFAULT_CACHE�XcodeVersionrr
)�
xcode_version�_s  r�GetXcodeArchsDefaultrDas2��*�%�$�$�!�^�^��-���V��� 1��!�6�(�+�+�!�6�(�+�+�!�7�)�,�,�	!.�!.���
�v��� 1�,�!�8�*�x�j�9�9�!�6�(�V�X�,>�?�?�!�
�h��(�(�(�	*�	*�	!+�!+���!2��!�8�*�x�j�9�9�!�6�8�"4�v�x�6H�I�I�!�(�(�(�(�(�(�	*�	*�	!+�!+��
#�"rc��eZdZdZiZiZiZiZiZd�Z	d�Z
d�Zd�ZdMd�Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%d �Z&d!�Z'd"�Z(d#�Z)d$�Z*d%�Z+d&�Z,d'�Z-d(�Z.d)�Z/d*�Z0dMd+�Z1dMd,�Z2d-�Z3d.�Z4dMd/�Z5d0�Z6d1�Z7d2�Z8d3�Z9d4�Z:d5�Z;d6�Z<d7�Z=d8�Z>d9�Z?d:�Z@dMd;�ZAd<�ZBd=�ZCdMd>�ZDdMd?�ZEd@�ZFdA�ZG	dNdC�ZHdD�ZIdE�ZJgdBfdF�ZKdMdG�ZLdMdH�ZMdI�ZNdJ�ZOdMdK�ZPdL�ZQdS)O�
XcodeSettingsz9A class that understands the gyp 'xcode_settings' object.c��||_d|_d|_d|_i|_|d}|���D]`\}}|�di��|j|<|�|��|j|�dd��rd|_�ad|_tj
d��|_dS)NF�configurations�xcode_settings�IPHONEOS_DEPLOYMENT_TARGETTz^lib([^/]+)\.(a|dylib)$)�spec�isIOS�mac_toolchain_dir�header_map_pathrI�items�get�_ConvertConditionalKeys�
confignamer6r7�
library_re)rrK�configsrR�configs     rrzXcodeSettings.__init__�s����D�I��D�J�!�D���D���D���#�$�G�%�m�m�o�o����
�F�(.�
�
�3C�R�(H�(H�d��*�%�
�"�"�:�.�.�.�	
�	�Z�	(�	,�	,�-I�-1�
3�
3����
���D�O��j�!;�<�<�D�O�O�Orc�0�|j|}d�|D��}|D]y}|�d��r<|�d��r&|�d��d}||||<n#tdd�|����||=�zdS)	z�Converts or warns on conditional keys.  Xcode supports conditional keys,
    such as CODE_SIGN_IDENTITY[sdk=iphoneos*].  This is a partial implementation
    with some keys converted while the rest force a warning.c�<�g|]}|�d���|��S)�])�endswith)�.0�keys  r�
<listcomp>z9XcodeSettings._ConvertConditionalKeys.<locals>.<listcomp>�s)��E�E�E��3�<�<��3D�3D�E��E�E�Erz[sdk=iphoneos*]r�[rz4Warning: Conditional keys not implemented, ignoring:� N)rIrY�splitr%�join)rrR�settings�conditional_keysr[�new_keys      rrQz%XcodeSettings._ConvertConditionalKeys�s����"�:�.�H�E�E�x�E�E�E���	�	��	���'�	(�	(�*����z�*�*�	,��I�I�c�N�N�1�%�'�&�s�m�(�7�
��
�D��h�h�'�(�(�	*�	*�	*�
�3�-�-�	�	rc�8�|jsJ�|j|jS�N)rRrI�rs r�	_SettingszXcodeSettings._Settings�s ���?������t��/�/rc�Z�|����||��|kSre)rgrP)r�test_key�cond_keyrs    r�_TestzXcodeSettings._Test�s'���>�>������'�2�2�h�>�>rNc��||���vr?|�|t|���|��z��dS|r'|�|t|��z��dSdSre)rgr#�str)r�lstri�
format_strrs     r�_AppendfzXcodeSettings._Appendf�s����4�>�>�#�#�#�#�	�j�j��c�$�.�.�"2�"2�8�"<�=�=�=�>�>�>�>�>�	�,�	�j�j��c�'�l�l�*�+�+�+�+�+�,�,rc�Z�||���vrtd|z��dSdS)Nz/Warning: Ignoring not yet implemented key "%s".)rgr%)rris  r�_WarnUnimplementedz XcodeSettings._WarnUnimplemented�s9���4�>�>�#�#�#�#��=��H�I�I�I�I�I�$�#rc�f�|jrdnd}|j|�d|��}|dkS)N�binary�xml�INFOPLIST_OUTPUT_FORMAT)rLrIrP)rrRr�formats    r�IsBinaryOutputFormatz"XcodeSettings.IsBinaryOutputFormat�s@���*�/�h�h�%�G�
�
 ��
,�
0�
0�1J�18�:�:�F��X��rc�Z�|jddko|���o|jS)N�type�shared_library)rK�	_IsBundlerLrfs r�IsIosFrameworkzXcodeSettings.IsIosFramework�s2���9�V�� 0�0��T�^�^�5E�5E���
�rc��t|j�dd����dkp'|���p|���S)N�
mac_bundler)�intrKrP�	_IsXCTest�_IsXCUiTestrfs rr|zXcodeSettings._IsBundle�sL���t�y�}�}�\�1�-�-�.�.�!�3��t�~�~�7G�7G�������rc�Z�t|j�dd����dkS)N�mac_xctest_bundler�r�rKrPrfs rr�zXcodeSettings._IsXCTest��&���t�y�}�}�0�!�4�4�5�5��:�:rc�Z�t|j�dd����dkS)N�mac_xcuitest_bundlerr�rfs rr�zXcodeSettings._IsXCUiTest�s&���t�y�}�}�2�A�6�6�7�7�1�<�<rc�Z�t|j�dd����dkS)N�ios_app_extensionrr�rfs r�_IsIosAppExtensionz XcodeSettings._IsIosAppExtension�r�rc�Z�t|j�dd����dkS)N�ios_watchkit_extensionrr�rfs r�_IsIosWatchKitExtensionz%XcodeSettings._IsIosWatchKitExtension�s&���t�y�}�}�5�q�9�9�:�:�a�?�?rc�Z�t|j�dd����dkS)N�
ios_watch_apprr�rfs r�_IsIosWatchAppzXcodeSettings._IsIosWatchApp�s%���t�y�}�}�_�a�0�0�1�1�Q�6�6rc�\�|���sJ�|�dd���S)zPReturns the framework version of the current target. Only valid for
    bundles.�FRAMEWORK_VERSION�A�r)r|�GetPerTargetSettingrfs r�GetFrameworkVersionz!XcodeSettings.GetFrameworkVersion�s4���>�>�������#�#�$7��#�E�E�Erc��|���sJ�|jddvrKddd�|jd}|�d|���}d|j�d|��zS|jdd	krd|���s|���rd|j�dd
��zSd|j�dd��zSJd
|jd�d|jd�d����)z[Returns the bundle extension (.app, .framework, .plugin, etc).  Only
    valid for bundles.rz��loadable_moduler{�bundle�	framework�WRAPPER_EXTENSIONr��.�product_extension�
executable�appex�appFzDon't know extension for 'z', target '�target_name�')r|rKr�rPr�r�)r�default_wrapper_extension�wrapper_extensions   r�GetWrapperExtensionz!XcodeSettings.GetWrapperExtensionsA���>�>�������y���A�A�A�#�%�#�#�	
�	�&��#���2�2�
�'@�3�B�B��
�4�9�=�=�!4�6G�H�H�
H�H�	
��6�	�l�	*�	*�	
�	 �	 �	"�	"�?�d�&B�&B�&D�&D�?��T�Y�]�]�#6��@�@�@�@��T�Y�]�]�#6��>�>�>�>�7�7�
�)�F�
�
�
�T�Y�}�5�5�5�7�7�7�7rc�N�|j�d|jd��S)zReturns PRODUCT_NAME.�product_namer��rKrPrfs r�GetProductNamezXcodeSettings.GetProductNames���9�=�=����=�)A�B�B�Brc�z�|���r|���S|���S)zReturns FULL_PRODUCT_NAME.)r|�GetWrapperName�_GetStandaloneBinaryPathrfs r�GetFullProductNamez XcodeSettings.GetFullProductNames8���~�~���-�
�
 �
 �
"�
"�"�
�
*�
*�
,�
,�,rc��|���sJ�|���|���zS)z`Returns the directory name of the bundle represented by this target.
    Only valid for bundles.)r|r�r�rfs rr�zXcodeSettings.GetWrapperName"s=���>�>��������� � �4�#;�#;�#=�#=�=�=rc�t�|jr|���S|���sJ�|jddkrEtj�|���d|�����Stj�|���d��S)z�Returns the qualified path to the bundle's contents folder. E.g.
    Chromium.app/Contents or Foo.bundle/Versions/A. Only valid for bundles.rzr{�Versions�Contents)rLr�r|rK�os�pathr`r�rfs r�GetBundleContentsFolderPathz)XcodeSettings.GetBundleContentsFolderPath(s����z�#�
�
 �
 �
"�
"�"��>�>�������y���,�,�,�
�W�\�\�
�
�
�
�
��T�-E�-E�-G�-G�I�I�I��W�\�\�$�-�-�/�/��
<�
<�<rc���|���sJ�|jr|���Stj�|���d��S)z}Returns the qualified path to the bundle's resource folder. E.g.
    Chromium.app/Contents/Resources. Only valid for bundles.�	Resources)r|rLr�r�r�r`rfs r�GetBundleResourceFolderz%XcodeSettings.GetBundleResourceFolder5sX���>�>�������z�0�
�
-�
-�
/�
/�/�
�7�<�<��8�8�:�:�K�H�H�Hrc��|���sJ�|jddvs|jr|���S|jddvr2tj�|���d��SdS)z|Returns the qualified path to the bundle's executables folder. E.g.
    Chromium.app/Contents/MacOS. Only valid for bundles.rzr{�r�r��MacOSN)r|rKrLr�r�r�r`rfs r�GetBundleExecutableFolderPathz+XcodeSettings.GetBundleExecutableFolderPath=s����>�>�������y���-�.�.�$�*�.�
�
-�
-�
/�
/�/�	
��6�	�?�	?�	?�
�W�\�\�$�:�:�<�<�g�
F�
F�F�
@�	?rc��|���sJ�tj�|���d��S)z�Returns the qualified path to the bundle's Java resource folder.
    E.g. Chromium.app/Contents/Resources/Java. Only valid for bundles.�Java)r|r�r�r`r�rfs r�GetBundleJavaFolderPathz%XcodeSettings.GetBundleJavaFolderPathFs<���>�>������
�7�<�<��4�4�6�6��?�?�?rc��|���sJ�tj�|���d��S)z�Returns the qualified path to the bundle's frameworks folder. E.g,
    Chromium.app/Contents/Frameworks. Only valid for bundles.�
Frameworks�r|r�r�r`r�rfs r�GetBundleFrameworksFolderPathz+XcodeSettings.GetBundleFrameworksFolderPathLs<���>�>������
�7�<�<��8�8�:�:�L�I�I�Irc��|���sJ�tj�|���d��S)z�Returns the qualified path to the bundle's frameworks folder. E.g,
    Chromium.app/Contents/SharedFrameworks. Only valid for bundles.�SharedFrameworksr�rfs r�#GetBundleSharedFrameworksFolderPathz1XcodeSettings.GetBundleSharedFrameworksFolderPathRsC���>�>������
�7�<�<��8�8�:�:�*�,�,�,rc���|���sJ�|jddkr|���Stj�|���d��S)z�Returns the qualified path to the bundle's shared support folder. E.g,
    Chromium.app/Contents/SharedSupport. Only valid for bundles.rzr{�
SharedSupport)r|rKr�r�r�r`r�rfs r� GetBundleSharedSupportFolderPathz.XcodeSettings.GetBundleSharedSupportFolderPathYsh���>�>�������y���,�,�,�
�
)�
)�
+�
+�+�
�W�\�\�$�:�:�<�<�)�+�+�+rc��|���sJ�tj�|���d��S)zzReturns the qualified path to the bundle's plugins folder. E.g,
    Chromium.app/Contents/PlugIns. Only valid for bundles.�PlugInsr�rfs r�GetBundlePlugInsFolderPathz(XcodeSettings.GetBundlePlugInsFolderPathcs<���>�>������
�7�<�<��8�8�:�:�I�F�F�Frc��|���sJ�tj�|���d��S)z�Returns the qualified path to the bundle's XPC services folder. E.g,
    Chromium.app/Contents/XPCServices. Only valid for bundles.�XPCServicesr�rfs r�GetBundleXPCServicesFolderPathz,XcodeSettings.GetBundleXPCServicesFolderPathis<���>�>������
�7�<�<��8�8�:�:�M�J�J�Jrc�>�|���sJ�|jddvs|���r2tj�|���d��Stj�|���dd��S)zyReturns the qualified path to the bundle's plist file. E.g.
    Chromium.app/Contents/Info.plist. Only valid for bundles.rzr�z
Info.plistr�)r|rKr}r�r�r`r�rfs r�GetBundlePlistPathz XcodeSettings.GetBundlePlistPathos����>�>�������y���=�=�=������>�
�W�\�\�$�:�:�<�<�l�
K�
K�K�
�W�\�\�$�:�:�<�<�%�|�5�5�5rc��|���r.|���sJd|jdz���dS|���r.|���sJd|jdz���dS|���r.|���sJd|jdz���dS|���r.|���sJd|jdz���d	S|���rd
ddd
�|jdSddddd�|jdS)z(Returns the PRODUCT_TYPE of this target.z6ios_app_extension flag requires mac_bundle (target %s)r�z$com.apple.product-type.app-extensionz;ios_watchkit_extension flag requires mac_bundle (target %s)z)com.apple.product-type.watchkit-extensionz2ios_watch_app flag requires mac_bundle (target %s)z+com.apple.product-type.application.watchappz8mac_xcuitest_bundle flag requires mac_bundle (target %s)z(com.apple.product-type.bundle.ui-testingz"com.apple.product-type.applicationzcom.apple.product-type.bundlez com.apple.product-type.framework)r�r�r{rzzcom.apple.product-type.toolz&com.apple.product-type.library.dynamicz%com.apple.product-type.library.static)r�r�r{�static_library)r�r|rKr�r�r�rfs r�GetProductTypezXcodeSettings.GetProductTypezs������ � �4�
�^�^�
�
�4�4�!��)�M�2�!3�4�4�4�
3�
3��#�#�%�%�9�
�^�^�
�
�?�?�!#�%)�Y�}�%=�!>�?�?�?�
8�
8������;�
�^�^�
�
�4�4�!��)�M�2�!3�4�4�4�
:�
:������8�
�^�^�
�
�4�4�!��)�M�2�!3�4�4�4�
7�
7��~�~����:�:�<���	
�	�&��	��4�C�B�A�	��
	
�	�&���rc��|���s|jddkrdSddddd�|jdS)	z'Returns the MACH_O_TYPE of this target.rzr�r.�
mh_execute�	staticlib�mh_dylib�	mh_bundle�r�r�r{r�)r|rKrfs r�GetMachOTypezXcodeSettings.GetMachOType�sX���>�>�����	�&� 1�\� A� A�
�R� �#�"�$�	��
�i����rc��|���sJ�tj�|���|�����S)zReturns the name of the bundle binary of by this target.
    E.g. Chromium.app/Contents/MacOS/Chromium. Only valid for bundles.)r|r�r�r`r��GetExecutableNamerfs r�_GetBundleBinaryPathz"XcodeSettings._GetBundleBinaryPath�sO���>�>������
�7�<�<��:�:�<�<��.�.�0�0�2�2�2rc�d�d|jvrd|jdzSddddd�|jdS)	Nr�r�r.z.a�.dylibz.sor�rz)rKrfs r�_GetStandaloneExecutableSuffixz,XcodeSettings._GetStandaloneExecutableSuffix�sN���d�i�'�'�
�4�9�0�1�
1�1��� ��	��
�i����rc�d�|j�dddddd�|jd��S)N�product_prefixr.�libr�rzr�rfs r�_GetStandaloneExecutablePrefixz,XcodeSettings._GetStandaloneExecutablePrefix�sF���9�=�=�)�����
,�,��i���,���rc���|���rJ�|jddvsJd|jdz���|jd}|jddkr|dd�dkr
|dd�}n'|jdd	vr|dd�dkr
|dd�}|���}|j�d
|��}|���}||z|zS)zwReturns the name of the non-bundle binary represented by this target.
    E.g. hello_world. Only valid for non-bundles.rz)r�r{r�r�zUnexpected type %sr�r�N�r�r�r�)r|rKr�rPr�)r�target�
target_prefix�
target_exts    rr�z&XcodeSettings._GetStandaloneBinaryPath�s���~�~�������9�V��!M�M�M�M��t�y��0�0�M�M�M��Y�}�
%�F��y���,�,�,�	�����u�	�	��������	
��6�	�C�	C�	C�	�����u�	�	��������7�7�9�9�M�
�Y�]�]�>�6�
2�
2�F��4�4�6�6�J��6�!�J�.�.rc��|���r&|j�d|jd��S|���S)zXReturns the executable name of the bundle represented by this target.
    E.g. Chromium.r�r�)r|rKrPr�rfs rr�zXcodeSettings.GetExecutableName�sE���~�~���-�
�Y�]�]�>�4�9�]�+C�
D�
D�D�
�
*�
*�
,�
,�,rc�z�|���r|���S|���S)z�Returns the qualified path to the primary executable of the bundle
    represented by this target. E.g. Chromium.app/Contents/MacOS/Chromium.)r|r�r�rfs r�GetExecutablePathzXcodeSettings.GetExecutablePath�s:���~�~���-�
�
&�
&�
(�
(�(�
�
*�
*�
,�
,�,rc���|j|}t��}|�|�d��|�d��|�d����S)z:Returns the architectures this target should be built for.�ARCHS�VALID_ARCHS�SDKROOT)rIrDr1rP)rrR�config_settings�xcode_archs_defaults    r�GetActiveArchszXcodeSettings.GetActiveArchs�sf���)�*�5�O�.�0�0���*�*����G�$�$����M�*�*����I�&�&�(�(�(rc�:�	tdd||g��S#YdSxYw)N�xcrunz--sdk)�GetStdoutQuiet)r�sdk�infoitems   r�_GetSdkVersionInfoItemz$XcodeSettings._GetSdkVersionInfoItem�s.��
�
�W�g�s�H�=�
>�
>�>���
�d�d���s��c�D�|�|j}|�d|d���S)Nr�r.r�)rR�GetPerConfigSetting)rrRs  r�_SdkRootzXcodeSettings._SdkRoot�s*�����?�j��#�#�I�z�2�#�F�F�Frc��|�|��}|tjvr%|�|d��}|tj|<tj|S)Nz--show-sdk-platform-path)r�rF�_platform_path_cacher�)rrR�sdk_root�
platform_paths    r�_XcodePlatformPathz XcodeSettings._XcodePlatformPath�sX���}�}�Z�(�(�H��}�9�9�9��1�1�(�2L�N�N�m�5B�m�(��2��-�h�7�7rc��|�|��}|�d��r|S|�|��S)N�/)r��
startswith�
_XcodeSdkPath)rrRrs   r�_SdkPathzXcodeSettings._SdkPathsB���}�}�Z�(�(�H����3����
�o����h�'�'�'rc��|tjvr6|�|d��}|tj|<|r|tj|<tj|S)Nz--show-sdk-path)rF�_sdk_path_cacher��_sdk_root_cache)rr�sdk_paths   rrzXcodeSettings._XcodeSdkPathsV���}�4�4�4��,�,�X�7H�I�I�h�08�m�#�H�-�	�;�2:�
�%�h�/��(��2�2rc�t�|�|dd��d|���vr�tj�|�����}|����d��r|�|dd��dS|�|dd��dSdS)N�MACOSX_DEPLOYMENT_TARGETz-mmacosx-version-min=%srJrz-mios-simulator-version-min=%sz-miphoneos-version-min=%s)rprgr�r��basenamerrr)rrn�sdk_path_basenames   r�_AppendPlatformVersionMinFlagsz,XcodeSettings._AppendPlatformVersionMinFlagss����M�M�#�1�3L�M�M�M�#�t�~�~�'7�'7�7�7��'�*�*�4�=�=�?�?�;�;��	�	 �	 �	"�	"�	-�	-�.?�	@�	@�3��
�
�c�7�6�	8�	8�	8�	8�	8�	
�
�
�c�7�1�	3�	3�	3�	3�	3�8�7rc��||_g}|���}d|���vr|r|�d|z��|jr|�d|jz��|�ddd���r|�d��|�d	dd���r|�d
��|�ddd���r|�d��d
|���vr4|���d
dkr|�d��n	|�ddd���r|�d��|�|ddd���|�ddd���r�|����dd��}|dkr|�d��nC|dkrtd���|dkr|�d��ntd|z���|����d��dkr|�d��n@|����d��dkr|�d��|�ddd���r|�d ��|�d!dd���r|�d"��|�d#dd���r|�d$��|�d%dd���r|�d&��|�	|��|�d'dd���r|�
d'��|�
d(��|�
d)��|�
d*��|�
d+��|�|g}n#|jsJ�|�|j��}t|��d-kr|�
d.��d/g}|�d0|d1z��|d1d2vr�|�d3dd���r|�d4��|�d5dd���r|�d6��|�d7dd���r|�d8��|�d9dd���r|�d:��||����d;g��z
}|�
��r2|�|��}|r|�d<|zd=z��|r|}nd>}|jd?|j}	|	�d@g��}
|
D].}|�d<|�dA|��z���/d,|_|S)BzMReturns flags that need to be added to .c, .cc, .m, and .mm
    compilations.r�z-isysroot %sz-I%s�CLANG_WARN_CONSTANT_CONVERSION�YES�NOr�z-Wconstant-conversion�GCC_CHAR_IS_UNSIGNED_CHARz-funsigned-char�GCC_CW_ASM_SYNTAXz-fasm-blocks�GCC_DYNAMIC_NO_PICz-mdynamic-no-pic�GCC_ENABLE_PASCAL_STRINGSz-mpascal-strings�GCC_OPTIMIZATION_LEVELz-O%s�s�GCC_GENERATE_DEBUGGING_SYMBOLS�DEBUG_INFORMATION_FORMAT�dwarfz	-gdwarf-2�stabsz(stabs debug format is not supported yet.�dwarf-with-dsymzUnknown debug format %s�GCC_STRICT_ALIASINGz-fstrict-aliasingz-fno-strict-aliasing�GCC_SYMBOLS_PRIVATE_EXTERNz-fvisibility=hidden�GCC_TREAT_WARNINGS_AS_ERRORSz-Werror�GCC_WARN_ABOUT_MISSING_NEWLINEz
-Wnewline-eof�LLVM_LTOz-flto�COPY_PHASE_STRIP�GCC_DEBUGGING_SYMBOLS�GCC_ENABLE_OBJC_EXCEPTIONS�MACH_O_TYPE�PRODUCT_TYPEN�r�r:�-arch r)r:r=�GCC_ENABLE_SSE3_EXTENSIONSz-msse3�)GCC_ENABLE_SUPPLEMENTAL_SSE3_INSTRUCTIONSz-mssse3�GCC_ENABLE_SSE41_EXTENSIONSz-msse4.1�GCC_ENABLE_SSE42_EXTENSIONSz-msse4.2�WARNING_CFLAGS�-F�/Developer/Library/Frameworks/r.rH�mac_framework_dirs�
$(SDKROOT))rRrrgr#rNrkrprP�NotImplementedErrorrrrr��lenr�rrK�replace)rrRr(�cflagsr�
dbg_formatr	�
platform_root�framework_rootrU�framework_dirs�	directorys            r�	GetCflagszXcodeSettings.GetCflagss1��!�D�O�
�F��}�}���H��D�N�N�$�$�$�$��$��m�m�N�X�-�.�.�.���3��m�m�F�T�1�1�2�2�2��z�z�2�E�4�z�H�H�-��m�m�+�,�,�,��z�z�-�u�d�z�C�C�'��m�m�%�&�&�&��z�z�%�u�e�z�<�<�$��m�m�N�#�#�#��t�~�~�/�/�/�/�	
���	�	�.�	/�5�	8�	8��
�
�(�)�)�)��
�
�z�z�-�u�e�z�D�D�(��m�m�&�'�'�'��M�M�&�2�F�C�M�H�H�H��z�z�2�E�5�z�I�I�	J��>�>�#�#�'�'�(B�G�L�L�j�	�w�	�	��
�
�k�"�"�"�"��� � �!�"L�M�M�M��*�*�*��
�
�k�"�"�"�"�!�";�j�"H�I�I�I��~�~�����1�2�2�e�;�;��m�m�'�(�(�(�(�	
���	�	�	�	�3�	4�	4��	<�	<��m�m�*�+�+�+��z�z�.��t�z�D�D�+��m�m�)�*�*�*��z�z�0�%��z�F�F���m�m�I�����z�z�2�E�4�z�H�H�%��m�m�O�$�$�$��z�z�*�e�T�z�2�2���m�m�G�����'�'��/�/�/��z�z�$�e�T�z�:�:�2�
���0�1�1�1����3�4�4�4����8�9�9�9�	���M�*�*�*����N�+�+�+����f�e�e�
�_�����!�!�$�/�2�2�e�
�5�z�z�Q���
���g�&�&�&��h�e�
�M�M�(�U�1�X�%�&�&�&��Q�x�%�%�%�	
���0�%���	F�	F� ��
�
�h����	
���?�� �
�
"�
"�!��
�
�i� � � �	
���1�5�$��	G�	G�"��
�
�j�!�!�!�	
���1�5�$��	G�	G�"��
�
�j�!�!�!�
�d�n�n���"�"�#3�R�8�8�8�F��~�~���Q��/�/�
�;�;�
��	Q�
�-�-��}�,�/O�O�
P�
P�
P����n�n��n�
�Y�'�
(���
9�F��Z�Z� 4�b�9�9�N�#�L�L�	��m�m�D�9�,�,�\�>�J�J�J�K�K�K�K��D�O��Mrc�.�||_g}|����dd��dkr|�d��n|�|dd��||����dg��z
}d|_|S)z?Returns flags that need to be added to .c, and .m compilations.�GCC_C_LANGUAGE_STANDARDr.�ansiz-ansi�-std=%s�OTHER_CFLAGSN)rRrgrPr#rp)rrR�cflags_cs   r�
GetCflagsCzXcodeSettings.GetCflagsC�s��� �D�O��H��~�~�����5�r�:�:�f�D�D��o�o�g�����
�m�m�H�7��C�C�C����� � �$�$�^�R�8�8�8�H��D�O��Orc��||_g}|����d��}|r|�d|z��|�|dd��|�ddd���r|�d	��|�d
dd���r|�d��|�ddd���r|�d
��|�ddd���r|�d��|�ddd���r|�d��g}|����ddg��D]M}|dvrd}|dvr,||����dg��z
}�8|�|���N||z
}d|_|S)zAReturns flags that need to be added to .cc, and .mm compilations.�CLANG_CXX_LANGUAGE_STANDARDrC�CLANG_CXX_LIBRARY�
-stdlib=%s�GCC_ENABLE_CPP_RTTIrrr�z	-fno-rtti�GCC_ENABLE_CPP_EXCEPTIONSz-fno-exceptions�GCC_INLINES_ARE_PRIVATE_EXTERNz-fvisibility-inlines-hidden�GCC_THREADSAFE_STATICSz-fno-threadsafe-statics�%GCC_WARN_ABOUT_INVALID_OFFSETOF_MACROz-Wno-invalid-offsetof�OTHER_CPLUSPLUSFLAGS�$(inherited))z
$inheritedrQz${inherited}�
$OTHER_CFLAGS)rRz$(OTHER_CFLAGS)z${OTHER_CFLAGS}rDN)rRrgrPr#rprk)rrR�	cflags_cc�clang_cxx_language_standard�
other_ccflags�flags      r�GetCflagsCCzXcodeSettings.GetCflagsCC�s��� �D�O��I�"&�.�.�"2�"2�"6�"6�%�#'�#'��#�@����y�#>�>�?�?�?��M�M�)�0�,�?�?�?��z�z�'��u�z�=�=�$����{�#�#�#��z�z�-�t�U�z�C�C�*����(�)�)�)��z�z�2�E�4�z�H�H�6����4�5�5�5��z�z�*�D�%�z�@�@�2����0�1�1�1��z�z�9�4��z�O�O�0����.�/�/�/��M���� � �$�$�%;�n�=M�N�N�#�#��	
�?�	?�	?���	
�H�	H�	H�����)�)�-�-�n�b�A�A�A�
�
����T�"�"�"�"�
���I��D�O��rc���|����dd��}|dkr|�d��dS|dkr|�d��dSdS)N�GCC_ENABLE_OBJC_GC�unsupported�	supportedz	-fobjc-gc�requiredz-fobjc-gc-only)rgrPr#)r�flags�	gc_policys   r�$_AddObjectiveCGarbageCollectionFlagsz2XcodeSettings._AddObjectiveCGarbageCollectionFlags�sq����� � �$�$�%9�=�I�I�I��K����l�l�;������	�j�	 �	 ��l�l�#�$�$�$�$�$�
!�	 rc��|�ddd���r|�d��|�ddd���r|�d��dSdS)N�CLANG_ENABLE_OBJC_ARCrrr�z
-fobjc-arc�CLANG_ENABLE_OBJC_WEAKz-fobjc-weak�rkr#�rr]s  r�_AddObjectiveCARCFlagsz$XcodeSettings._AddObjectiveCARCFlags�sl���z�z�)�5�$�z�?�?�!��l�l�<� � � ��z�z�*�E�4�z�@�@�"��l�l�=�!�!�!�!�!�"�"rc�d�|�ddd���r|�d��dSdS)N�*CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESISrrr�z!-Wobjc-missing-property-synthesisrcrds  r�+_AddObjectiveCMissingPropertySynthesisFlagsz9XcodeSettings._AddObjectiveCMissingPropertySynthesisFlags�sH���z�z�>����'�'�8��l�l�6�7�7�7�7�7�8�8rc��||_g}|�|��|�|��|�|��d|_|S)z7Returns flags that need to be added to .m compilations.N)rRr_rerh)rrR�cflags_objcs   r�
GetCflagsObjCzXcodeSettings.GetCflagsObjC�sW�� �D�O��K��-�-�k�:�:�:�����,�,�,��4�4�[�A�A�A��D�O��rc��||_g}|�|��|�|��|�|��|�ddd���r|�d��d|_|S)z8Returns flags that need to be added to .mm compilations.�GCC_OBJC_CALL_CXX_CDTORSrrr�z-fobjc-call-cxx-cdtorsN)rRr_rerhrkr#)rrR�cflags_objccs   r�GetCflagsObjCCzXcodeSettings.GetCflagsObjCC�s��� �D�O��L��-�-�l�;�;�;�����-�-�-��4�4�\�B�B�B��z�z�,�e�T�z�B�B�4����2�3�3�3��D�O��rc���|jddkr'|jddks|���rdS|�d|���rdnd���}|S)	z/Return DYLIB_INSTALL_NAME_BASE for this target.rzr{r�N�DYLIB_INSTALL_NAME_BASEz/Library/Frameworksz/usr/local/libr�)rKr|r�)r�install_bases  r�GetInstallNameBasez XcodeSettings.GetInstallNameBase�s~��	
�	�&��-�-�-�	
��6�	�/�	/�	/�4�>�>�3C�3C�	/�
�T��+�+�!�)-���)9�)9�O�%�%�?O�,�Q�Q�L��rc���d|vrqd|}}|�d��r|�dd��\}}tj�|��}tj�||��}|S)z(Do :standardizepath processing for path.rr.�@r+)rr_r�r��normpathr`)rr��prefix�rests    r�_StandardizePathzXcodeSettings._StandardizePathsp���d�{�{���d�f�	
����	�	�*��z�z�#�q�)�)����
�W�
�
�d�
#�
#�d�
�W�\�\�&�$�
'�
'�d��Krc��|jddkr'|jddks|���rdSd}|�d|���}d|vr�|d	|fvsJd
|jd�d|�d
����|�d|�|�������}|���rQ|�d|�����}|�d|�����}nd|vsJ�d|vsJ�|�d|�����}|S)z-Return LD_DYLIB_INSTALL_NAME for this target.rzr{r�Nz=$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)�LD_DYLIB_INSTALL_NAMEr��$zJ$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(WRAPPER_NAME)/$(PRODUCT_NAME)zNVariables in LD_DYLIB_INSTALL_NAME are not generally supported yet in target 'r�z' (got 'z')z*$(DYLIB_INSTALL_NAME_BASE:standardizepath)z$(WRAPPER_NAME)z$(PRODUCT_NAME)z$(EXECUTABLE_PATH))	rKr|r�r8ryrsr�r�r�)r�default_install_name�install_names   r�GetInstallNamezXcodeSettings.GetInstallNames���	
�	�&��-�-�-�	
��6�	�/�	/�	/�4�>�>�3C�3C�	/�
�T�	H���+�+��)=�,�?�?�L�
�l���
�,�-A�C�C�C�C�C��y��'�'�'����7�C�C�C�"�)�)�
6�
�
�
�� 7� 7� 9� 9�
:�
:�<�<�l�
���	�	�5�#�+�+��t�2�2�4�4�6�6��#�+�+��t�2�2�4�4�6�6���!��4�4�4�4� ��4�4�4�4�!�)�)�
�� 6� 6� 8� 8�:�:�l��rc���d}d}d|gd|gd|gd|||gg}|D]�}tjdd�|��z��}|�|��}|rZ|d	|�d
���||�d
����z||�d
��d	�z}��|�d��r#d||td��d	���z}|S)zuChecks if ldflag contains a filename and if so remaps it from
    gyp-directory-relative to build-directory-relative.z(\S+)z\S+z-exported_symbols_listz-unexported_symbols_listz-reexported_symbols_listz-sectcreatez	(?:-Wl,)?z[ ,]Nr+�-L)	r6r7r`r"�start�group�endrr7)	r�ldflag�gyp_to_build_path�LINKER_FILE�WORD�linker_flags�flag_pattern�regex�ms	         r�_MapLinkerFlagFilenamez$XcodeSettings._MapLinkerFlagFilename5s���K��D���-�!�;�/�!�;�/��d�D�+�.�	�L�%�#�#���j��v�{�{�<�'@�'@�@�A�A�e�
�+�+�f�
�
�a�	
�#����������$�'8�'8�������'D�'D�D�����a���	�	�"�#���������<��'�'��s�4�y�y�z�z�(:�;�;�;�f��Mrc�D	�||_g}|����dg��D]+}|�|�||�����,|�ddd���r|�d��|�ddd���r|�d��|�|d	d
��|�|dd��|�|��d
|���vr>|���r*|�d|���z��|����dg��D]#}|�d||��z���$d|���vr9|�d||���d��z��|�|g}n#|jsJ�|�	|j��}t|��dkr|�d��dg}|�d|dz��|�d|dkr|ndz��|���}	|	r=|j
ddkr,|�d|	�dd��z��|����d g��D]}
|�d!|
z���|���}|sd"}|j
d#|j}|�d$g��}
|
D].}|�d%|�d&|��z���/|���rI|�|��}|r2|r0|�d%|zd'z��|�d(��|���p|���}|rr|rpt'��dd)kr.|�d*��|�|d+z��n|�d,��|�d-��|�|d.d/��d|_|S)0a�Returns flags that need to be passed to the linker.

    Args:
        configname: The name of the configuration to get ld flags for.
        product_dir: The directory where products such static and dynamic
            libraries are placed. This is added to the library search path.
        gyp_to_build_path: A function that converts paths relative to the
            current gyp file to paths relative to the build direcotry.
    �
OTHER_LDFLAGS�DEAD_CODE_STRIPPINGrrr�z-Wl,-dead_strip�
PREBINDINGz-Wl,-prebind�DYLIB_COMPATIBILITY_VERSIONz-compatibility_version %s�DYLIB_CURRENT_VERSIONz-current_version %sr�z
-isysroot �LIBRARY_SEARCH_PATHSr��
ORDER_FILEz-Wl,-order_file -Wl,Nr+r�r:r,rr�z./rzr�z-install_name r^z\ �LD_RUNPATH_SEARCH_PATHSz-Wl,-rpath,r.rHr4r2r5r3z-framework XCTest�0900z	-lpkstartz?/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKitz-e _NSExtensionMainz-fapplication-extensionrIrJ)rRrgrPr#r�rkrprrr�r7rrrrKr8r�rr�r�rA)rrR�product_dirr�r(�ldflagsr��library_pathr	r~�rpathrrUr=r>r;�is_extensions                 r�
GetLdflagszXcodeSettings.GetLdflagsQs���!�D�O��G��.�.�"�"�&�&���;�;�M�M��
�n�n�T�0�0��9J�K�K�L�L�L�L��z�z�'���z�=�=�(�
�n�n�&�'�'�'��z�z�,��t�z�4�4�%�
�n�n�^�$�$�$��M�M��.�0K�M�M�M��M�M��(�*?�A�A�A�	�'�'��0�0�0��D�N�N�$�$�$�$������$�
�n�n�\�D�M�M�O�O�3�4�4�4����(�(�,�,�-C�R�H�H�=�=��
�n�n�T�-�-�l�;�;�;�<�<�<�<��t�~�~�'�'�'�'�
�n�n��/�/�"&�.�.�"2�"2�<�"@�B�B�B�C�C�C����f�e�e�
�_�����!�!�$�/�2�2�e�
�5�z�z�Q���
���g�&�&�&��h�e��N�N�8�e�A�h�&�'�'�'��N�N�4�+��*<�*<�;�;�$�G�H�H�H��&�&�(�(�L��J��	�&�)�->�>�>�
�n�n�%��(<�(<�S�%�(H�(H�H�I�I�I����!�!�%�%�&?��D�D�,�,��
�n�n�]�U�*�+�+�+�+��}�}���H����h�
�Y�'�
(���
9�F��Z�Z� 4�b�9�9�N�#�G�G�	�
�n�n�T�I�-�-�l�H�E�E�E�F�F�F�F��~�~���.��/�/�
�;�;�
��	.�
�	.�
�.�.��
�-�0P�P�
Q�
Q�
Q�
�.�.�,�
-�
-�
-��*�*�,�,�N��0L�0L�0N�0N�L��0�L�0�

����	�V�	#�	#����{�#�#�#����x�M�N�	O�	O�	O�	O�	���,�-�-�-�
�n�n�.�/�/�/��M�M�'�.��=�=�=��D�O��Nrc��||_g}|����dg��D]}|�|���d|_|S)z�Returns flags that need to be passed to the static linker.

    Args:
        configname: The name of the configuration to get ld flags for.
    r�N)rRrgrPr#)rrR�libtoolflags�libtoolflags    r�GetLibtoolflagszXcodeSettings.GetLibtoolflags�s_��!�D�O��L��~�~�'�'�+�+�O�R�@�@�'�'�����+�&�&�&�&��D�O��rc��d}i}t|j�����D]Z}|rt|j|��}d}�!|j|���D]\}}||vr�
|||kr||=��[|S)z~Gets a list of all the per-target settings. This will only fetch keys
    whose values are the same across all configurations.TF)�sortedrI�keys�dictrO)r�
first_pass�resultrRr[�values      r�GetPerTargetSettingsz"XcodeSettings.GetPerTargetSettings�s����J�
�F��T�0�5�5�7�7�8�8�	�	�
�	���d�)�*�5�6�6���
�
��-�j�9�?�?�A�A�	�	�J�C��
��
�
���c�{�e�#�#��s���		�
�Mrc��||jvr!|j|�||��S|�||��Sre)rIrPr�)r�settingrRrs    rr�z!XcodeSettings.GetPerConfigSetting�sD���T�(�(�(�
�
 ��
,�
0�
0��'�
B�
B�B�
�
%�
%�g�w�
7�
7�7rc�6�d}d}t|j�����D]i}|r$|j|�|d��}d}�(||j|�|d��ksJd|�d|jd�d�����j|�|S|S)z�Tries to get xcode_settings.setting from spec. Assumes that the setting
       has the same value in all configurations and throws otherwise.TNFz!Expected per-target setting for 'z"', got per-config setting (target r��))r�rIr�rPrK)rr�r�
is_first_passr�rRs      rr�z!XcodeSettings.GetPerTargetSetting�s����M�
�F��T�0�5�5�7�7�8�8�A�A�
�	�A��$�Z�0�4�4�W�d�C�C���
�
���,�Z�8�<�<�W�d�K�K�K�K�K�K�$�W�W�d�i�
�&>�&>�&>�
@�L�K�K�K��~�
�n��Mrc��||_g}|�ddd����r|�ddd����rd}|jddks|���r|���rd	}n|jdd
krd}|����d|��}d
ddd�|}|����dd
��}|r|dt|��zz
}|s#|�d|jdz��|�d|�d|����d|_|S)z�Returns a list of shell commands that contain the shell commands
    neccessary to strip this target's binary. These should be run as postbuilds
    before the actual postbuilds run.�DEPLOYMENT_POSTPROCESSINGrrr��STRIP_INSTALLED_PRODUCT�	debuggingrzr��
non-globalr��all�STRIP_STYLEr.z-xz-S)r�r�r��
STRIPFLAGSr^zecho STRIP\(%s\)r�zstrip N)	rRrkrKr�r|rgrP�_NormalizeEnvVarReferencesr#)	rrR�
output_binary�quietr��default_strip_style�strip_style�strip_flags�explicit_strip_flagss	         r�_GetStripPostbuildsz!XcodeSettings._GetStripPostbuilds�s}��!�D�O�
�F��
�
�.��t�
�D�D�B��
�
�,�e�T�
�B�B�B�(���9�V�� 1�1�1�T�5L�5L�5N�5N�1��n�n���2�*����9�V���,�,�#���N�N�$�$�(�(��8K�L�L�k������	�	�k�"�^�^�-�-�1�1�,��C�C��	�N��s�7�8L�M�M�M�M��
�G��
�
�*�T�Y�}�-E�E�F�F�F��m�m�m�[�[�[�-�-�@�A�A�A��D�O��Mrc�.�||_g}|�ddd���rl|�ddd���rT|jddkrC|s#|�d	|jd
z��|�d|�d|d
z����d|_|S)z�Returns a list of shell commands that contain the shell commands
    neccessary to massage this target's debug information. These should be run
    as postbuilds before the actual postbuilds run.rrr�rr rrzr�zecho DSYMUTIL\(%s\)r�z	dsymutil z -o z.dSYMN)rRrkrKr#)rrR�outputr�r�r�s      r�_GetDebugInfoPostbuildsz%XcodeSettings._GetDebugInfoPostbuilds
s���!�D�O��F��
�
�3�U�E�
�J�J�M��
�
�&�(9�7�	�	L�	L�M�	
�	�&��-�-�-�
�J��
�
�-��	�-�0H�H�I�I�I��m�m�m�=�=�=�&�7�:J�:J�K�L�L�L��D�O��MrFc�b�|�||||��|�|||��zS)z�Returns a list of shell commands that contain the shell commands
    to run as postbuilds for this target, before the actual postbuilds.)r�r�)rrRr�r�r�s     r�_GetTargetPostbuildsz"XcodeSettings._GetTargetPostbuilds s<��	
�$�$�Z����N�N�� � ��]�E�B�B�	C�Drc��|jr%|jddks*|���s|���sgSg}|���}|j|}|���r�tj�d|��}tj�	|�
d����}tj�|d|��}|�d|�d|��g��|�|��}	|	s|Sdg}
t|
��t|j|�����z}
|
r2td	d
�t!|
����z��|����r
tj�	|�
d����}tj�|d��}|�|��}dd
g}
|
D]�}tj�||��}tj�|tj�|����}|�d|�d|��g��|�tj�dd���d|	�d|�
dd���d|�
dd���d|�dd��g����tj�|d��}tj�||��|g}|D]o}|�tj�dd���d|	�d|�
dd���d|�
dd���d|�dd��g���p|�tj�dd���d|	�d|�
dd���d|�
dd���dtj�d|���dd��g��|S)z�Return a shell command to codesign the iOS output binary so it can
    be deployed to a device.  This should be run as the very last step of the
    build.rzr�z${BUILT_PRODUCTS_DIR}�	TEST_HOSTr�zditto r^�OTHER_CODE_SIGN_FLAGSz9Warning: Some codesign keys not implemented, ignoring: %sz, r�z@Developer/Library/PrivateFrameworks/IDEBundleInjection.frameworkz-Developer/Library/Frameworks/XCTest.frameworkz${TARGET_BUILD_DIR}zgyp-mac-toolz code-sign-bundle "z" "�CODE_SIGN_ENTITLEMENTSr.�PROVISIONING_PROFILEz" TF)rLrKr�r}r�rIr�r�r`�dirnamerP�extend�_GetIOSCodeSignIdentityKey�setr�r%r�rr)rrRr��
postbuildsr�ra�source�	test_host�xctest_destinationr[�unimpl�frameworks_dirr;�
frameworksr��destination�
plugin_dir�targetsr�s                   r�_GetIOSPostbuildszXcodeSettings._GetIOSPostbuilds)s>��
�J��	
��6�	�l�	*�	*�d�n�n�.>�.>�	*�	
�	�	�	�	�
+�
�i��J��*�*�,�,�L��"�:�.�H��~�~���H��w�|�|�3�\�B�B�f��'�/�/�(�,�,�{�";�";�<�<�i��7�<�<�	�9�l�K�K������&�&�&�2D�2D�E�F�G�G�G�
�
)�
)�(�
3�
3�C���
��&�
&�F�
��[�[�3�t�2�:�>�C�C�E�E�F�F�
F�F�
�&��G�
�)�)�F�6�N�N�
#�
#�
%�&�&�&��~�~�����'�/�/�(�,�,�{�";�";�<�<�i��w�|�|�I�|�<�<�n��-�-�j�9�9�m�M�:�<��"�
�
�)�����m�Y�7�7���g�l�l�>�2�7�3C�3C�I�3N�3N�O�O������F�F�F�K�K�@�A�B�B�B�	����G�L�L�.��?�?�?�?�����L�L�1�2�6�6�6�6��L�L�/��4�4�4�4�k�k�k�4�4�I�
�	�	�	�	�
�7�<�<�	�9�5�5�j�����j�,�7�7��C�g����&�����G�L�L�.��?�?�?�?�����L�L�1�2�6�6�6�6��L�L�/��4�4�4�4�f�f�f�d�d�D�
�	�	�	�	����
����*�N�;�;�;�;�S�S�S����-�r�2�2�2�2����+�R�0�0�0�0�
����,�l�;�;�;�;�U�U�	D������rc��|�d��}|sdS|tjvr�tjgd���}|���D]m}|�d��}||vrR|���d}tj}||vs|||ks
Jd|z���|tj|<�ntj�|d��S)N�CODE_SIGN_IDENTITY)�securityz
find-identityz-p�codesigningz-v�utf-8r+z2Multiple codesigning fingerprints for identity: %sr.)rPrF�_codesigning_key_cache�
subprocess�check_output�
splitlines�decoder_)rra�identityr��line�line_decoded�fingerprint�caches        rr�z(XcodeSettings._GetIOSCodeSignIdentityKeyls����|�|�0�1�1�H���
�T��}�;�;�;��&�
B�
B�
B�D�D�f��#�#�%�%�G�G�$��{�{�7�+�+���|�#�#�$�*�*�,�,�Q�/�+��6�%���&�&�+��x��*H�*H�*H�B�X�M�+I�*H�*H�;F�-�
.�x�
8���/�3�3�H�b�A�A�Arc�v�|�J�|�||||��}|�||��}||z|zS)zSReturns a list of shell commands that should run before and after
    |postbuilds|.)r�r�)rrRr�r�r�r��pre�posts        r�AddImplicitPostbuildsz#XcodeSettings.AddImplicitPostbuilds}sN���$�$�$�
�
#�
#�J��
�u�
M�
M�C��!�!�*�m�<�<�D����d�"�"rc��|�d��rFdtj�tj�|����dz}n7|j�|��}|rd|�d��z}n|}|�|��}|sd}|�	d|��}|�
d��rmtj�|��\}}|dkrEtj�|��s&|d	z}tj�|��r|}|S)
Nz
.frameworkz-framework rz-lr+r.r5r�z.tbd)rYr�r��splitextrrSr"r�rr8r�exists)	r�library�config_name�lr�rr�ext�tbd_librarys	         r�_AdjustLibraryzXcodeSettings._AdjustLibrary�s&������%�%��
�"�'�*�*�2�7�+;�+;�G�+D�+D�E�E�a�H�
H�a�a�
�/�
�
��
(�
(�a�	
���1�7�7�1�:�:�������}�}�[�)�)�H����h��i�i��h�/�/�G��|�|�L�!�!� ��g�&�&�w�/�/�m�h��	���������!8�!8����'��
�7�>�>�+�&�&�	 ��'��Nrc�(�����fd�|D��}|S)z�Transforms entries like 'Cocoa.framework' in libraries into entries like
    '-framework Cocoa', 'libcrypto.dylib' into '-lcrypto', etc.
    c�<��g|]}��|�����Sr)r�)rZr�r�rs  ��rr\z1XcodeSettings.AdjustLibraries.<locals>.<listcomp>�s9���+�+�+���$�$�W�k�:�:�+�+�+rr)r�	librariesr�s` `r�AdjustLibrarieszXcodeSettings.AdjustLibraries�s7����+�+�+�+�+� )�+�+�+�I��rc�$�tddg��S)N�sw_versz
-buildVersion)�	GetStdoutrfs r�_BuildMachineOSBuildz"XcodeSettings._BuildMachineOSBuild�s���i��1�2�2�2rc��|j|�dd��}d�|�d��D��S)N�TARGETED_DEVICE_FAMILY�1c�,�g|]}t|����Sr)r�)rZ�xs  rr\z7XcodeSettings._XcodeIOSDeviceFamily.<locals>.<listcomp>�s��.�.�.�q�C��F�F�.�.�.r�,)rIrPr_)rrR�familys   r�_XcodeIOSDeviceFamilyz#XcodeSettings._XcodeIOSDeviceFamily�s@��
�
 ��
,�
0�
0�1I�3�
O�
O�F�.�.�F�L�L��-�-�.�.�.�.rc�D�|tjv�rRi}|���|d<t��\}}||d<||d<|j|�d��}|�||d<|�|��}|s|���}|�|d��}||pdz|d	<|d
kr|�|d��|d<n|d
kr||d<n|d|d<|j	r_|j|�d��|d<||d<||d<|�
d��rdg|d<|d|d<ndg|d<d|d<|tj|<ttj|��}|j	r|�|��|d<|S)z@Returns a dictionary with extra items to insert into Info.plist.�BuildMachineOSBuild�DTXcode�DTXcodeBuild�GCC_VERSIONN�
DTCompilerz--show-sdk-versionr.�	DTSDKName�0720z--show-sdk-build-version�
DTSDKBuild�0430rJ�MinimumOSVersion�DTPlatformName�DTPlatformVersionr�iPhoneOS�CFBundleSupportedPlatforms�DTPlatformBuild�iPhoneSimulator�UIDeviceFamily)
rF�_plist_cacher�rArIrPr��_DefaultSdkRootr�rLrYr�r)	rrRr��xcode�xcode_build�compilerr�sdk_versionrOs	         r�GetExtraPlistItemsz XcodeSettings.GetExtraPlistItems�s����3�3�3��e�%)�%>�%>�%@�%@�e�!�"�'�>�>��e�[��e�I��)�e�N���$�Z�0�4�4�]�C�C�h�	�	�&��l�����z�*�*�h�
�*��'�'�)�)���/�/��:N�O�O�k�#�{�'8�b�9�e�K��	�&���"�9�9��0�2�2��l����F�?�?�)��l���#�$9�:��l��	
��
(�$(�$7�
�$C�$G�$G�(�%*�%*�� �!�"*����%0��!�"����z�*�*�	(�1;��%�,�
-�%*�<�%8�%�!�
"�
"�1B�0C�%�,�
-�&(�%�!�
"�/4�m� ��,�
��+�J�7�8�8�E��z�G� $� :� :�:� F� F�e����Lrc��t��\}}|dkrdS|�d��}tj�|��}|r|S	tddg��}n#YdSxYw|���D]\}|���}t|��dkr3|ddkr'|d}|�|��}	|	|kr|cS�]dS)	z�Returns the default SDKROOT to use.

    Prior to version 5.0.0, if SDKROOT was not explicitly set in the Xcode
    project, then the environment variable was empty. Starting with this
    version, Xcode uses the name of the newest SDK installed.
    r9r.�
xcodebuildz	-showsdksr����z-sdk���)	rArrFrrPr�r�r_r7)
rrBr�default_sdk_path�default_sdk_root�all_sdksr�rOrrs
          rrzXcodeSettings._DefaultSdkRoot�s��".����M�;��v���
�R��)�)�"�-�-��$�4�8�8�9I�J�J����
����L�+�6�7�7�h�h���
�R�R�����#�#�%�%�����j�j�l�l�e�	�U���q���U�2�Y�&�0�0���9���%�%�h�/�/���'�'�'��/�/�/��
�2s�A%�%A*re�F)Rr2r3r4r5r
rrrr�rrQrgrkrprrrxr}r|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr?rFrWr_rerhrkrorsryrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrFrF�s������A�A��/����/��,���=�=�=�4���"0�0�0�?�?�?�,�,�,�,�J�J�J����������;�;�;�=�=�=�;�;�;�@�@�@�7�7�7�F�F�F�7�7�7�*C�C�C�-�-�-�>�>�>�=�=�=�I�I�I�G�G�G�@�@�@�J�J�J�,�,�,�+�+�+�G�G�G�K�K�K�	5�	5�	5����@
�
�
�2�2�2�������/�/�/�(-�-�-�-�-�-�(�(�(����G�G�G�
8�8�8�8�(�(�(�(�3�3�3�
3�
3�
3�z�z�z�z�x
�
�
�'�'�'�R%�%�%�"�"�"�8�8�8�
���
�
�
�	�	�	�
�
�
�$�$�$�L���8_�_�_�_�B��� ���"8�8�8�8�����"!�!�!�F���("'�D�D�D�D�A�A�A�FB�B�B�$(*��#�#�#�#�����>����3�3�3�/�/�/�/�/�/�/�b����rrFc�<�eZdZdZd�Zd�Zd	d�Zd�Zd	d�Zd	d�Z	dS)
�MacPrefixHeadera�A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.

  This feature consists of several pieces:
  * If GCC_PREFIX_HEADER is present, all compilations in that project get an
    additional |-include path_to_prefix_header| cflag.
  * If GCC_PRECOMPILE_PREFIX_HEADER is present too, then the prefix header is
    instead compiled, and all other compilations in the project get an
    additional |-include path_to_compiled_header| instead.
    + Compiled prefix headers have the extension gch. There is one gch file for
      every language used in the project (c, cc, m, mm), since gch files for
      different languages aren't compatible.
    + gch files themselves are built with the target's normal cflags, but they
      obviously don't get the |-include| flag. Instead, they need a -x flag that
      describes their language.
    + All o files in the target need to depend on the gch file, to make sure
      it's built before any o file is built.

  This class helps with some of these tasks, but it needs help from the build
  system for writing dependencies to the gch files, for writing build commands
  for the gch files, and for figuring out the location of the gch files.
  c�.�d|_d|_|r:|�d��|_|�dd���dk|_i|_|jr<|jrdD]}||j|��|j|<�||j��|_dSdS)aIf xcode_settings is None, all methods on this class are no-ops.

    Args:
        gyp_path_to_build_path: A function that takes a gyp-relative path,
            and returns a path relative to the build directory.
        gyp_path_to_build_output: A function that takes a gyp-relative path and
            a language code ('c', 'cc', 'm', or 'mm'), and that returns a path
            to where the output of precompiling that path for that language
            should be placed (without the trailing '.gch').
    NF�GCC_PREFIX_HEADER�GCC_PRECOMPILE_PREFIX_HEADERrr�)�c�ccr��mm)�header�compile_headersr��compiled_headers)rrI�gyp_path_to_build_path�gyp_path_to_build_output�langs     rrzMacPrefixHeader.__init__s����D�K� �D���@�"�6�6�7J�K�K�d�k�+�?�?�
(�$�@�8�8�;?�@�d���D���{�8�	
�	�!�*�	!�	!�D�(@�(@��k�4�)!�)!�$�
��
%�
%�*�*�4�;�7�7�d�k�k�k�8�8rc�F�|jsJ�|j|}|r|d|zz
}|S)Nr�)r.r/)rr2r(�hs    r�_CompiledHeaderzMacPrefixHeader._CompiledHeader4s8���������d�#�A����3��:�o�a��HrNc�z�|jr"||jvrd|�||��zS|jr
d|jzSdS)zAGets the cflags to include the prefix header for language |lang|.z-include %sr.)r.r/r5r-�rr2r(s   r�
GetIncludezMacPrefixHeader.GetInclude;sQ�������(=� =� =�
�T�1�1�$��=�=�
=�=�	
���
�T�[�
(�(�
�Rrc�F�|jsJ�|�||��dzS)zFReturns the actual file name of the prefix header for language |lang|.z.gch)r.r5r7s   r�_GchzMacPrefixHeader._GchDs,�����������d�+�+�f�4�4rc	�6�|jr|jsgSg}t||��D]u\}}tj�|��d}ddddddd��|d��}|r,|�|||�||��f���v|S)aGiven a list of source files and the corresponding object files, returns
    a list of (source, object, gch) tuples, where |gch| is the build-directory
    relative path to the gch file each object file depends on.  |compilable[i]|
    has to be the source file belonging to |objs[i]|.r+r*r+r�r,)z.cz.cppz.ccz.cxxz.mz.mmN)	r-r.�zipr�r�r�rPr#r:)	r�sources�objsr(r�r��objr�r2s	         r�GetObjDependenciesz"MacPrefixHeader.GetObjDependenciesIs���
�;��d�2��
�i�
�F��7�D�)�)�	<�	<�����G���V�$�$�Q�'�c���T�4���	��
	��C�����
�<��
�
�v�s�D�I�I�d�D�$9�$9�:�;�;�;���Mrc��|jr|jsgS|�d|��dd|jf|�d|��dd|jf|�d|��dd|jf|�d|��dd|jfgS)	z�Returns [(path_to_gch, language_flag, language, header)].
    |path_to_gch| and |header| are relative to the build directory.
    r*z-x c-headerr+z
-x c++-headerr�z-x objective-c-headerr,z-x objective-c++-header)r-r.r:)rr(s  r�GetPchBuildCommandsz#MacPrefixHeader.GetPchBuildCommands^s����;��d�2��
�i��y�y��d���]�C���=��y�y��t���o�t�T�[�A��y�y��d���4�c�4�;�G��y�y��t���7��t�{�K�	�rre)
r2r3r4r5rr5r8r:r@rBrrrr&r&s���������*8�8�8�8
�
�
�����5�5�5�
����*�����rr&c�|�trtS	tddg�����}t|��dkrt	d���nX#t��}|r.t
jd|�����d}nt	d���|dg}YnxYw|d}|d	}|�	��d	�
d
d��}|ddt|��z
zz�d
��}|r|�	��d	}||fatS)z@Returns a tuple of version and build version of installed Xcode.rz-version�z&xcodebuild returned unexpected resultsz(\d+\.\d+\.?\d*)rz!No Xcode or CLT version detected!r.r r��0r��)�XCODE_VERSION_CACHEr�r�r7r�
CLTVersionr6r"�groupsr_r8�zfill)�version_list�version�builds   rrArAlsA������!�!�<��"<�=�=�H�H�J�J�L��<���1����=�>�>�>���!��l�l�G��:���,�g�6�6�=�=�?�?��B�g�g��8�9�9�9��R�=�L�L�L������O�'�
�r�
�%��M�M�O�O�B��'�'��R�0�0�'�
�s�a�#�g�,�,�.�/�
/�6�6�q�9�9�'�
���K�K�M�M�"��E� �%�(��	�s
�AA�AB+c���d}d}d}tjd��}|||fD]J}	tdd|g��}tj||�����dcS#Y�HxYwdS)	z7Returns the version of command-line tools from pkgutil.z"com.apple.pkg.DeveloperToolsCLILeozcom.apple.pkg.DeveloperToolsCLIz!com.apple.pkg.CLTools_Executableszversion: (?P<version>.+)z/usr/sbin/pkgutilz
--pkg-inforLN)r6r7r��search�	groupdict)�STANDALONE_PKG_ID�FROM_XCODE_PKG_ID�MAVERICKS_PKG_IDr�r[r�s      rrHrH�s���;��7��8��
�*�/�
0�
0�%�� 1�3D�
E���c���-�|�S�A�B�B�f�
�Y�u�f�
%�
%�
/�
/�
1�
1�)�
<�<�<�<����h�����s�>A$�$A(c�
�tj|tjtj���}|���d}|jdkrtd|j|dfz���|�d��S)z�Returns the content of standard output returned by invoking |cmdlist|.
  Ignores the stderr.
  Raises |GypError| if the command return with a non-zero return code.)�stdout�stderrr�Error %d running %s�
)r��Popen�PIPE�communicate�
returncoder�rstrip��cmdlist�job�outs   rr�r��sx��	����� *��	1�	1�	1�#������!��#��^�q���
�(�C�N�G�A�J�+G�G�
H�
H�H�	���D�	�	�rc�^�tj|tj���}|���d}|jdkrAt
j�|dz��td|j|dfz���|�	d���
d��S)z�Returns the content of standard output returned by invoking |cmdlist|.
  Raises |GypError| if the command return with a non-zero return code.)rUr�
rWr�)r�rYrZr[r\�sysrV�writerr]r�r^s   rr�r��s���	�����9�9�9�#������!��#��^�q����J���S�5�[�!�!�!�
�(�C�N�G�A�J�+G�G�
H�
H�H�	���E�	�	�	!�	!�'�	*�	*�*rc���|�di��}|d���D]:}d|vr4|���}|�|d��||d<�;dS)z�Merges the global xcode_settings dictionary into each configuration of the
  target represented by spec. For keys that are both in the global and the local
  xcode_settings dict, the local key gets precendence.
  rIrHN)rP�values�copy�update)�global_dictrK�global_xcode_settingsrU�new_settingss     r�MergeGlobalXcodeSettingsToSpecrm�s���&�/�/�*:�B�?�?���%�&�-�-�/�/�.�.�f��6�!�!�*�/�/�1�1�l����&�!1�2�3�3�3�!-�f�
���	.�.rc�>�t|�dd����dkpSt|�dd����dkp,t|�dd����dko|dk}|r|ddksJd|d	z���|S)
z�Returns if |spec| should be treated as a bundle.

  Bundles are directories with a certain subdirectory structure, instead of
  just a single file. Bundle rules do not produce a binary but also package
  resources into that directory.r�rr�rrrz�nonez6mac_bundle targets cannot have type none (target "%s")r�)r�rP)�flavorrK�
is_mac_bundles   r�IsMacBundlerr�s����d�h�h�2�A�6�6�7�7�1�<�@�	�$�(�(�(�!�
,�
,�-�-��2�@�
�4�8�8�L�!�$�$�%�%��*�>�v��������<�6�!�!�!�@��]��	�"�!�!�
�rc#�K�tj�||�����}|D�]A}|}d|vs
Jd|z���tj�|��}tj�|d��}|d�d��r&tj�||d��}tj�||d��}|�d��r(tj�|��ddz}|�d��r(tj�|��dd	z}||fV���Cd
S)avYields (output, resource) pairs for every resource in |resources|.
  Only call this for mac bundle targets.

  Args:
      product_dir: Path to the directory containing the output bundle,
          relative to the build directory.
      xcode_settings: The XcodeSettings of the current target.
      resources: A list of bundle resources, relative to the build directory.
  r^z/Spaces in resource filenames not supported (%s)rr+z.lprojz.xibz.nibz.storyboardz.storyboardcN)r�r�r`r�r_rYr�)r�rI�	resources�dest�resr��	res_parts�lproj_partss        r�GetMacBundleResourcesry�s_����
����k�$�<�<�>�>�
@�
@�$�
���c�
�F��c�>�>�>�7�3�>��>�>���
�
�c�"�"�I��'�-�-�	�!��-�-�K��1�~���x�(�(�4��w�|�|�F�K��N�3�3�f�
�W�\�\�&�)�A�,�
/�
/�F�
���v���4��w����'�'��*�V�3�f�
���}�%�%�<��w����'�'��*�^�;�f�
�#�+�����3�rc��|�d��}|sddgifSd|vs
Jd|z���||��}|�dd���dkr*tj|�d	d
�����}ng}tj�||�����}|���}||||fS)a)Returns (info_plist, dest_plist, defines, extra_env), where:
  * |info_plist| is the source plist path, relative to the
    build directory,
  * |dest_plist| is the destination plist path, relative to the
    build directory,
  * |defines| is a list of preprocessor defines (empty if the plist
    shouldn't be preprocessed,
  * |extra_env| is a dict of env variables that should be exported when
    invoking |mac_tool copy-info-plist|.

  Only call this for mac bundle targets.

  Args:
      product_dir: Path to the directory containing the output bundle,
          relative to the build directory.
      xcode_settings: The XcodeSettings of the current target.
      gyp_to_build_path: A function that converts paths relative to the
          current gyp file to paths relative to the build direcotry.
  �INFOPLIST_FILENr^z1Spaces in Info.plist filenames not supported (%s)�INFOPLIST_PREPROCESSrr�r�"INFOPLIST_PREPROCESSOR_DEFINITIONSr.)r��shlexr_r�r�r`r�r�)r�rIr0�
info_plist�defines�
dest_plist�	extra_envs       r�GetMacInfoPlistr�s	��(�1�1�2B�C�C�*�	����r�2���

�J�	�	�	�7�:�E�
�	�	�&�%�j�1�1�*��'�'��d�(�,�,�/4�5�5��k�.�<�<�,�b�=�:�:�;�;�G�G��G��w�|�|�K��)J�)J�)L�)L�M�M�*��1�1�3�3�)�	�Z��)�	3�3rc
���|siS|j}||||���|d|dt��dd�	}|�d|��r|�|��|d<nd|d<|jr
|j|d<|dd	vrw|���|d
<|���|d<|���|d<|�	��}|r||d
<|�
��|d<|����rAtj
�|tjz|���z��|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���|d<|���}|r||d<|���}	|	r|	|d<t��ddkrJ|�d��s5|�|��}
|
s|�d��}
|
�d}
|
|d<|si}n>|D];}tA||tB��sd�||��||<�<|�"|��|D]}tG||��||<�|S) a�Return the environment variables that Xcode would set. See
  http://developer.apple.com/library/mac/#documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html#//apple_ref/doc/uid/TP40003931-CH3-SW153
  for a full list.

  Args:
      xcode_settings: An XcodeSettings object. If this is None, this function
          returns an empty dict.
      built_products_dir: Absolute path to the built products dir.
      srcroot: Absolute path to the source root.
      configuration: The build configuration name.
      additional_settings: An optional dict with more values to add to the
          result.
  z
${SRCROOT}z	${TMPDIR}r)	�BUILT_FRAMEWORKS_DIR�BUILT_PRODUCTS_DIR�
CONFIGURATION�PRODUCT_NAME�SRCROOT�SOURCE_ROOT�TARGET_BUILD_DIR�TEMP_DIR�XCODE_VERSION_ACTUALr�r.�
DEVELOPER_DIRrzr��EXECUTABLE_NAME�EXECUTABLE_PATH�FULL_PRODUCT_NAMEr)r*r��CONTENTS_FOLDER_PATH�EXECUTABLE_FOLDER_PATH�!UNLOCALIZED_RESOURCES_FOLDER_PATH�JAVA_FOLDER_PATH�FRAMEWORKS_FOLDER_PATH�SHARED_FRAMEWORKS_FOLDER_PATH�SHARED_SUPPORT_FOLDER_PATH�PLUGINS_FOLDER_PATH�XPCSERVICES_FOLDER_PATH�INFOPLIST_PATH�WRAPPER_NAMEr{rqr9Nr^)$rKr�rAr�rrMr�r�r�r�r�r|r�r�r`�sepr�r�r�r�r�r�r�r�r�r�r�rrsrPr�r�
isinstancermrir�)rI�built_products_dir�srcroot�
configuration�additional_settingsrK�env�mach_o_typer~�install_name_baser�ks            r�_GetXcodeEnvr�;s�� 
�"���
�	�$�0�-�#�#�2�2�4�4���,��)�^�^�A�.�
	�
	�#��'�'�	�=�A�A��#�,�,�]�;�;�C�	�N�N��C�	�N��%�<�)�;�C���	�&�\�K�K�K�+�=�=�?�?�C���+�=�=�?�?�C���-�@�@�B�B�C��� �-�-�/�/�K��'�&�c�-��(�7�7�9�9�C��������:�	����'�"�&�0�%�C�C�E�E�F�	G�	G����	�2�2�4�4����	�4�4�6�6�� �!�	�.�.�0�0��+�,�,�D�D�F�F�C����4�4�6�6�� �!�	�:�:�<�<��'�(�	�7�7�9�9��$�%�!/�!J�!J�!L�!L�C����5�5�7�7��!�"�*�=�=�?�?�C���(�7�7�9�9�C����.�.�0�0�,��0�#/�C�� �$�7�7�9�9���7�%6�C�!�"��^�^�A��&� � �����);�);� ��&�&�}�5�5�H��2��-�-�b�1�1�h����h��C�	�N�	�B����!�B�B��
�+�A�.��
4�
4�B�!$���*=�a�*@�!A�!A��A������S�!�!�!��P�P�a�7�8K�A�8N�O�O�����	�rc���tjdd|��}tjd|��}|D]4}|\}}d|vs
Jd|z���|�|d|zdz��}�5|S)z�Takes a string containing variable references in the form ${FOO}, $(FOO),
  or $FOO, and returns a string with all variable references in the form ${FOO}.
  z\$([a-zA-Z_][a-zA-Z0-9_]*)z${\1}z(\$\(([a-zA-Z0-9\-_]+)\))�$(z#$($(FOO)) variables not supported: �${�})r6�sub�findallr8)rm�matchesr"�
to_replacer)s     rr�r��s���
	��,�h��<�<�#�
�J�3�S�9�9�'��9�9�e� ��J���u����C�e�K����

�+�+�j�$��/�C�"7�
8�
8�C�C�	�*rc���t|��D]V\}}|�d|zdz|��}|�d|zdz|��}|�d|z|��}�W|S)aExpands ${VARIABLES}, $(VARIABLES), and $VARIABLES in string per the
  expansions list. If the variable expands to something that references
  another variable, this variable is expanded as well if it's in env --
  until no variables present in env are left.r�r�r�r�r|)�reversedr8)�string�
expansionsr��vs    r�
ExpandEnvVarsr��ss��
�z�"�"�(�(�d�a��
�^�^�D�1�H�s�N�A�
.�
.�F�
�^�^�D�1�H�s�N�A�
.�
.�F�
�^�^�C�!�G�Q�
'�
'�F�F�	�-rc�L���tjd�����fd�}	tj�����|��}|���|S#tjj$r)}tdt|j
��z���d}~wwxYw)aTakes a dict |env| whose values are strings that can refer to other keys,
  for example env['foo'] = '$(bar) and $(baz)'. Returns a list L of all keys of
  env such that key2 is after key1 in L if env[key2] refers to env[key1].

  Throws an Exception in case of dependency cycles.
  z\$\{([a-zA-Z0-9\-_]+)\}c���t�fd����|��D����}|D]}d|vs
Jd|z����|S)Nc���g|]}|�v�|��	Srr)rZr�r�s  �rr\zD_TopologicallySortedEnvVarKeys.<locals>.GetEdges.<locals>.<listcomp>�s���C�C�C��!�s�(�(�1�(�(�(rr�z Nested variables not supported: )r�r�)�noder��dependeer�r�s   ��r�GetEdgesz0_TopologicallySortedEnvVarKeys.<locals>.GetEdges�so����C�C�C�C�e�m�m�C��I�6�6�C�C�C�D�D�G��Q�Q��
��
!�
!�
!�#E��#P�
!�
!�
!�
!��Nrz6Xcode environment variables are cyclically dependent: N)r6r7�gyp�common�TopologicallySortedr��reverse�
CycleErrorrrm�nodes)r�r��orderr+r�s`   @r�_TopologicallySortedEnvVarKeysr��s�����
�*�/�
0�
0�%�	�	�	�	�	�	�	Q�
�J�*�*�3�8�8�:�:�x�@�@�E�	�M�M�O�O�O��L��	��	�Q�Q�Q�
�@�3�q�w�<�<�O�Q�Q�Q�����Q���s�AA&�&B#�:$B�B#c�`��t|||||����fd�t���D��S)Nc�$��g|]}|�|f��
Srr)rZr[r�s  �rr\z%GetSortedXcodeEnv.<locals>.<listcomp>�s!���	I�	I�	I�c�3��C��/�	I�	I�	Ir)r�r�)rIr�r�r�r�r�s     @r�GetSortedXcodeEnvr��sA����^�%7��-�'�	)�	)�#�	I�	I�	I�	I�%C�C�%H�%H�	I�	I�	I�IrFc��g}|�dg��D]c}|s'|�d|d�d|d����|�tj�|d�����d|S)z_Returns the list of postbuilds explicitly defined on |spec|, in a form
  executable by a shell.r�zecho POSTBUILD\(r�z\) �postbuild_name�action)rPr#r�r��EncodePOSIXShellList)rKr�r��	postbuilds    r�GetSpecPostbuildCommandsr��s����*��8�8�L�"�-�-�L�L�i��?�����������+;�!<�!<�>�?�?�?����c�j�5�5�i��6I�J�J�K�K�K�K�	�rc���|���D]L}|d���D]/}|�di���d��rdS�0�MdS)zVReturns true if any target contains the iOS specific key
  IPHONEOS_DEPLOYMENT_TARGET.rHrIrJTF)rgrP)r��target_dictrUs   r�
_HasIOSTargetr��s~���^�^�%�%���k��.�/�6�6�8�8����	���$�b�	)�	)�	-�	-�.J�	K�	K���t�t�t���
�rc�"�|���D]y}|d}|d}t|�����D]E\}}tj|��}|||dz<|||dz<|dkrd|dd<d	|dd<�F�z|S)
z�Clone all targets and append -iphoneos to the name. Configure these targets
  to build for iOS devices and use correct architectures for those builds.�toolsetrHz	-iphoneosz-iphonesimulatorr�rrIr�r)rgr�rOrh�deepcopy)r�r�r�rTr��simulator_config_dict�iphoneos_config_dicts       r�_AddIOSDeviceConfigurationsr�s����^�^�%�%�
G�
G�k��)�$�G��*�+�G�.2�7�m�m�.A�.A�.C�.C�G�G�*��*�!�]�+@�A�A��+?�g�k�K�'�(�2G�g�k�.�.�/�	�H�	�	�=N��.�/�	�:�<F��-�.�y�9��
G�
�.rc�B�t|��rt|��S|S)zkIf |target_dicts| contains any iOS targets, automatically create -iphoneos
  targets for iOS device builds.)r�r�)�target_dictss r�&CloneConfigurationForDeviceAndEmulatorr�s(���<� � �5�&�|�4�4�4�	�rrer$)'r5�
__future__rrh�
gyp.commonr�r��os.pathr6r~r�rd�tempfilerrGr@r
�objectrrDrFr&rArHr�r�rmrrryr�r�r�r�r�r�r�r�r�r�rrr�<module>r�s���
��
&�%�%�%�%�%���������	�	�	�	�����	�	�	�	���������
�
�
�
�����������
��!������5�5�5�5�5��5�5�5�p.#�.#�.#�bm�m�m�m�m�F�m�m�m�`#g�g�g�g�g�f�g�g�g�T&�&�&�T���,	�	�	�+�+�+�
.�
.�
.� ���"%�%�%�P,4�,4�,4�`%)�i�i�i�i�X
�
�
�"	�	�	�Q�Q�Q�F:>�J�J�J�J�	�	�	�	������� ����r