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',
],
}