OLD | NEW |
| (Empty) |
1 # Copyright 2009, Google Inc. | |
2 # All rights reserved. | |
3 # | |
4 # Redistribution and use in source and binary forms, with or without | |
5 # modification, are permitted provided that the following conditions are | |
6 # met: | |
7 # | |
8 # * Redistributions of source code must retain the above copyright | |
9 # notice, this list of conditions and the following disclaimer. | |
10 # * Redistributions in binary form must reproduce the above | |
11 # copyright notice, this list of conditions and the following disclaimer | |
12 # in the documentation and/or other materials provided with the | |
13 # distribution. | |
14 # * Neither the name of Google Inc. nor the names of its | |
15 # contributors may be used to endorse or promote products derived from | |
16 # this software without specific prior written permission. | |
17 # | |
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 | |
30 | |
31 import os | |
32 Import('env') | |
33 | |
34 INPUTS = [ | |
35 'custom_actions.cc', | |
36 ] | |
37 | |
38 CUSTOM_ACTIONS_LIBS = [ | |
39 'advapi32', | |
40 'dxguid', | |
41 'msi', | |
42 'ole32', | |
43 'oleaut32', | |
44 'shell32', | |
45 'shlwapi', | |
46 'user32', | |
47 ] | |
48 | |
49 # Build the dll, provide our own set of libraries to be linked with our dll. | |
50 # It is important to have full control of this since custom actions will run | |
51 # in a 'sandbox' and can't have external dependencies. | |
52 cactions = env.ComponentLibrary('cactions', INPUTS, LIBS=CUSTOM_ACTIONS_LIBS, | |
53 COMPONENT_STATIC=False) | |
54 | |
55 # copy to artifacts | |
56 env.Replicate('$ARTIFACTS_DIR', cactions[0]) | |
57 | |
58 # Unique guid for o3d namespace generated by www.guidgen.com | |
59 o3d_namespace_guid = 'B445DBAE-F5F9-435A-9A9B-088261CDF00A' | |
60 | |
61 # Pull out version numbers. | |
62 nppversion = env.get('O3D_PLUGIN_VERSION_COMMAS') | |
63 dotnppversion = env.get('O3D_PLUGIN_VERSION') | |
64 # We don't actually want the extras version to update by itself; it should | |
65 # change only when we actually add something to the installer or change the | |
66 # d3dx9 version. This version is therefore independent of the o3d plugin and | |
67 # sdk versions. | |
68 extrasversion ='0,1,1,0' | |
69 dotextrasversion = '0.1.1.0' | |
70 | |
71 # TODO: this should be a tool!! | |
72 | |
73 # Utility function for generating GUID's in the o3d namespace. | |
74 def gen_named_guid(namespace_guid, name, version): | |
75 nbguidgen_exe = env.File('$SCONSTRUCT_DIR/nbguidgen/win/nbguidgen.exe') | |
76 guid = os.popen('%s %s %s' % | |
77 (nbguidgen_exe.abspath, namespace_guid, | |
78 '%s-%s' % (name, version))).read() | |
79 return guid | |
80 | |
81 def get_guid_generator(namespace_guid, version): | |
82 return lambda name: gen_named_guid(namespace_guid, name, version) | |
83 | |
84 # TODO: These all return the same generator if their versions match. | |
85 # Is that a problem? Do we really need more than one of them? | |
86 plugin_guid_generator = \ | |
87 get_guid_generator(o3d_namespace_guid, nppversion) | |
88 extras_guid_generator = \ | |
89 get_guid_generator(o3d_namespace_guid, extrasversion) | |
90 | |
91 google_update_reg_path = 'Software\\Google\\Update\\Clients\\' | |
92 google_update_state_reg_path = 'Software\\Google\\Update\\ClientState\\' | |
93 | |
94 # Guids and other variables for the plugin installer: | |
95 o3d_npp_product_guid = plugin_guid_generator('o3d_product') | |
96 o3d_npp_package_guid = plugin_guid_generator('o3d_package') | |
97 dx_redist_guid = plugin_guid_generator('dx_redist') | |
98 d3dx_guid = plugin_guid_generator('d3dx') | |
99 | |
100 # Changing the following values would break upgrade paths, so we hard-code the | |
101 # values instead of generating them. The commands used to generate them are | |
102 # kept, so that we can avoid creating collisions accidentally. | |
103 | |
104 # bad_old_o3d_upgrade_code = gen_named_guid(o3d_namespace_guid, | |
105 # 'magicflute_upgrade', '') | |
106 # o3d_npp_upgrade_code = gen_named_guid(o3d_namespace_guid, | |
107 # 'plugin_upgrade', '') | |
108 # o3d_extras_upgrade_code = gen_named_guid(o3d_namespace_guid, | |
109 # 'extras_upgrade', '') | |
110 bad_old_o3d_upgrade_code = 'dc819ed6-4155-3cff-b580-45626aed5848' | |
111 o3d_npp_upgrade_code = '0f098121-2876-3c23-bd4c-501220ecbb42' | |
112 o3d_extras_upgrade_code = 'c271f2f0-c7ad-3bc9-8216-211436aa2244' | |
113 | |
114 # Keep these around for historical reasons; if we ever want to bring the SDK | |
115 # back, we might want to use the same GUIDs and Google Update project for | |
116 # simplicity. | |
117 #o3d_sdk_upgrade_code = 'd6b024ab-1784-348b-80c5-96ab43799d0a' | |
118 #o3d_sdk_google_update_guid = '{00764f6f-9998-4520-9c41-94a30e36565a}' | |
119 | |
120 o3d_npp_component_guid = plugin_guid_generator( | |
121 'o3d_npplugin_component') | |
122 o3d_iep_component_guid = plugin_guid_generator( | |
123 'o3d_ieplugin_component') | |
124 o3d_npp_google_update_reg_component_guid = plugin_guid_generator( | |
125 'o3d_user_google_update_reg_component') | |
126 o3d_reporter_guid = plugin_guid_generator('o3d_reporter') | |
127 o3d_driver_blacklist_guid = plugin_guid_generator( | |
128 'o3d_driver_blacklist') | |
129 o3d_software_renderer_guid = plugin_guid_generator( | |
130 'o3d_software_renderer') | |
131 o3d_npp_google_update_guid = '{70308795-045C-42da-8F4E-D452381A7459}' | |
132 o3d_npp_reg_key = '%s%s' % (google_update_reg_path, o3d_npp_google_update_guid) | |
133 o3d_npp_state_reg_key = '%s%s' % ( | |
134 google_update_state_reg_path, o3d_npp_google_update_guid) | |
135 | |
136 # Guids and other variables for the extras installer: | |
137 o3d_extras_d3dx_component_guid = plugin_guid_generator( | |
138 'o3d_extras_d3dx_component') | |
139 o3d_extras_product_guid = extras_guid_generator('o3d_extras_product') | |
140 o3d_extras_package_guid = extras_guid_generator('o3d_extras_package') | |
141 o3d_get_extras_guid = gen_named_guid(o3d_namespace_guid, | |
142 'extras_installer', '') | |
143 | |
144 o3d_extras_google_update_guid = '{34B2805D-C72C-4f81-AED5-5A22D1E092F1}' | |
145 o3d_extras_reg_key = '%s%s' % (google_update_reg_path, o3d_extras_google_update_
guid) | |
146 | |
147 # Wix tool needs to be in the PATH. | |
148 # TODO: the wix tool should not need this dance! | |
149 wix_path = env.Dir('$WIX_DIR') | |
150 path = os.environ['PATH'] | |
151 path += os.pathsep + wix_path.abspath | |
152 os.environ['PATH'] = path | |
153 | |
154 # Add the wix tool to the SCons environment. | |
155 env.Tool('wix') | |
156 | |
157 # Lookup the plugin to be installed | |
158 npplugin_path = env.File('$ARTIFACTS_DIR/npo3dautoplugin.dll') | |
159 ieplugin_path = env.File('$ARTIFACTS_DIR/o3d_host.dll') | |
160 conditioner_path = env.File('$ARTIFACTS_DIR/o3dConditioner.exe') | |
161 cglib1_path = env.File('$ARTIFACTS_DIR/cg.dll') | |
162 cglib2_path = env.File('$ARTIFACTS_DIR/cgGL.dll') | |
163 cgc_path = env.File('$ARTIFACTS_DIR/cgc.exe') | |
164 docs_path = env.File('$SCONSTRUCT_DIR/installer/win/docs.url') | |
165 rep_path = env.File('$ARTIFACTS_DIR/reporter.exe') | |
166 dbl_path = env.File('$SCONSTRUCT_DIR/installer/win/driver_blacklist.txt') | |
167 get_extras_path = env.File('$ARTIFACTS_DIR/getextras.exe') | |
168 custom_actions_path = env.File('$ARTIFACTS_DIR/cactions.dll') | |
169 | |
170 # Tell wix to include the software renderer IFF it's there. | |
171 software_renderer_path = \ | |
172 env.File('$SWIFTSHADER_DIR/swiftshader_d3d9.dll').abspath | |
173 include_software_renderer = os.path.exists(software_renderer_path) | |
174 | |
175 # Path to custom actions dll. | |
176 cactions_dll_path = env.File('$ARTIFACTS_DIR/cactions.dll') | |
177 | |
178 # Pass flags to the wix compiler. | |
179 env.Append(WIXCANDLEFLAGS = [ | |
180 '-dCustomActionsPath=' + custom_actions_path.abspath, | |
181 '-dD3DXGuid=' + d3dx_guid, | |
182 '-dDBLGuid=' + o3d_driver_blacklist_guid, | |
183 '-dDBLPath=' + dbl_path.abspath, | |
184 '-dDeprecatedUpgradeCode=' + bad_old_o3d_upgrade_code, | |
185 '-dGetExtrasGuid=' + o3d_get_extras_guid, | |
186 '-dGetExtrasPath=' + get_extras_path.abspath, | |
187 '-dIEPluginPath=' + ieplugin_path.abspath, | |
188 '-dIepComponentGuid=' + o3d_iep_component_guid, | |
189 '-dIncludeSoftwareRenderer=%s' % include_software_renderer, | |
190 '-dNPPluginPath=' + npplugin_path.abspath, | |
191 '-dNppComponentGuid=' + o3d_npp_component_guid, | |
192 '-dNppGoogleUpdateRegGuid=' + o3d_npp_google_update_reg_component_guid, | |
193 '-dNppGoogleUpdateRegKey=' + o3d_npp_reg_key, | |
194 '-dNppGoogleUpdateStateRegKey=' + o3d_npp_state_reg_key, | |
195 '-dNppPackageGuid=' + o3d_npp_package_guid, | |
196 '-dNppProductGuid=' + o3d_npp_product_guid, | |
197 '-dNppUpgradeCode=' + o3d_npp_upgrade_code, | |
198 '-dNppVersion=' + dotnppversion, | |
199 '-dRepGuid=' + o3d_reporter_guid, | |
200 '-dRepPath=' + rep_path.abspath, | |
201 '-dSoftwareRendererGuid=' + o3d_software_renderer_guid, | |
202 '-dSoftwareRendererPath=' + software_renderer_path, | |
203 ]) | |
204 | |
205 # Build installer | |
206 installer_msi = env.WiX('o3d.msi', ['o3d.wxs']) | |
207 | |
208 # Make sure that the plugin dll has been built before building the installer. | |
209 # Make sure that the custom action dll has been built before building the | |
210 # installer. | |
211 # Relies on reporter.exe being built prior to installer. | |
212 env.Depends(installer_msi, | |
213 [npplugin_path, ieplugin_path, cactions_dll_path, rep_path, | |
214 get_extras_path]) | |
215 | |
216 # Copy to artifacts. | |
217 env.Replicate('$ARTIFACTS_DIR', installer_msi) | |
218 | |
219 | |
220 | |
221 # Path to DirectX redistribution files. | |
222 dx_redist_path = env.Dir('$DIRECTX_REDIST_DIR') | |
223 | |
224 # Only build o3dextras if we have the dx redistributables. | |
225 if os.path.exists(dx_redist_path.abspath): | |
226 # New WiX flags for the Extras package [currently just the d3dx9 dll]. Note | |
227 # that this DOESN'T make the above flags go away; it just adds new ones or | |
228 # overwrites name clashes. So we use distinctive names so as to avoid | |
229 # surprises. The only flag from above that's used in the extras installer is | |
230 # DxRedistPath. | |
231 env.Append(WIXCANDLEFLAGS = [ | |
232 '-dDxRedistPath=' + dx_redist_path.abspath, | |
233 '-dExtrasD3DXComponentGuid=' + o3d_extras_d3dx_component_guid, | |
234 '-dExtrasProductGuid=' + o3d_extras_product_guid, | |
235 '-dExtrasUpgradeCode=' + o3d_extras_upgrade_code, | |
236 '-dExtrasPackageGuid=' + o3d_extras_package_guid, | |
237 '-dExtrasVersion=' + dotextrasversion, | |
238 '-dExtrasGoogleUpdateRegGuid=' + o3d_extras_google_update_guid, | |
239 '-dExtrasGoogleUpdateRegKey=' + o3d_extras_reg_key, | |
240 ]) | |
241 | |
242 # Build the installer | |
243 extras_msi = env.WiX('o3dextras.msi', ['o3dextras.wxs']) | |
244 | |
245 # copy to artifacts | |
246 env.Replicate('$ARTIFACTS_DIR', extras_msi) | |
OLD | NEW |