Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

build: try to code-gen during bootstrap

This allows us to create a completely bootstrapped tarball that does not
require java or swig as build-deps.
  • Loading branch information...
commit 9b0476705cdab5f295a15df08bbc36c92ee80236 1 parent 5132cf8
Cory Fields authored
Showing with 73 additions and 48 deletions.
  1. +1 −0  bootstrap
  2. +60 −0 codegenerator.mk
  3. +12 −48 xbmc/interfaces/python/Makefile.in
View
1  bootstrap
@@ -1,2 +1,3 @@
#!/bin/sh
BOOTSTRAP_STANDALONE=1 make -f bootstrap.mk
+BOOTSTRAP_STANDALONE=1 make -f codegenerator.mk
View
60 codegenerator.mk
@@ -0,0 +1,60 @@
+TOPDIR ?= .
+INTERFACES_DIR ?= xbmc/interfaces
+
+JAVA ?= $(shell which java)
+ifeq ($(JAVA),)
+JAVA = java-not-found
+endif
+
+SWIG ?= $(shell which swig)
+ifeq ($(SWIG),)
+SWIG = swig-not-found
+endif
+
+DOXYGEN ?= $(shell which doxygen)
+ifeq ($(DOXYGEN),)
+DOXYGEN = doxygen-not-found
+else
+DOXY_XML_PATH=$(GENDIR)/doxygenxml
+endif
+
+GENDIR = $(INTERFACES_DIR)/python/generated
+GROOVY_DIR = $(TOPDIR)/lib/groovy
+
+GENERATED = $(GENDIR)/AddonModuleXbmc.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcgui.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcplugin.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcaddon.cpp
+GENERATED += $(GENDIR)/AddonModuleXbmcvfs.cpp
+
+vpath %.i $(INTERFACES_DIR)/swig
+
+$(GENDIR)/%.cpp: $(GENDIR)/%.xml $(JAVA) $(SWIG) $(DOXY_XML_PATH)
+ $(JAVA) -cp "$(GROOVY_DIR)/groovy-all-1.8.4.jar:$(GROOVY_DIR)/commons-lang-2.6.jar:$(TOPDIR)/tools/codegenerator:$(INTERFACES_DIR)/python" \
+ groovy.ui.GroovyMain $(TOPDIR)/tools/codegenerator/Generator.groovy $< $(INTERFACES_DIR)/python/PythonSwig.cpp.template $@ $(DOXY_XML_PATH)
+ rm $<
+
+$(GENDIR)/%.xml: %.i $(SWIG) $(JAVA)
+ mkdir -p $(GENDIR)
+ $(SWIG) -w401 -c++ -o $@ -xml -I$(TOPDIR)/xbmc -xmllang python $<
+
+codegenerated: $(DOXYGEN) $(SWIG) $(JAVA) $(GENERATED)
+
+$(DOXY_XML_PATH): $(SWIG) $(JAVA)
+ cd $(INTERFACES_DIR)/python; ($(DOXYGEN) Doxyfile > /dev/null) 2>&1 | grep -v " warning: "
+ touch $@
+
+$(DOXYGEN):
+ @echo "Warning: No doxygen installed. The Api will not have any docstrings."
+ mkdir -p $(GENDIR)/doxygenxml
+
+$(JAVA):
+ @echo Java not found, it will be used if found after configure.
+ @echo This is not necessarily an error.
+ @false
+
+$(SWIG):
+ @echo Swig not found, it will be used if found after configure.
+ @echo This is not necessarily an error.
+ @false
+
View
60 xbmc/interfaces/python/Makefile.in
@@ -1,61 +1,25 @@
INCLUDES=-I../../.. -I. -I../../ -I../../linux -I../../../guilib -I.
-INTERFACES = AddonModuleXbmc.i
-INTERFACES += AddonModuleXbmcgui.i
-INTERFACES += AddonModuleXbmcplugin.i
-INTERFACES += AddonModuleXbmcaddon.i
-INTERFACES += AddonModuleXbmcvfs.i
-
-GENDIR = generated
+ifeq (@USE_DOXYGEN@,1)
+DOXYGEN=@DOXYGEN_EXE@
+endif
-GENERATED = $(patsubst %.i,$(GENDIR)/%.cpp,$(INTERFACES))
+TOPDIR = @abs_top_srcdir@
+INTERFACES_DIR = @abs_top_srcdir@/xbmc/interfaces
+JAVA=@JAVA_EXE@
+SWIG=@SWIG_EXE@
+LIB=python_binding.a
+all: $(LIB)
-GENERATOR=@abs_top_srcdir@/tools/codegenerator
+include ../../../codegenerator.mk
SRCS= CallbackHandler.cpp LanguageHook.cpp \
XBPyThread.cpp XBPython.cpp swig.cpp \
$(GENERATED)
-SWIG_INTERFACE_DIR=../swig
-
-ifeq (@USE_DOXYGEN@,1)
-DOXY_XML_PATH=$(GENDIR)/doxygenxml
-else
-DOXY_XML_PATH=
-endif
-
-SWIG_INC += -I@abs_top_srcdir@/xbmc
-INCLUDES += @PYTHON_CPPFLAGS@ $(SWIG_INC)
-
-CLEAN_FILES=$(GENDIR)
-
-LIB=python_binding.a
-
-CXXFLAGS+= -DSWIGRUNTIME_DEBUG -DSTATIC_LINKED
-
-# This prevents the removal of the intermediate files. Without
-# this target the make will re-reun the generator a second time
-# without any changes.
-.SECONDARY:
+INCLUDES += @PYTHON_CPPFLAGS@
+.SECONDARY: $(GENERATED)
include ../../../Makefile.include
-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
-$(GENDIR)/dummy: ../legacy/*.h
- mkdir -p $(GENDIR)
- touch $(GENDIR)/dummy
-
-$(GENDIR)/doxygenxml/dummy: $(GENDIR)/dummy ./Doxyfile
-ifeq (@USE_DOXYGEN@,1)
- (@DOXYGEN_EXE@ > /dev/null) 2>&1 | grep -v " warning: "
-else
- echo "Warning: No doxygen installed. The Api will not have any docstrings."
- mkdir -p $(GENDIR)/doxygenxml
-endif
- touch $(GENDIR)/doxygenxml/dummy
-
-$(GENDIR)/%.xml: $(SWIG_INTERFACE_DIR)/%.i $(GENDIR)/dummy $(GENDIR)/doxygenxml/dummy
- @SWIG_EXE@ -w401 -c++ -outdir $(GENDIR) -o $@ -xml $(SWIG_INC) -xmllang python $<
-
-$(GENDIR)/%.cpp: $(GENDIR)/%.xml
- @JAVA_EXE@ -cp "../../../lib/groovy/groovy-all-1.8.4.jar:../../../lib/groovy/commons-lang-2.6.jar:$(GENERATOR):./" groovy.ui.GroovyMain $(GENERATOR)/Generator.groovy $< PythonSwig.cpp.template $@ $(DOXY_XML_PATH)
Please sign in to comment.
Something went wrong with that request. Please try again.