summaryrefslogtreecommitdiff
path: root/db/dist/s_winmsi
blob: 77acd0e4b97436a0abf538f34036e16e62d1a10f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash -
#	$Id: s_winmsi,v 1.8 2005/12/01 03:04:20 bostic Exp $
#
# Note: The s_winmsi script in Berkeley DB core closely parallels the
# s_winmsi script in Berkeley DB/XML.  If you change one,
# consider whether your changes apply to the other.
# As of this writing, the two s_winmsi scripts 'diff' very closely, and
# identical portions have been factored into functions in s_winmsi.fcn.
#
#   Usage: s_winmsi [ options ]
#
# See the Usage() function in s_winmsi.fcn for a full list of options.
# By default, this script expects a db-X.Y.Z.NC.zip file
# to be in this directory, and uses it to build all binaries
# needed for an Windows install, and finally builds the an
# output db-X.Y.Z.NC.msi file that can be installed on
# Windows XP and 2000.
#
# The major other inputs to this script are these files:
#
#   features.in        list of choosable features (like Java,PHP,...)
#   files.in           what files are in each feature and where they belong
#   links.in           a list of URLs that end up as part of the Start Menu
#   environment.in     a list of environment vars that must be set
#
# This script does a number of operations, using the directory
# './winmsi/stage' as a staging area:
#
#   extracts the contents of the input ZIP file and uses those
#   files (minus docs/...) to build a Sources directory for
#   the Sources features.
#
#   builds Berkeley DB using Visual Studio tools using a .BAT
#   script derived from winbuild.in .
#
#   builds Perl and other APIs .
#
#   uses {features,files,links,environment}.in to build some include
#   files in WiX XML format.  These files are named
#   *.wixinc (e.g. directory.wixinc)
#
#   run m4 on dbcorewix.in to create dbcore.wxs .  dbcorewix.in
#   uses m4 macros to allow reasonable refactoring of repeated
#   UI code.  Also, m4 is used to include the files created in
#   the previous step.
#
#   Use the WiX compiler/linker on the .wxs files to create the .msi file.
#
################################################################

# Define all needed shell functions
. ./winmsi/s_winmsi.fcn

ERRORLOG="$0".log
SetupErrorLog

# Do this before parsing options, we need the version number
. ./RELEASE
dbver=db-$DB_VERSION.NC

# Set variables used by functions to customize this installer
PRODUCT_NAME="Berkeley DB"
PRODUCT_VERSION="$DB_VERSION"
PRODUCT_STAGE=`pwd`/winmsi/stage
PRODUCT_LICENSEDIR="${PRODUCT_STAGE}/$dbver"
PRODUCT_SUB_BLDDIR="${PRODUCT_STAGE}/$dbver"
PRODUCT_BLDDIR="${PRODUCT_STAGE}/$dbver"
PRODUCT_SRCDIR="${PRODUCT_STAGE}/$dbver"
PRODUCT_DBBUILDDIR="${PRODUCT_STAGE}/$dbver/build_unix"
PRODUCT_SHARED_WINMSIDIR=`pwd`/winmsi
PRODUCT_IMAGEDIR=$PRODUCT_SHARED_WINMSIDIR/images
PRODUCT_ZIP_FILEFMT="db-X.Y.Z.NC.zip"
PRODUCT_MSI_FILEFMT="db-X.Y.Z.NC.msi"

PRODUCT_MAJOR=`echo "$PRODUCT_VERSION" | \
    sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
PRODUCT_MINOR=`echo "$PRODUCT_VERSION" | \
    sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
PRODUCT_PATCH=`echo "$PRODUCT_VERSION" | \
    sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
PRODUCT_MAJMIN="${PRODUCT_MAJOR}${PRODUCT_MINOR}"

# Gather command line options, and use reasonable defaults
SetupOptions \
        -input "$dbver.zip" \
        -output "$dbver.msi" \
        "$@"

if [ "$OPT_USEBUILD" != '' ]; then
    PRODUCT_BLDDIR="${OPT_USEBUILD}"
    PRODUCT_SUB_BLDDIR="${OPT_USEBUILD}"
fi

Progress "s_winmsi starting, errors to $ERRORLOG"

# Fail fast for certain missing files

RequireCygwin
RequireJava
RequireTcl
RequireWix
RequirePerl

CreateStage
cd ${PRODUCT_STAGE}


CreateSources ${PRODUCT_STAGE}/Sources

# The docs are put into a separate feature set
mv ${PRODUCT_STAGE}/Sources/docs ${PRODUCT_STAGE}/

# Build everything unless we were told to use a preexisting build
if [ "$OPT_USEBUILD" = '' ]; then
    CreateWindowsBuild
    CreateWindowsSystem
    CreateInclude \
        ${PRODUCT_SUB_BLDDIR}/installed_include \
        ${PRODUCT_SUB_BLDDIR}/dbinc/* \
        ${PRODUCT_SUB_BLDDIR}/dbinc_auto/* \
        ${PRODUCT_SUB_BLDDIR}/build_windows/*.h
    CreateDbPerl
fi

if ! "$OPT_SKIPGEN" ; then
  CreateLicenseRtf ../../../LICENSE license.rtf
  CreateWixIncludeFiles
fi

CreateMsi ../dbcorewix.in dbcore.wxs "$OPT_OUTFILE"

Progress "s_winmsi finished, $OPT_OUTFILE created."
exit 0