jungerl addition: builder

Ulf Wiger <>
Fri Mar 14 22:54:31 CET 2003


I added a utility, called 'builder', to jungerl.
It's intended to simplify the building of OTP boot scripts.

A slightly contrived and only partly example from building
edoc in jungerl:

1) Check out and make the jungerl code
2) cd .../jungerl/lib/xmerl
3) erl -pa ../builder/ebin
4) 1> builder:go().

   This will try to build the following files:
   ebin/xmerl.app
   priv/xmerl.rel
   priv/xmerl.script
   priv/xmerl.boot
   priv/xmerl_load.script
   priv/xmerl_load.boot    (no start commands - only paths)
   priv/xmerl.start        (shell script, works only on unix)
   priv/xmerl.load         (another shell script)

   (The idea of the xmerl.load script is to start a VM
    with all the paths set, but only the basic applications
    running. This can be useful e.g. for initializing
    a mnesia database.)

   In the case of xmerl, it will probably fail. The
   src/xmerl.app.src contains a syntax error, as does the
   ebin/xmerl.app. Delete them and try again.

   (You may note that the version per default becomes
    "BLDR". Read builder/doc/builder.html for tips on how
    to change this.)

   You can now start an erlang node with the right paths
   for xmerl set by calling

   .../jungerl/lib/xmerl/priv/xmerl.start

   (in this case, xmerl doesn't start anything, but
    still...)

5) cd .../jungerl/syntax_tools
6) erl -pa ../builder/ebin
7) builder:go().

   This won't work either. We are told why:
   The module proplists is specified in both stdlib
   and syntax_tools.
   We could delete proplists, but a slightly less
   dramatic option might be to tell builder to skip
   the module (while we're at it, let's also skip 'test')
   Delete the generated ebin/syntax_tools.app, and re-run:

   builder:go([{skip,[test,proplists]}]).

8) Let's now move to edoc. Now we have to do some
   special stuff. Edoc needs xmerl and syntax tools,
   which now have .app files. But we need to tell
   builder to look for them, and where to look.
   One more problem: there is a syntax_tools in Erlang R9B
   (and we should probably use that one, but let's pretend
   that we really want the one we just built.)

   1> Path=["/home/etxuwig/jungerl/lib/*/ebin"|code:get_path()].
   2> builder:go([{apps,[xmerl,{syntax_tools,"BLDR"}]},{path,Path}]).

9) Let's now see how it works:
   cd ~/jungerl/lib/builder/src
   ../../edoc/priv/edoc.start
   Eshell ...
   1> edoc:file("builder.erl").
   ok

OK, so the exercise did not go flawlessly, but then
again the applications were not prepared. You can write an
.app.src file for your application, and a .rel.src to
specify your build. You can also write a src/BUILD_OPTIONS
file containing erlang expressions, where the last expr
returns a list of options for the build tool.

The general idea is that you can write one application, run
a build on that one, and start it using the proper OTP boot
scripts. Then you can write another application, and build a
script for that one, etc.

It's supposed to be simple, but there are also lots of
options to allow for custom builds and for dealing with
reluctant applications.

Read the builder/doc/builder.html for information on all the
options, and please send comments and requests for
improvements.

Thanks to Chandru and Mickael for being beta testers and
providing feedback.

/Uffe
-- 
Ulf Wiger, Senior Specialist
   / / /   Architecture & Design of Carrier-Class Software
  / / /    Strategic Product & System Management
 / / /     Ericsson AB, Connectivity and Control Nodes





More information about the erlang-questions mailing list