• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

READMEH A D29-May-20206.8 KiB163138

build.batH A D29-May-20201.6 KiB4941

db.wxsH A D29-May-20207 KiB140130

fixup2010.xqH A D29-May-2020800 2922

fixupCsharp.xqH A D29-May-20201.3 KiB3830

genWix.pyH A D29-May-202010.5 KiB317190

generateEnv.xqH A D29-May-2020996 3629

generateGroups.xqH A D29-May-20201.3 KiB5245

generateWix.shH A D29-May-20202.2 KiB8340

links_frag.wxsH A D29-May-20203.3 KiB105104

pruneComponents.xqH A D29-May-2020567 2216

required_frag.wxsH A D29-May-20203.2 KiB111110

s_winmsi.fcnH A D29-May-202017.8 KiB571496

wixEnv.xmlH A D29-May-2020832 1811

README

1This file describes the software needed to build Windows Binaries
2for Berkeley DB as well as how to ensure that new, renamed
3or deleted files are properly handled.  For that piece, see the end
4of this file.
5
6How to Build Windows Binaries
7-----------------------------
8
9Creation of the Windows binary installation file (db-x.y.z.msi)
10is driven by dist/s_winmsi, dist/winmsi/s_winmsi.fcn
11as well as various configuration files and scripts in dist/winmsi.
12The scripts must be run from a cygwin bash shell.
13Prerequisites:
14o Cygwin
15o Visual Studio (Visual Studio 2008), make sure that the 64-bit compiler option is installed (do that by trying to build something with x64 selected).
16o WiX (version 3.x)
17o Python
18o Java/JDK
19o WiX 3.x
20o XQilla (xqilla command line is used to help construct
21  WiX .wxs files which are in an XML format)
22
23Important: It is necessary to use Python from a Windows installation
24vs Cygwin because of the pathname manipulation.
25
26Build checklist (this normally is only done once when
27setting up your machine):
28
291.  Check dist/winmsi/build.bat to set Visual Studio installation path.
302.  Add Windows Python PATH.  Cygwin's will not work.
313.  Install WiX 3.x and add the installation dir to PATH
32if it is not already set.
334.  Install a recent Java JDK and make sure java and javac
34are in your PATH.  If building the 32-bit binaries, use a 32-bit
35Java install, otherwise use a 64-bit Java install.
36  Also modify the proper variables in Visual
37Studio to find jni.h (<JDK installation dir>/include and
38<JDK installation dir>/include/win32). Note you will have to do this
39for both the Win32 and x64 platform setting for Visual Studio.
405.  If changing the release minor version (5.x->5.y), you must change
41UpgradeCode and Upgrade id in db.wxs.  It is a GUID/UUID. You can generate
42a GUID from the Python shell:
43  import uuid
44  uuid.uuid1()
45This GUID is used for upgrade between releases.
466.  From db-x.y.z/dist run "bash s_winmsi Win32" for 32-bit binaries, and
47"bash s_winmsi x64" for 64-bit binaries.
48
49The "staged" tree for building the binaries is created
50in db-x.y.z/stage.  The resulting .msi ends up in stage/wix.
51
52To test basic installation of the .msi:
53cd <db-x.y.z>/stage/wix
54  msiexec /i db-x.y.z.msi
55Uninstall:
56  msiexec /uninstall db-x.y.z.msi
57  (or use the Control Panel's uninstall programs tool)
58
59
60What is going on under the covers?
61----------------------------------
62
63The order of events can be seen in the s_winmsi script and
64is roughly:
651.  stage source components to be packaged from a clean tree.
66These include examples, doc, project files, and header files.
672.  Build Berkeley DB using winmsi/build.bat.
68This will build the basic library, utilities as well as SQL,
69STL, C#, and SQL's JDBC and ODBC components.
703.  Copy build artifacts (libraries, dlls, pdbs, exes) to
71the staging area.
72NOTE: the staging process also creates lists of files, one for
73each installation "group."  More on this below.
744.  Build "component" lists for WiX.  This process is driven
75by the shell script winmsi/generateWix.sh which also uses a
76Python script (genWix.py) and XQuery Update scripts to construct
77db_components.wxs which contains the majority of the files
78for the binary distribution.  These all end up in the
79stage/wix directory.
805.  Call WiX to generate the db-x.y.z.msi install file
81
82What files drive this process?
83------------------------------
84
85Relatively static WiX files include:
86 o db.wxs ("main" WiX input file that includes the
87    features to be installed).  This file references the
88    components/component groups that are generated in
89    db_components.wxs
90 o links_frag.wxs (references the links that become part of
91    the Windows application menu after installation)
92 o required_frag.wxs (license file, readme and other required
93   bits of installation)
94
95The main generated file is db_components.wxs which is
96created by a combination of the Python script genWix.py,
97group.* files (created by staging process), and XQuery.
98There are several XQuery scripts (dist/winmsi/*.xq) that
99perform various transformations on generated XML to make it
100ready for WiX.  They have internal comments about what they
101are doing.
102
103db_components.wxs has the complete list of files and components
104that are to be part of the install.
105
106How to change what files are included
107-------------------------------------
108
109Many files will be included automatically but some are custom.
110The files included are driven by "group.*" files that are
111created by the functions StageSourceComponents() and StageRuntimeComponents()
112in s_winmsi.fcn.  These put the paths to files in the various
113stage/group.* files based on which "feature" they are a part of.
114E.g. bin/libdb??.dll and bin/*.exe go into "group.runtime"
115and include/* go into "group.devo."  Example files go into
116"group.examples."
117
118After staging the Python script genWix.py walks the staging
119directories looking for files that match those in the group.*
120files and it generates a Component element for each set of
121files that belong to a given group in a given directory.  Let's
122look at the include directory as an example.
123In the resulting file there will be XML that looks like this:
124...
125<Directory Id="dir_include_3" Name="include">
126  <Component DiskId="1" Guid="b2ff36c0-36a8-11df-a6b5-00262db1b537" Id="_group_cxx_3" KeyPath="yes">
127    <File Id="dir_include_3_dbstl_base_iterator.h" Name="dbstl_base_iterator.h" Source="C:\Users\gmf\hg\db-5.0.13\stage\include\dbstl_base_iterator.h"/>
128    <File Id="dir_include_3_dbstl_common.h" Name="dbstl_common.h" Source="C:\Users\gmf\hg\db-5.0.13\stage\include\dbstl_common.h"/>
129    ...
130  </Component
131  <Component DiskId="1" Guid="b2ff5dd1-36a8-11df-bfe6-00262db1b537" Id="_group_devo_3" KeyPath="yes">
132    <File Id="dir_include_3_db.h" Name="db.h" Source="C:\Users\gmf\hg\db-5.0.13\stage\include\db.h"/>
133    <File Id="dir_include_3_db_cxx.h" Name="db_cxx.h" Source="C:\Users\gmf\hg\db-5.0.13\stage\include\db_cxx.h"/>
134  </Component>
135  ...
136</Directory>
137...
138
139The directory "include" has multiple components, one for "group_cxx" that
140includes the STL header files and one for "group_devo" that includes
141db.h and db_cxx.h.
142
143The output of genWix.py is massaged by various XQuery scripts to
144(1) remove stray empty components (2) add in ComponentGroup elements
145that group components into lists for inclusion by Feature
146elements (from db.wxs) and (3) insertion of Environment elements
147to modify Windows environment on install/uninstall.
148
149XQuery is a simple way to manipulate the files because they are XML.
150
151Back to how to change the lists of files...
152The important work is in the StageSourceComponents() an
153StageRuntimeComponents() functions.  That's all that should
154really need to be changed to add/rename/remove files or
155to change which group they are a part of.
156
157I'm seeing warnings when generating the package, what's wrong?
158-------------------------------------
159
160Warnings in "light.exe" that are documented in the WiX manual can be safely
161ignored.  Errors cannot be ignored.
162
163