summaryrefslogtreecommitdiff
path: root/src/mongo/installer/msi/SConscript
blob: 227aa87dc116f505473cddd5c95cc5d8e91f4c41 (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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# -*- mode: python; -*-

import os

Import("env")
Import("windows")
Import("mongoCodeVersion")
Import("s3push")

env = env.Clone()
env['WIX'] = os.environ.get('WIX')
env['WIXPATH'] = r'$WIX\bin'
env['WIXHEAT'] = r'$WIXPATH\heat.exe'
env['WIXCANDLE'] = r'$WIXPATH\candle.exe'
env['WIXLIGHT'] = r'$WIXPATH\light.exe'
env['WIXUIEXT'] = r'$WIXPATH\WixUIExtension.dll'
env['MERGEMODULESBASEPATH'] = os.environ.get('MERGEMODULESBASEPATH')
if env['MERGEMODULESBASEPATH'] == None and os.environ.get('ProgramFiles(x86)') != None:
    env['MERGEMODULESBASEPATH'] = (os.environ.get('ProgramFiles(x86)') +
            r"\Common Files\Merge Modules")

sources = [ "wxs/BinaryFragment.wxs",
            "wxs/FeatureFragment.wxs",
            "wxs/LicensingFragment.wxs"
            ]
objects = [ "$BUILD_DIR/msi/BinaryFragment.wixobj",
            "$BUILD_DIR/msi/FeatureFragment.wixobj",
            "$BUILD_DIR/msi/LicensingFragment.wixobj",
           ]

# Need to do this in order to get scons to translate path separators into native format
buildDir = Dir(env["BUILD_DIR"]).path

enterprisebase = 'src\mongo\db\modules\enterprise'

# Set up parameters to pass to wix -
#
# msi_edition - "Enterprise" or "Standard"
# msi_platform - "x64" or "x86"
# msi_flavor - "2008R2Plus" or ""
#

# Enterprise
if 'enterprise' in env['MONGO_MODULES']:
  msi_edition = 'Enterprise'
  msi_flavor = '2008R2Plus'
  msi_platform = 'x64'
  upgrade_code = 'F395569E-9DD4-49E6-AE8B-16B22BBFE915'
# Community
else:
  if 'MONGO_SSL' in env['CPPDEFINES']:
    msi_edition = 'SSL'
  else:
    msi_edition = 'Standard'
  if env['PROCESSOR_ARCHITECTURE'] == 'i386':
    msi_platform = 'x86'
    msi_flavor = ''
    upgrade_code = '20623330-B71C-4FEB-8B6F-F19FAB27C457'
  else:
    msi_platform = 'x64'
    if env.get('WIN_VERSION_MIN') == 'ws08r2' or env.get('WIN_VERSION_MIN') == 'win7':
      msi_flavor = '2008R2Plus'
      if msi_edition == 'SSL':
        upgrade_code = '3AEC188B-D63E-4344-88BA-23B8539C68D5'
      else:
        upgrade_code = 'B5D765D3-7A55-4BD3-9990-A0F85F5DBE2F'
    else:
      msi_flavor = 'Legacy'
      upgrade_code = '6A44D061-6FA9-438B-8D25-4AF1BBAC61D7'

if 'msi' in BUILD_TARGETS and msi_edition == 'SSL' and msi_flavor != '2008R2Plus':
  print "Building the MongoDB SSL MSI is only supported on Windows 2008 R2+ or Windows 7+ platforms."
  print "You must add --win-version-min=ws08r2 to your scons flags"
  exit(1)

if msi_platform == 'x64':
  sources.append("wxs/Installer_64.wxs")
  objects.append("$BUILD_DIR/msi/Installer_64.wixobj")
else:
  sources.append("wxs/Installer.wxs")
  objects.append("$BUILD_DIR/msi/Installer.wixobj")

full_version = mongoCodeVersion.partition('-')[0]

# major version is the x.y, not the x.y.z
major_version = full_version
mv = major_version.split('.')
major_version = "%s.%s" % (mv[0], mv[1])

# Currently, we are planning to key the same upgrade code for each
# (msi_edition, msi_platform, msi_flavor) combination
# and change MSI ProductId on minor updates, 2.6.0 -> 2.6.1, we let Wix do automatic
# GUID generation for us rather then build a database of GUIDs in our build system
# For major updates, we are going to create a new directory/productid/upgrade_code ie, 2.6 -> 2.8


# candle: compile .wxs files into .wixobjs
env.Command(objects,
            sources,
            '"$WIXCANDLE" -wx'
            # cannot have anything other than x.x.x.x in version string.
            # we should choose a fourth version number that reflects pre-ness.
            ' -dMongoDBMajorVersion=' + major_version +
            ' -dMongoDBVersion=' + full_version +
            ' -dLicenseSource=distsrc'
            r' -dEnterpriseBase=' + enterprisebase + '\\'
            ' -dBinarySource=' + buildDir + r'\mongo'
            ' -dMergeModulesBasePath="$MERGEMODULESBASEPATH"'
            ' -dEdition=' + msi_edition +
            ' -d"ProductId=*\"'
            ' -dUpgradeCode=' + upgrade_code +
            ' -dClientSource=' + buildDir + r'\client_build'
            r' -dClientHeaderSource=${INSTALL_DIR}\include\mongo'
            ' -dConfiguration=Release'
            ' -dOutDir=' + buildDir + r'\msi'
            ' -dPlatform=' + msi_platform +
            ' -dFlavor=' + msi_flavor +
            r' -dProjectDir=buildscripts\packaging\msi\\'
            ' -dProjectName=MongoDB'
            ' -dTargetDir=' + buildDir + r'\msi'
            ' -dTargetExt=.msi'
            ' -dTargetFileName=${SERVER_ARCHIVE}'
            r' -dSaslSource=c:\sasl\bin'
            r' -dSnmpSource=c:\snmp\bin'
            r' -dSslSource=c:\openssl\bin'
            ' -out ' + buildDir + r'\msi\\'
            ' -arch ' + msi_platform +
            ' -ext "$WIXUIEXT"'
            ' $SOURCES')

#light: link .objs into an msi
msi = "$BUILD_DIR/msi/${SERVER_DIST_BASENAME}.msi"
env.Command(msi,
            objects,
            '"$WIXLIGHT" -out ${TARGET} -wx -cultures:null -sice:ICE82 '
            ' -ext "$WIXUIEXT"'
            ' ${SOURCES}')

env.AlwaysBuild(msi)

env.Alias( "msi" , msi )

def s3msipush( env , target , source ):
    s3push( source )

env.Alias( "s3msi" , [ msi ] , [ s3msipush ] )
env.AlwaysBuild( "s3msi" )