Bug 921816 - Handle idls in --with-libxul-sdk builds. r=gps, a=lsblakk
--- a/config/config.mk
+++ b/config/config.mk
@@ -612,18 +612,23 @@ endif
ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
ifdef LIBXUL_SDK
LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
endif
endif
# Default location of include files
+ifndef LIBXUL_SDK
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
+else
+IDL_PARSER_DIR = $(LIBXUL_SDK)/sdk/bin
+IDL_PARSER_CACHE_DIR = $(LIBXUL_SDK)/sdk/bin
+endif
SDK_LIB_DIR = $(DIST)/sdk/lib
SDK_BIN_DIR = $(DIST)/sdk/bin
DEPENDENCIES = .md
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
--- a/config/makefiles/xpidl/Makefile.in
+++ b/config/makefiles/xpidl/Makefile.in
@@ -45,16 +45,20 @@ dist_include_dir := $(DIST)/include
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py
# TODO we should use py_action, but that would require extra directories to be
# in the virtualenv.
idlprocess := $(PYTHON_PATH) $(PLY_INCLUDE) -I$(IDL_PARSER_DIR) -I$(IDL_PARSER_CACHE_DIR) \
$(process_py) --cache-dir $(IDL_PARSER_CACHE_DIR) $(dist_idl_dir) \
$(dist_include_dir) $(idl_xpt_dir) $(idl_deps_dir)
+ifdef LIBXUL_SDK
+idlprocess += -I$(LIBXUL_SDK)/idl
+endif
+
xpidl_modules := @xpidl_modules@
@xpidl_rules@
linked_xpt_files := $(addprefix $(idl_xpt_dir)/,$(addsuffix .xpt,$(xpidl_modules)))
depends_files := $(foreach root,$(xpidl_modules),$(idl_deps_dir)/$(root).pp)
GARBAGE += $(linked_xpt_files) $(depends_files)
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -612,18 +612,23 @@ endif
ifneq (WINNT_,$(OS_ARCH)_$(GNU_CC))
LIBS_DIR = -L$(DIST)/bin -L$(DIST)/lib
ifdef LIBXUL_SDK
LIBS_DIR += -L$(LIBXUL_SDK)/bin -L$(LIBXUL_SDK)/lib
endif
endif
# Default location of include files
+ifndef LIBXUL_SDK
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
+else
+IDL_PARSER_DIR = $(LIBXUL_SDK)/sdk/bin
+IDL_PARSER_CACHE_DIR = $(LIBXUL_SDK)/sdk/bin
+endif
SDK_LIB_DIR = $(DIST)/sdk/lib
SDK_BIN_DIR = $(DIST)/sdk/bin
DEPENDENCIES = .md
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
--- a/moz.build
+++ b/moz.build
@@ -18,11 +18,13 @@ if not CONFIG['LIBXUL_SDK']:
if CONFIG['MOZ_MEMORY']:
add_tier_dir('base', ['memory'])
if not CONFIG['MOZ_NATIVE_ZLIB']:
add_tier_dir('base', ['modules/zlib'])
add_tier_dir('base', ['mozglue', 'memory/mozalloc'])
+add_tier_dir('precompile', 'xpcom/xpidl')
+
# Bring in the configuration for the configured application.
if CONFIG['COMPILE_ENVIRONMENT']:
include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
--- a/python/mozbuild/mozbuild/action/xpidl-process.py
+++ b/python/mozbuild/mozbuild/action/xpidl-process.py
@@ -19,33 +19,33 @@ from typelib import write_typelib
from xpidl import IDLParser
from xpt import xpt_link
from mozbuild.makeutil import Makefile
from mozbuild.pythonutil import iter_modules_in_path
from mozbuild.util import FileAvoidWrite
-def process(input_dir, cache_dir, header_dir, xpt_dir, deps_dir, module, stems):
+def process(input_dir, inc_paths, cache_dir, header_dir, xpt_dir, deps_dir, module, stems):
p = IDLParser(outputdir=cache_dir)
xpts = {}
mk = Makefile()
rule = mk.create_rule()
# Write out dependencies for Python modules we import. If this list isn't
# up to date, we will not re-process XPIDL files if the processor changes.
rule.add_dependencies(iter_modules_in_path(topsrcdir))
for stem in stems:
path = os.path.join(input_dir, '%s.idl' % stem)
idl_data = open(path).read()
idl = p.parse(idl_data, filename=path)
- idl.resolve([input_dir], p)
+ idl.resolve([input_dir] + inc_paths, p)
header_path = os.path.join(header_dir, '%s.h' % stem)
deps_path = os.path.join(deps_dir, '%s.pp' % stem)
xpt = BytesIO()
write_typelib(idl, xpt, path)
xpt.seek(0)
xpts[stem] = xpt
@@ -76,15 +76,17 @@ def main(argv):
parser.add_argument('xptdir',
help='Directory in which to write xpt file.')
parser.add_argument('depsdir',
help='Directory in which to write dependency files.')
parser.add_argument('module',
help='Final module name to use for linked output xpt file.')
parser.add_argument('idls', nargs='+',
help='Source .idl file(s). Specified as stems only.')
+ parser.add_argument('-I', dest='incpath', action='append', default=[],
+ help='Extra directories where to look for included .idl files.')
args = parser.parse_args(argv)
- process(args.inputdir, args.cache_dir, args.headerdir, args.xptdir,
- args.depsdir, args.module, args.idls)
+ process(args.inputdir, args.incpath, args.cache_dir, args.headerdir,
+ args.xptdir, args.depsdir, args.module, args.idls)
if __name__ == '__main__':
main(sys.argv[1:])
--- a/xpcom/moz.build
+++ b/xpcom/moz.build
@@ -1,17 +1,16 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
PARALLEL_DIRS += [
'idl-parser',
- 'xpidl',
]
DIRS += [
'typelib',
'string',
'glue',
'base',
'ds',
--- a/xpcom/xpidl/Makefile.in
+++ b/xpcom/xpidl/Makefile.in
@@ -1,11 +1,13 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
export::
+ifndef LIBXUL_SDK
$(call SUBMAKE,xpidl-parser,$(DEPTH)/xpcom/idl-parser)
+endif
$(call py_action,process_install_manifest,$(DIST)/idl $(DEPTH)/_build_manifests/install/dist_idl)
$(call SUBMAKE,xpidl,$(DEPTH)/config/makefiles/xpidl)
clean clobber realclean clobber_all distclean::
$(call SUBMAKE,$@,$(DEPTH)/config/makefiles/xpidl)