4

I'm trying to compile Chromium with custom flags passed to the compiler (by modifying CFLAGS/CXXFLAGS). According to the documentation, I can do this via making a .gyp file in the appropriate location containing something like:

  {
    'targets': [
      {
        'target_name': 'existing_target',
        'conditions': [
          ['OS=="win"', {
            'cflags': [
              '/WX',
            ],
          }, { # OS != "win"
            'cflags': [
              '-Werror',
            ],
          }],
        ],
      },
    ],
  },

The trouble I have is that the value I want to pass in CFLAGS depends on environmental variables.

So I basically need to do the equivalent of

export CFLAGS="-flag1 '$HOME/foo/bar' -flag2 '$MY_PATH' $MORE_FLAGS"

except I can't, because it doesn't seem like environmental variables in dictionary values are expanded.
(And I obviously don't want to hard-code the values, since that defeats the point of making them environmental variables that I can easily change later...)

How do I solve this problem?

user541686
  • 189,354
  • 112
  • 476
  • 821
  • Would a command expansion work? https://code.google.com/p/gyp/wiki/InputFormatReference#Command_Expansions_( – Ian Hunter Jul 21 '14 at 19:35
  • @IanHunter: I think so! Unfortunately I don't need this question answered anymore (and I don't have the code on my machine anymore) so I can't really test :( feel free to post it as an answer and I'll accept it anyway, since it looks correct. – user541686 Jul 21 '14 at 21:18

0 Answers0