[buildj] Support for additional data



commit 6ae76efb0785a55db77f3052987eb543cdcbcb43
Author: Simon Wenner <simon wenner gmail com>
Date:   Thu Mar 25 04:23:54 2010 +0000

    Support for additional data

 buildj.py  |   25 ++++++++++++++++++++++---
 project.js |    5 +++++
 wscript    |    8 ++++++--
 3 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/buildj.py b/buildj.py
index b5f003c..473a086 100644
--- a/buildj.py
+++ b/buildj.py
@@ -70,7 +70,7 @@ class ProjectFile:
 			#TODO: There must be a name
 			return
 
-		return  str(project_node["name"])
+		return str(project_node["name"])
 		
 	def get_options (self):
 		project = self._project
@@ -108,7 +108,7 @@ class ProjectFile:
 		
 		for target in self.get_targets ():
 			tool = target.get_tool ()
-			if tool:
+			if tool and tool != "data":
 				tools.append (tool)
 		return tools
 	
@@ -205,6 +205,12 @@ class ProjectTarget:
 		
 		return args
 
+	def get_install_files (self):
+		return
+
+	def get_install_path (self):
+		return
+
 class CcTarget (ProjectTarget):
 	def get_build_arguments (self):
 		args = ProjectTarget.get_build_arguments (self)
@@ -262,6 +268,18 @@ class ValaTarget (CcTarget):
 			
 			return args
 
+class DataTarget (ProjectTarget):
+	def get_build_arguments (self):
+		return {}
+
+	def get_install_files (self):
+		if "input" not in self._target:
+			return []
+		return self.get_input ()
+
+	def get_install_path (self):
+		return "${PREFIX}/share/" + self.get_name ()
+
 class ProjectRequirement:
 	def __init__ (self, name, requirement):
 		self._name = name
@@ -368,4 +386,5 @@ class ProjectOption:
 #Mapping between tools and target classes
 TOOL_CLASS_MAP = {'cc':   CcTarget,
                   'c++':  CcTarget,
-                  'vala': ValaTarget}
+                  'vala': ValaTarget,
+                  'data': DataTarget}
diff --git a/project.js b/project.js
index c760eaa..ebad1dc 100644
--- a/project.js
+++ b/project.js
@@ -102,6 +102,11 @@
 			"type": "staticlib",
 			"tool": "vala",
 			"input": ["vala_library.vala"]
+		},
+		"my_cpp_program_data":
+		{
+			"tool": "data",
+			"input": ["data/buildj.svg"]
 		}
 	}
 }
diff --git a/wscript b/wscript
index 14bea65..53a6f10 100644
--- a/wscript
+++ b/wscript
@@ -31,7 +31,7 @@ def set_crosscompile_env (prefix, env={}):
 	
 	#Windows Prefix/suffix (what about bcc and icc?)
 	if ('mingw'  in prefix or
-	    'msvc'   in prefix  or
+	    'msvc'   in prefix or
 	    'cygwin' in prefix or
 	    'msys'   in prefix):
 		if not 'staticlib_PATTERN' in env:
@@ -58,7 +58,7 @@ def set_options (opt):
 	opt.add_option('--buildj-file', action='store', default="project.js", help='Sets the BuilDj file.')	
 	opt.add_option('--target-platform', action='store', default=None, help='Sets the target platform tuple used as a prefix for the gcc toolchain.')
 
-  #Project options
+	#Project options
 	for option in project.get_options ():
 		opt.add_option("--"+option.get_name (), **option.get_option_arguments ())
 	
@@ -97,3 +97,7 @@ def build(bld):
 	for target in project.get_targets ():
 		args = target.get_build_arguments ()
 		bld (**args)
+
+		install_files = target.get_install_files ()
+		if install_files:
+			bld.install_files (target.get_install_path (), install_files)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]