-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Cory Fields
committed
Nov 8, 2012
1 parent
5132cf8
commit 9b04767
Showing
3 changed files
with
73 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#!/bin/sh | ||
BOOTSTRAP_STANDALONE=1 make -f bootstrap.mk | ||
BOOTSTRAP_STANDALONE=1 make -f codegenerator.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |