1<!--$Id: intro.so,v 1.7 2007/07/10 16:54:16 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB Reference Guide: Building for BREW</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<a name="2"><!--meow--></a>
12<table width="100%"><tr valign=top>
13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Building Berkeley DB for BREW</dl></b></td>
14<td align=right><a href="/debug/printlog.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/build_s60/intro.html"><img src="/images/next.gif" alt="Next"></a>
15</td></tr></table>
16<p align=center><b>Building for BREW</b></p>
17<p>This page has general instructions for building the Berkeley DB library
18and applets for the BREW platform.</p>
19<b>Building Berkeley DB for the BREW simulator</b>
20<p>The <b>build_brew</b> directory in the Berkeley DB distribution contains
21project files for Microsoft Visual C++:</p>
22<table border=1 align=center>
23<tr><th>Project File</th><th>Description</th></tr>
24<tr>    <td align=left>bdb_brew.dsw</td>    <td align=left>Visual C++ 6.0 workspace</td>    </tr>
25<tr>    <td align=left>bdb_brew.dsp</td>    <td align=left>Visual C++ 6.0 project</td>    </tr>
26</table>
27<p>The project file can be used to build the Berkeley DB library for the BREW
28platform. Both BREW SDK versions 2 and 3 are supported.  By default, the
29build is for BREW SDK version 2.</p>
30<p>The steps for building the Berkeley DB library for the BREW Simulator are as
31follows:</p>
32<ol>
33<p><li>Install the BREW SDK and BREW SDK Tools.
34<p><li>To build for BREW SDK version 3, edit the Berkeley DB source distribution file
35<b>build_brew/db_config.h</b> file and <b>remove</b> the line
36"#define HAVE_BREW_SDK2".  No changes are required to build for BREW SDK
37version 2.
38<p><li>Select <i>File -&gt; Open Workspace</i>.  Look in the build_brew
39directory for Workspaces, select <i>bdb_brew.dsw</i>, and select
40<i>Open</i>.
41<p><li>The BREW SDK creates an environment entry "BREWDIR" after the SDK
42installation. Confirm the entry exists, and if not, create an
43environment entry which points to the BREW SDK's root directory.
44<p><li>For the BREW platform, only the project "bdb_brew" is available.  Set
45the bdb_brew project as the active project and select the appropriate
46option for the build_all project (Debug or Release). Then select
47<i>OK</i>.
48<p><li>To build, press F7.
49</ol>
50<p>The build results are placed in a subdirectory of build_brew named after
51the selected configuration (for example, <b>build_brew\Release</b> or
52<b>build_brew\Debug</b>).</p>
53<p>When building the application during development, you should normally
54use compile options "Debug Multithreaded DLL" and link against
55<b>build_brew\Debug\bdb_brew.lib</b>. You can also build using a
56release version of the Berkeley DB libraries and tools, which will be placed
57in <b>build_brew\Release\bdb_brew.lib</b>. When linking against the
58release build, you should compile your code with the "Release
59Multithreaded DLL" compile option. You will also need to add the
60<b>build_brew</b> directory to the list of include directories of your
61application's project, or copy the Berkeley DB include files to another
62location.</p>
63<b>Building a BREW applet with Berkeley DB library</b>
64<p>Building a Berkeley DB application in the BREW environment is similar to
65building in a Windows environment.  Ensure that <b>db.h</b> is in the
66build include path and <b>bdb_brew.lib</b> is in the build library
67path (alternatively, you can add project dependencies to the
68<b>bdb_brew</b> project).</p>
69<p>BREW applets require a few minor additions:</p>
70<ol>
71<p><li>The <b>BDBApp</b> structure must be extended -- the extended
72definition of BDBApp is found in the include file <b>db.h</b>.
73<p><li>Before any Berkeley DB operations are performed, the applet must call the "int
74brew_bdb_begin(void)" function.  This function returns 0 on success, and
75non-zero on failure.
76<p><li>After the last Berkeley DB operation is performed, the applet must call the
77"void brew_bdb_end(void)" function.  Note that the brew_bdb_end function
78cannot be called in the applet "cleanup" function.  If that is a
79requirement, use the following code instead:
80<blockquote><pre>BDBApp *pMe=(BDBApp *)po;
81if (pMe-&gt;db_global_values != NULL)
82	FREE(pMe-&gt;db_global_values);</pre></blockquote>
83</ol>
84<b>Building a BREW applet for the physical device</b>
85<p>The binaries linked with the Berkeley DB library for the BREW simulator are
86not target files that can run on the physical device.  In order to build
87for the physical device, an ARM compiler is needed: the recommended ARM
88compiler is ARM Developer Suite 1.2.</p>
89<p>The steps for building a BREW applet for the physical device are as
90follows:</p>
91<ol>
92<p><li>Set the target BREW Applet project as the active project.
93<p><li>Select "Generate ARM Make file" in the BREW tool bar for VC6, and a make
94file will be generated (if this step does not work, confirm your ADS was
95correctly installed).
96<p><li>The Berkeley DB library must then be manually added to this make file.  See the
97<b>build_brew\bdbread.mak</b> file in the Berkeley DB distribution for an
98example.
99<p><li>Select <i>Tools -&gt; BREW Application 'Make'</i> to build.
100</ol>
101<p>The target .mod file will be created in the build directory, and this
102is the file which should be uploaded to the physical device.</p>
103<table width="100%"><tr><td><br></td><td align=right><a href="/debug/printlog.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/build_s60/intro.html"><img src="/images/next.gif" alt="Next"></a>
104</td></tr></table>
105<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
106</body>
107</html>
108