How to Make Your Own New add-on

Under Construction -- just shows examples for a library only, and only one that you build. One that is already built outside vesta and copied in is not covered. Nor are tools covered.


You need a components dir

By way of example, /vesta/vestasys.org/platforms/linux/debian/i386/std_env/2/lex.ves imports from /vesta/vestasys.org/platforms/linux/debian/i386/components but you might import from /vesta/host.company.org/play/user/components temporarily.

Let's call the library 'boost'

vcreate   /vesta/host.company.org/play/user/components/boost
vcheckout /vesta/host.company.org/play/user/components/boost
cd /vesta-work/$USER/boost
mkdir src

copy your library's files into src subdir.

Next steps are to create a build.ves file and a lib.ves file

boost/build.ves is a wrapper arond the lib (example: /vesta/vestasys.org/basics/basics/35/build.ves (shown here w/o the tests :))

   1 import
   2     lib = lib.ves;
   3 {
   4     return [ lib ];
   5 }

(This example shows building .a file from scratch)

boost/lib.ves does the actual compilation (example: /vesta/vestasys.org/basics/basics/35/src/lib.ves except i have both the lib.ves and build.ves in the top level of the boost package)

   1 files
   2     src;
   3 {
   4     // you need to separate your c and h files
   5     // and your h files into ones that library users have to include,
   6     // and ones that are private to compilation here
   7     // I'm going to assume this was done in the file organization in src
   8     // you can do i manually by naming files here.
   9     c_files = src/c;
  10     h_files = src/h;
  11     priv_h_files = src/priv_h;
  12     ovs = [ ];  // overrides to the ./Cxx/leaf call defined by the Cxx bridge
  13     return ./Cxx/leaf(lib_name, c_files, h_files, priv_h_files, ovs);
  14 }

./Cxx/leaf() is defined here: /vesta/vestasys.org/bridges/c_like/latest/build.ves line 860

Now you need an add-on file

Example: /vesta/vestasys.org/platforms/linux/debian/i386/std_env/2/libbasics.ves

So you may put this file in your /vesta/host.company.com/proj/build/generic_env/addons/boost or temporarily in some {{{/vesta/host.company.com/play/user2/proj_addons/boost.ves}}}

   1 import
   2   // must have these libs for boost to work
   3   prereqs = [ libgc = libgc.ves ];
   4 
   5 from /vesta/host.company.org/play/user/components import
   6     boost;  // the build.ves is default
   7 
   8 {
   9   return [ prereqs,
  10            libs = [ boost ],  // says this add-on provides libs, in particular one called boost
  11          ];
  12 }

Invoking your new lib add-on

build_proj/build.ves or, something imported by it, wants to have code like this (like the [std_env] add-on example).

Temporarily you may use something imported like /vesta/host.company.org/play/user2/proj_addons/N/build.ves. In there you'd add to a list

   1 import
   2    addons = [ 
   3         bash = bash.ves,
   4         gdbm = gdbm.ves,
   5         // ...
   6         boost = boost.ves
   7     ];
   8     return [ contents = [ addons = addons ] ];
   9 }

The addons returned from this fie have to eventually get built into dot, eg . = std_env()/env_build(addons, pkg_ovs); but your build system might already do that automatically for you.