这个gyp语法是什么意思? [英] What does this gyp syntax mean?

查看:185
本文介绍了这个gyp语法是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我一直在挖掘铬代码,然后我发现了一些我无法理解的代码。文件位于 src / media / media.gyp 有人可以用简单的英文解释这一行的含义吗?



我不明白的行:

 '<!@(<(pkg- config)--cflags libpulse)',

代码 p>

  ['OS!=linux',{$ b $'sources!':[
'audio / cras / audio_manager_cras.cc',
'audio / cras / audio_manager_cras.h',
'audio / cras / cras_input.cc',
'audio / cras / cras_input.h',
'audio / cras / cras_unified.cc',
'audio / cras / cras_unified.h',
],
}],
['use_pulseaudio == 1 ',{
'cflags':[
'<!@(<(pkg-config)--cflags libpulse)',#< - this line
],
'定义':[
'USE_PULSEAUDIO',
],
'条件':[
['linux_link_pulseaudio == 0',{
'定义':[
'DLOPEN_PULSEAUDIO',
],
'变量':{$ b $''generate_stubs_script':' ../tools/generate_stubs/generate_stubs.py',
'extra_header':'audio / pulse / pulse_stub_header.fragment',
'sig_files':['audio / pulse / pulse.sigs'],


解决方案

参见 gyp文档中的命令扩展



<!@ 表示命令扩展



一个命令扩展,包含在括号内的整个字符串被传递给系统的shell。该命令的输出被分配给一个字符串值,该值随后可以在列表上下文中以与变量扩展相同的方式扩展(如果使用了@字符)。



示例:'!(echo filename with space.cc)',


$ b $
'libraries':[
'!@(pkg-config --libs-only-l apr-1)',
],
}

将展开至

  {$ b $'sources':[
'filename with space.cc',#no @,扩展为单个字符串
],
'libraries': [#@被使用了,所以每个lib
'-lapr-1',
'-lpthread',
],
}
都有单独的列表项


I have been digging up chromium code recently, then I found piece of code that I could not understand. File is located at src/media/media.gyp Can someone explain what this line means in plain English?

The line I don't understand :

 '<!@(<(pkg-config) --cflags libpulse)',

The code :

['OS!="linux"', {
      'sources!': [
        'audio/cras/audio_manager_cras.cc',
        'audio/cras/audio_manager_cras.h',
        'audio/cras/cras_input.cc',
        'audio/cras/cras_input.h',
        'audio/cras/cras_unified.cc',
        'audio/cras/cras_unified.h',
      ],
    }],
    ['use_pulseaudio==1', {
      'cflags': [
        '<!@(<(pkg-config) --cflags libpulse)',            # <- this line
      ],
      'defines': [
        'USE_PULSEAUDIO',
      ],
      'conditions': [
        ['linux_link_pulseaudio==0', {
          'defines': [
            'DLOPEN_PULSEAUDIO',
          ],
          'variables': {
            'generate_stubs_script': '../tools/generate_stubs/generate_stubs.py',
            'extra_header': 'audio/pulse/pulse_stub_header.fragment',
            'sig_files': ['audio/pulse/pulse.sigs'],

解决方案

See Command-Expansions in the gyp docs

<!@ means Command Expansions

In a command expansion, the entire string contained within the parentheses is passed to the system’s shell. The command’s output is assigned to a string value that may subsequently be expanded in list context in the same way as variable expansions if an @ character is used.

Example:

{
  'sources': [
    '!(echo filename with space.cc)',
  ],
  'libraries': [
    '!@(pkg-config --libs-only-l apr-1)',
  ],
}

will be expand to

{
  'sources': [
    'filename with space.cc',  # no @, expands into a single string
  ],
  'libraries': [  # @ was used, so there's a separate list item for each lib
    '-lapr-1',
    '-lpthread',
  ],
}

这篇关于这个gyp语法是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆