quick intro to using bake
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 26 Mar 2011 12:40:34 +0100
changeset 6 4e53c776f061
parent 5 f4c070e26a79
child 7 be7ceee49db9
quick intro to using bake
bake/ModuleBuild.py
bake/ModuleSource.py
doc/tutorial.rst
examples/ns3/bakeconf.xml
--- a/bake/ModuleBuild.py	Sat Mar 26 11:07:26 2011 +0100
+++ b/bake/ModuleBuild.py	Sat Mar 26 12:40:34 2011 +0100
@@ -21,7 +21,7 @@
         ModuleBuild.__init__(self)
     @classmethod
     def name(cls):
-        return 'none'
+        return 'none-build'
     def build(self, logger, srcdir, blddir, installdir):
         pass
     def clean(self, logger, srcdir, blddir):
--- a/bake/ModuleSource.py	Sat Mar 26 11:07:26 2011 +0100
+++ b/bake/ModuleSource.py	Sat Mar 26 12:40:34 2011 +0100
@@ -18,6 +18,32 @@
     def update(self, logger, directory):
         raise NotImplemented()
 
+class NoneModuleSource(ModuleSource):
+    def __init__(self):
+        ModuleSource.__init__(self)
+    @classmethod
+    def name(cls):
+        return 'none-source'
+    def diff(self, logger, directory):
+        pass
+    def download(self, logger, directory):
+        pass
+    def update(self, logger, directory):
+        pass
+
+class BazaarModuleSource(ModuleSource):
+    def __init__(self):
+        ModuleSource.__init__(self)
+    @classmethod
+    def name(cls):
+        return 'bazaar'
+    def diff(self, logger, directory):
+        pass
+    def download(self, logger, directory):
+        pass
+    def update(self, logger, directory):
+        pass
+    
 class MercurialModuleSource(ModuleSource):
     def __init__(self):
         ModuleSource.__init__(self)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/tutorial.rst	Sat Mar 26 12:40:34 2011 +0100
@@ -0,0 +1,45 @@
+How do you get started with bake ?
+==================================
+
+A typical user session to build everything:::
+
+  wget http://www.nsnam.org/bakeconf.xml
+  bake configure -a
+  bake download
+  bake build
+
+The result:
+
+* bakefile.xml: contains output of configuration step
+* 'source' directory: contains downloaded code:
+** one file per tarball downloaded
+** one directory per module
+** one directory/objdir per module which contains all object files built
+* 'build' directory: contains the libraries, headers, and binaries installed by each module
+
+A more advanced user:::
+
+  wget http://www.nsnam.org/bakeconf.xml
+  mkdir opt
+  cd opt
+  bake configure -c ../bakeconf.xml -a --sourcedir=../source --builddir=. --objdir=opt --set=CFLAGS=-O3
+  bake download
+  bake build
+  # now, build debug version
+  cd ..
+  mkdir dbg
+  cd dbg
+  bake configure -c ../bakeconf.xml -a --sourcedir=../source --builddir=. --objdir=dbg --set=CFLAGS=-O0
+  bake build
+
+The result:
+
+* opt/bakefile.xml contains optimized build configuration
+* dbg/bakefile.xml contains debug build configuration
+* source contains all source code:
+** source/module/opt contains optimized object files
+** source/module/dbg contains debug object files
+* opt/ contains headers, libraries, binaries for optimized build
+* dbg/ contains headers, libraries, binaries for debug build
+
+
--- a/examples/ns3/bakeconf.xml	Sat Mar 26 11:07:26 2011 +0100
+++ b/examples/ns3/bakeconf.xml	Sat Mar 26 12:40:34 2011 +0100
@@ -1,10 +1,26 @@
 <modules>
 
+  <module name="pybindgen" version="">
+    <source type="bazaar">
+     <attribute name="url" value="https://launchpad.net/pybindgen"/>
+     <attribute name="revision" value="777"/>
+     <attribute name="tag" value="0.15.0"/>
+    </source>
+    <build type="none-build"/>
+  </module>
+
+  <module name="nsc" version="">
+    <source type="mercurial">
+      <attribute name="url" value="https://secure.wand.net.nz/mercurial/nsc"/>
+    </source>
+    <build type="none-build"/>
+  </module>
+
   <module name="iproute2" version="2.6.33">
     <source type="archive">
      <attribute name="url" value="http://devresources.linuxfoundation.org/dev/iproute2/download/iproute2-2.6.33.tar.bz2"/>
     </source>
-    <build type="none"/>
+    <build type="none-build"/>
   </module>
 
   <module name="net-next-2.6">
@@ -13,7 +29,7 @@
       <attribute name="url" value="file:///home/mathieu/code/ns-3-linux/net-next-2.6"/>
       <attribute name="revision" value="fed66381d65a35198639f564365e61a7f256bf79"/>
     </source>
-    <build type="none"/>
+    <build type="none-build"/>
   </module>
 
   <module name="ns-3-linux" version="0.1">
@@ -22,7 +38,7 @@
     </source>
     <depends_on name="net-next-2.6"/>
     <depends_on name="iproute2"/>
-    <build type="none"/>
+    <build type="none-build"/>
   </module>
 
   <module name="gdb" version="cvs">
@@ -43,7 +59,7 @@
     </source>
     <depends_on name="ns-3-linux" optional="True"/>
     <depends_on name="gdb" optional="True"/>
-    <build type="none"/>
+    <build type="none-build"/>
   </module>
 
 </modules>