1#!/bin/bash - 2# $Id$ 3# 4# Note: The s_winmsi script in Berkeley DB core closely parallels the 5# s_winmsi script in Berkeley DB/XML. If you change one, 6# consider whether your changes apply to the other. 7# As of this writing, the two s_winmsi scripts 'diff' very closely, and 8# identical portions have been factored into functions in s_winmsi.fcn. 9# 10# Usage: s_winmsi [ options ] 11# 12# See the Usage() function in s_winmsi.fcn for a full list of options. 13# By default, this script expects a db-X.Y.Z.zip file 14# to be in this directory, and uses it to build all binaries 15# needed for an Windows install, and finally builds the an 16# output db-X.Y.Z.msi file that can be installed on 17# Windows XP and 2000. 18# 19# The major other inputs to this script are these files: 20# 21# features.in list of choosable features (like Java,PHP,...) 22# files.in what files are in each feature and where they belong 23# links.in a list of URLs that end up as part of the Start Menu 24# environment.in a list of environment vars that must be set 25# 26# This script does a number of operations, using the directory 27# './winmsi/stage' as a staging area: 28# 29# extracts the contents of the input ZIP file and uses those 30# files (minus docs/...) to build a Sources directory for 31# the Sources features. 32# 33# builds Berkeley DB using Visual Studio tools using a .BAT 34# script derived from winbuild.in . 35# 36# builds Perl and other APIs . 37# 38# uses {features,files,links,environment}.in to build some include 39# files in WiX XML format. These files are named 40# *.wixinc (e.g. directory.wixinc) 41# 42# run m4 on dbcorewix.in to create dbcore.wxs . dbcorewix.in 43# uses m4 macros to allow reasonable refactoring of repeated 44# UI code. Also, m4 is used to include the files created in 45# the previous step. 46# 47# Use the WiX compiler/linker on the .wxs files to create the .msi file. 48# 49################################################################ 50 51# Define all needed shell functions 52. ./winmsi/s_winmsi.fcn 53 54ERRORLOG="$0".log 55SetupErrorLog 56 57# Do this before parsing options, we need the version number 58. ./RELEASE 59dbver=db-$DB_VERSION 60 61# Set variables used by functions to customize this installer 62PRODUCT_NAME="Berkeley DB" 63PRODUCT_VERSION="$DB_VERSION" 64PRODUCT_STAGE=`pwd`/winmsi/stage 65PRODUCT_LICENSEDIR="${PRODUCT_STAGE}/$dbver" 66PRODUCT_SUB_BLDDIR="${PRODUCT_STAGE}/$dbver" 67PRODUCT_BLDDIR="${PRODUCT_STAGE}/$dbver" 68PRODUCT_SRCDIR="${PRODUCT_STAGE}/$dbver" 69PRODUCT_DBBUILDDIR="${PRODUCT_STAGE}/$dbver/build_unix" 70PRODUCT_SHARED_WINMSIDIR=`pwd`/winmsi 71PRODUCT_IMAGEDIR=$PRODUCT_SHARED_WINMSIDIR/images 72PRODUCT_ZIP_FILEFMT="db-X.Y.Z.zip" 73PRODUCT_MSI_FILEFMT="db-X.Y.Z.msi" 74PRODUCT_MSVC_VERSION=71 75 76PRODUCT_MAJOR=`echo "$PRODUCT_VERSION" | \ 77 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` 78PRODUCT_MINOR=`echo "$PRODUCT_VERSION" | \ 79 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` 80PRODUCT_PATCH=`echo "$PRODUCT_VERSION" | \ 81 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` 82PRODUCT_MAJMIN="${PRODUCT_MAJOR}${PRODUCT_MINOR}" 83 84# Gather command line options, and use reasonable defaults 85SetupOptions \ 86 -input "$dbver.zip" \ 87 -output "$dbver.msi" \ 88 "$@" 89 90if [ "$OPT_USEBUILD" != '' ]; then 91 PRODUCT_BLDDIR="${OPT_USEBUILD}" 92 PRODUCT_SUB_BLDDIR="${OPT_USEBUILD}" 93fi 94 95# Choose the MS runtime libraries to use. 96if [ -e "/cygdrive/c/Program Files/Microsoft Visual Studio 8/Common7/Tools/vsvars32.bat" ]; then 97 MSVC_ROOT_DIR="/cygdrive/c/Program Files/Microsoft Visual Studio 8/" 98 PRODUCT_MSVC_VERSION=80 99fi 100 101Progress "s_winmsi starting, errors to $ERRORLOG" 102 103# Fail fast for certain missing files 104 105RequireCygwin 106RequireJava 107RequireTcl 108RequireWix 109RequirePerl 110 111CreateStage 112cd ${PRODUCT_STAGE} 113 114 115CreateSources ${PRODUCT_STAGE}/Sources 116 117# The docs are put into a separate feature set 118mv ${PRODUCT_STAGE}/Sources/docs ${PRODUCT_STAGE}/ 119 120# Build everything unless we were told to use a preexisting build 121if [ "$OPT_USEBUILD" = '' ]; then 122 CreateWindowsBuild 123 CreateWindowsSystem 124 CreateInclude \ 125 ${PRODUCT_SUB_BLDDIR}/installed_include \ 126 ${PRODUCT_SUB_BLDDIR}/dbinc/* \ 127 ${PRODUCT_SUB_BLDDIR}/dbinc_auto/* \ 128 ${PRODUCT_SUB_BLDDIR}/build_windows/*.h \ 129 ${PRODUCT_SUB_BLDDIR}/stl/*.h 130 CreateDbPerl 131fi 132 133if ! "$OPT_SKIPGEN" ; then 134 CreateLicenseRtf ../../../LICENSE license.rtf 135 CreateWixIncludeFiles 136fi 137 138CreateMsi ../dbcorewix.in dbcore.wxs "$OPT_OUTFILE" 139 140Progress "s_winmsi finished, $OPT_OUTFILE created." 141exit 0 142 143