Bug 921816 - Handle idls in --with-libxul-sdk builds. r=gps, a=lsblakk
authorMike Hommey <mh+mozilla@glandium.org>
Sun, 29 Sep 2013 17:00:41 +0900
changeset 161069 77e95b4af9f04861380e56f3213d2cd2539baca4
parent 161068 1008d70074112bf6cc929bd8bc573655f68d876b
child 161070 a39f4c0f075d6a346a00c45cd99ba7ddc8cb172e
push id3012
push userryanvm@gmail.com
push dateWed, 13 Nov 2013 14:58:14 +0000
treeherdermozilla-beta@9ba6a44a6dfa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps, lsblakk
bugs921816
milestone26.0
Bug 921816 - Handle idls in --with-libxul-sdk builds. r=gps, a=lsblakk
config/config.mk
config/makefiles/precompile/Makefile.in
config/makefiles/xpidl/Makefile.in
js/src/config/config.mk
moz.build
python/mozbuild/mozbuild/action/xpidl-process.py
toolkit/toolkit.mozbuild
--- a/config/config.mk
+++ b/config/config.mk
@@ -517,18 +517,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/precompile/Makefile.in
+++ b/config/makefiles/precompile/Makefile.in
@@ -5,20 +5,26 @@
 # This make file defines the precompile tier. This tier effectively fans out
 # to other make files and specialized targets.
 
 SUPPRESS_DEFAULT_RULES := 1
 
 default::
 	+$(MAKE) export
 
-export:: ipdl webidl xpidl
+ifndef LIBXUL_SDK
+export:: ipdl webidl
 
 ipdl:
 	$(call SUBMAKE,ipdl,$(DEPTH)/ipc/ipdl)
 
 webidl:
 	$(call SUBMAKE,webidl,$(DEPTH)/dom/bindings)
+endif
+
+export:: xpidl
 
 xpidl:
+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)
--- 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)
 
 xpidl:: $(linked_xpt_files)
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -517,18 +517,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', 'config/makefiles/precompile')
+
 # 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,12 +76,14 @@ if __name__ == '__main__':
     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()
-    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)
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -4,17 +4,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['LIBXUL_SDK']:
     error('toolkit.mozbuild is not compatible with --enable-libxul-sdk=')
 
 if not CONFIG['MOZ_NATIVE_NSPR']:
     add_tier_dir('nspr', 'config/nspr')
 
-add_tier_dir('precompile', 'config/makefiles/precompile')
 add_tier_dir('external', 'config/external')
 
 if not CONFIG['MOZ_NATIVE_NSS']:
     add_tier_dir('nss', 'security/build')
 
 include('/config/js/js.mozbuild')
 
 if CONFIG['MOZ_CONTENT_SANDBOX']: