Bug 728229 - Allow to build with system python ply library. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 23 Feb 2012 11:00:18 +0100
changeset 87521 a4bd10f721282e68ffb219211cc54bc08d443709
parent 87520 8fa3f5864c20db61f0e48c581c7575401d70fccd
child 87522 7493a740efcef40bab0bcf8cb4532163f36745cb
push id22130
push userrnewman@mozilla.com
push dateFri, 24 Feb 2012 02:35:54 +0000
treeherdermozilla-central@d23600a1d4a7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs728229
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 728229 - Allow to build with system python ply library. r=ted
config/autoconf.mk.in
configure.in
xpcom/idl-parser/Makefile.in
xpcom/typelib/xpidl/Makefile.in
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -692,16 +692,18 @@ ANDROID_PLATFORM_TOOLS = @ANDROID_PLATFO
 ANDROID_VERSION   = @ANDROID_VERSION@
 
 ANDROID_PACKAGE_NAME = @ANDROID_PACKAGE_NAME@
 
 JS_SHARED_LIBRARY = @JS_SHARED_LIBRARY@
 
 MOZ_INSTRUMENT_EVENT_LOOP = @MOZ_INSTRUMENT_EVENT_LOOP@
 
+MOZ_SYSTEM_PLY = @MOZ_SYSTEM_PLY@
+
 # We only want to do the pymake sanity on Windows, other os's can cope
 ifeq ($(HOST_OS_ARCH),WINNT)
 # Ensure invariants between GNU Make and pymake
 # Checked here since we want the sane error in a file that
 # actually can be found regardless of path-style.
 ifeq (_:,$(.PYMAKE)_$(findstring :,$(srcdir)))
 $(error Windows-style srcdir being used with GNU make. Did you mean to run $(topsrcdir)/build/pymake/make.py instead? [see-also: https://developer.mozilla.org/en/Gmake_vs._Pymake])
 endif
--- a/configure.in
+++ b/configure.in
@@ -1044,16 +1044,26 @@ else
     AC_MSG_RESULT([yes])
 fi
 
 MOZ_PATH_PROGS(PYTHON, $PYTHON python2.7 python2.6 python2.5 python)
 if test -z "$PYTHON"; then
     AC_MSG_ERROR([python was not found in \$PATH])
 fi
 
+MOZ_ARG_WITH_BOOL(system-ply,
+[  --with-system-ply       Use system installed python ply library],
+    [if $PYTHON -c 'import ply' 2>&5; then
+         MOZ_SYSTEM_PLY=1
+     else
+         AC_MSG_ERROR([python ply library is not found but --with-system-ply was requested])
+     fi])
+
+AC_SUBST(MOZ_SYSTEM_PLY)
+
 if test -z "$COMPILE_ENVIRONMENT"; then
     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
 fi
 AC_SUBST(NSINSTALL_BIN)
 
 MOZ_PATH_PROG(DOXYGEN, doxygen, :)
 MOZ_PATH_PROG(AUTOCONF, autoconf, :)
 MOZ_PATH_PROGS(UNZIP, unzip)
--- a/xpcom/idl-parser/Makefile.in
+++ b/xpcom/idl-parser/Makefile.in
@@ -42,20 +42,22 @@ VPATH = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 PARSER_SRCS = \
   header.py \
   typelib.py \
   xpidl.py \
   $(NULL)
 
+ifndef MOZ_SYSTEM_PLY
 PLY_PROGS = \
   $(topsrcdir)/other-licenses/ply/ply/lex.py \
   $(topsrcdir)/other-licenses/ply/ply/yacc.py \
   $(NULL)
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 # Generate the PLY lexer and parser.
 export:: $(PARSER_SRCS) $(PLY_PROGS)
 	$(PYTHON_PATH) \
 	  -I$(topsrcdir)/other-licenses/ply \
 	  -I$(topsrcdir)/xpcom/idl-parser \
--- a/xpcom/typelib/xpidl/Makefile.in
+++ b/xpcom/typelib/xpidl/Makefile.in
@@ -47,24 +47,26 @@ MODULE		= xpcom
 SDK_BINARY = \
   $(topsrcdir)/xpcom/idl-parser/xpidl.py \
   $(topsrcdir)/xpcom/idl-parser/header.py \
   $(topsrcdir)/xpcom/idl-parser/typelib.py \
   $(DEPTH)/xpcom/idl-parser/xpidllex.py \
   $(DEPTH)/xpcom/idl-parser/xpidlyacc.py \
   $(NULL)
 
+ifndef MOZ_SYSTEM_PLY
 $(SDK_BIN_DIR)/ply::
 	$(NSINSTALL) -D $@
 
 PLY_SRCS = \
   $(topsrcdir)/other-licenses/ply/ply/__init__.py \
   $(topsrcdir)/other-licenses/ply/ply/lex.py \
   $(topsrcdir)/other-licenses/ply/ply/yacc.py \
   $(NULL)
 
 export:: $(PLY_SRCS) $(SDK_BIN_DIR)/ply
 	$(INSTALL) $(IFLAGS2) $^
+endif
 
 include $(topsrcdir)/config/rules.mk
 
 export::
 	@$(MAKE) libs