1#!/bin/bash - 2# $Id: s_winmsi,v 1.10 2008/03/25 12:22:31 mjc Exp $ 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" 74 75PRODUCT_MAJOR=`echo "$PRODUCT_VERSION" | \ 76 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'` 77PRODUCT_MINOR=`echo "$PRODUCT_VERSION" | \ 78 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'` 79PRODUCT_PATCH=`echo "$PRODUCT_VERSION" | \ 80 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'` 81PRODUCT_MAJMIN="${PRODUCT_MAJOR}${PRODUCT_MINOR}" 82 83# Gather command line options, and use reasonable defaults 84SetupOptions \ 85 -input "$dbver.zip" \ 86 -output "$dbver.msi" \ 87 "$@" 88 89if [ "$OPT_USEBUILD" != '' ]; then 90 PRODUCT_BLDDIR="${OPT_USEBUILD}" 91 PRODUCT_SUB_BLDDIR="${OPT_USEBUILD}" 92fi 93 94Progress "s_winmsi starting, errors to $ERRORLOG" 95 96# Fail fast for certain missing files 97 98RequireCygwin 99RequireJava 100RequireTcl 101RequireWix 102RequirePerl 103 104CreateStage 105cd ${PRODUCT_STAGE} 106 107 108CreateSources ${PRODUCT_STAGE}/Sources 109 110# The docs are put into a separate feature set 111mv ${PRODUCT_STAGE}/Sources/docs ${PRODUCT_STAGE}/ 112 113# Build everything unless we were told to use a preexisting build 114if [ "$OPT_USEBUILD" = '' ]; then 115 CreateWindowsBuild 116 CreateWindowsSystem 117 CreateInclude \ 118 ${PRODUCT_SUB_BLDDIR}/installed_include \ 119 ${PRODUCT_SUB_BLDDIR}/dbinc/* \ 120 ${PRODUCT_SUB_BLDDIR}/dbinc_auto/* \ 121 ${PRODUCT_SUB_BLDDIR}/build_windows/*.h 122 CreateDbPerl 123fi 124 125if ! "$OPT_SKIPGEN" ; then 126 CreateLicenseRtf ../../../LICENSE license.rtf 127 CreateWixIncludeFiles 128fi 129 130CreateMsi ../dbcorewix.in dbcore.wxs "$OPT_OUTFILE" 131 132Progress "s_winmsi finished, $OPT_OUTFILE created." 133exit 0 134 135