зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1224452 - Quote passthru variables. r=gps
Ideally, we should properly make and shell quote everything we print out in makefiles, but that's a can of worms I don't want to open just yet. So I'll limit myself to just passthru variables.
This commit is contained in:
Родитель
dcfc35f1b9
Коммит
b5c0f9f920
|
@ -111,4 +111,4 @@ if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['GNU_AS']:
|
|||
# Suppress warnings in third-party code.
|
||||
if CONFIG['GNU_CC']:
|
||||
if CONFIG['CLANG_CXX']:
|
||||
CFLAGS += ['-Wno-\#pragma-messages']
|
||||
CFLAGS += ['-Wno-#pragma-messages']
|
||||
|
|
|
@ -77,6 +77,7 @@ from ..util import (
|
|||
FileAvoidWrite,
|
||||
)
|
||||
from ..makeutil import Makefile
|
||||
from mozbuild.shellutil import quote as shell_quote
|
||||
|
||||
MOZBUILD_VARIABLES = [
|
||||
b'ANDROID_APK_NAME',
|
||||
|
@ -169,6 +170,10 @@ DEPRECATED_VARIABLES_MESSAGE = (
|
|||
)
|
||||
|
||||
|
||||
def make_quote(s):
|
||||
return s.replace('#', '\#').replace('$', '$$')
|
||||
|
||||
|
||||
class BackendMakeFile(object):
|
||||
"""Represents a generated backend.mk file.
|
||||
|
||||
|
@ -494,7 +499,8 @@ class RecursiveMakeBackend(CommonBackend):
|
|||
for k, v in sorted(obj.variables.items()):
|
||||
if isinstance(v, list):
|
||||
for item in v:
|
||||
backend_file.write('%s += %s\n' % (k, item))
|
||||
backend_file.write(
|
||||
'%s += %s\n' % (k, make_quote(shell_quote(item))))
|
||||
elif isinstance(v, bool):
|
||||
if v:
|
||||
backend_file.write('%s := 1\n' % k)
|
||||
|
|
|
@ -17,8 +17,8 @@ DEFFILE = 'baz.def'
|
|||
USE_STATIC_LIBS = True
|
||||
|
||||
CFLAGS += ['-fno-exceptions', '-w']
|
||||
CXXFLAGS += ['-fcxx-exceptions', '-include foo.h']
|
||||
LDFLAGS += ['-framework Foo', '-x']
|
||||
CXXFLAGS += ['-fcxx-exceptions', '-option with spaces']
|
||||
LDFLAGS += ['-ld flag with spaces', '-x']
|
||||
HOST_CFLAGS += ['-funroll-loops', '-wall']
|
||||
HOST_CXXFLAGS += ['-funroll-loops-harder', '-wall-day-everyday']
|
||||
WIN32_EXE_LDFLAGS += ['-subsystem:console']
|
||||
|
|
|
@ -299,10 +299,10 @@ class TestRecursiveMakeBackend(BackendTester):
|
|||
],
|
||||
'MOZBUILD_CXXFLAGS': [
|
||||
'MOZBUILD_CXXFLAGS += -fcxx-exceptions',
|
||||
'MOZBUILD_CXXFLAGS += -include foo.h',
|
||||
"MOZBUILD_CXXFLAGS += '-option with spaces'",
|
||||
],
|
||||
'MOZBUILD_LDFLAGS': [
|
||||
'MOZBUILD_LDFLAGS += -framework Foo',
|
||||
"MOZBUILD_LDFLAGS += '-ld flag with spaces'",
|
||||
'MOZBUILD_LDFLAGS += -x',
|
||||
'MOZBUILD_LDFLAGS += -DELAYLOAD:foo.dll',
|
||||
'MOZBUILD_LDFLAGS += -DELAYLOAD:bar.dll',
|
||||
|
|
Загрузка…
Ссылка в новой задаче