| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 { | 1 { |
| 2 'includes': ['defaults.gypi'], | 2 'includes': ['defaults.gypi'], |
| 3 | 3 |
| 4 'variables': { | 4 'variables': { |
| 5 'build_type%': 'devbuild', | 5 'build_type%': 'devbuild', |
| 6 'build_version%': '', | 6 'build_version%': '', |
| 7 'shared_files': [ | 7 'shared_files': [ |
| 8 'src/shared/AutoHandle.cpp', | 8 'src/shared/AutoHandle.cpp', |
| 9 'src/shared/Communication.cpp', | 9 'src/shared/Communication.cpp', |
| 10 'src/shared/Dictionary.cpp', | 10 'src/shared/Dictionary.cpp', |
| 11 'src/shared/Utils.cpp', | 11 'src/shared/Utils.cpp', |
| 12 ] | 12 ], |
| 13 | |
| 14 # Architecture Detections | |
|
Felix Dahlke
2013/07/02 08:00:46
This describes something that's happening in dev_i
Eric
2013/07/02 12:58:06
It's happening in both the install and uninstall c
| |
| 15 # ======================= | |
| 16 # We must make an effort to locate the correct executable to manipulate the registry, | |
| 17 # because Windows automatically remaps "reg.exe" to a 32-bit version when invoked from a 32-bit program. | |
| 18 # There are _five_ different architectures relevant to this detection, | |
| 19 # all of which come in 32-bit and 64-bit versions. | |
| 20 # 1. The architecture of the processor itself. | |
| 21 # 2. The architecture of the version of Windows running. | |
| 22 # 3. The architecture of the 'python' executable that runs 'gyp'. | |
| 23 # 4. The architecture of the executable running the build, which will we eit her MSBuild or Visual Studio. | |
| 24 # 5. The architecture of the build target. | |
| 25 # Unfortunately, we cannot know the architecture of the build executable at compile time, | |
| 26 # so regardless of the architecture of python, we have a certain amount of build-time detection to do. | |
| 27 # | |
| 28 # The easy cases are 1 and 2. | |
| 29 # If Windows is 32-bit, then it doesn't matter what the processor is, all th e executables are also 32-bit | |
| 30 # and only 32-bit registrations can be supported. | |
| 31 # We represent this value as the variable 'platform_arch'. | |
| 32 # We use it below to compile out the registration project for the case of 32 -bit platform and 64-bit target. | |
| 33 # The detection we're using for this is outlined here: http://support.micros oft.com/kb/556009 | |
| 34 # It requires querying a particular registry key that indicates the architec ture of the OS. | |
| 35 # After that it's just a bunch of cmd.exe hacks to coerce the search result to one of two strings. | |
| 36 | |
| 37 'platform_arch': '<!(cmd /c reg query HKLM\\HARDWARE\\DESCRIPTION\\System\\C entralProcessor\\0 -v "Platform ID" | find "0x20" & if errorlevel 1 (echo x64) e lse echo ia32)' | |
| 38 | |
| 39 # Case 3 is relevant if only as a cautionary warning that it should be ignor ed. | |
| 40 # It's possible to detect the architecture of the python executable, but it doesn't do any good | |
| 41 # because there's no relationship between it and that of the build executa ble. | |
| 42 # Case 4 would be called 'build_arch' here if it were possible to know it in advance, but we can't. | |
| 43 # Case 5 is available as gyp variable 'target_arch'. | |
| 44 | |
| 45 # For 32-bit Windows, we have only one case; everything is 32-bit. | |
| 46 # For 64-bit Windows, we have four cases depending on the architectures of t he spawning process and which view of the registry to write to. | |
| 47 # platform spawn executable registry comment | |
| 48 # ======== ===== ========== ======== ======= | |
| 49 # 32 32 %WINDIR%\System32\reg.exe 32 Native | |
| 50 # 64 32 %WINDIR%\System32\reg.exe 32 Path name is remap ped, even if fully specified | |
| 51 # 64 64 %WINDIR%\SysWOW64\reg.exe 32 'SysWOW64' visible to both 32-bit and 64-bit processes | |
| 52 # 64 32 %WINDIR%\sysnative\reg.exe 64 Virtual directory 'sysnative' only visible in this combination | |
| 53 # 64 64 %WINDIR%\System32\reg.exe 64 Native | |
| 54 # Under 64-bit Windows, 32-bit keys appear under a "Wow6432Node" key when se en natively, that is, with a 64-bit binary, | |
| 55 # but without the modifier when seen under WoW64, that is, with a 32-bit b inary. | |
| 56 # In order to keep the syntax consistent, we want 32-bit binaries for 32-bit targets | |
| 57 # and 64-bit binaries for 64-bit targets. | |
| 58 # We need to detect the architecture of the (batch file) process at run time , but given that and the platform architecture, | |
| 59 # we can select the right "reg.exe" to run. | |
| 60 # This allows us to keep the syntax of the registration statements identical except for the path to "reg.exe". | |
| 61 # See 'dev_install.cmd' for the implementation. | |
| 13 }, | 62 }, |
| 14 | 63 'conditions': [ |
| 64 [ 'platform_arch=="ia32"', { | |
| 65 'variables': { | |
| 66 'reg32': 'system32', | |
| 67 'reg64': 'system32' # Something needed so that the .cmd file has suf ficient arguments | |
| 68 } | |
| 69 } ], | |
| 70 [ 'platform_arch=="x64"', { | |
| 71 'conditions': [ | |
| 72 [ 'target_arch=="ia32"', { | |
| 73 'variables': { | |
| 74 'reg32': 'system32', | |
| 75 'reg64': 'SysWOW64' | |
| 76 } | |
| 77 } ], | |
| 78 [ 'target_arch=="x64"', { | |
| 79 'variables': { | |
| 80 'reg32': 'sysnative', | |
| 81 'reg64': 'system32' | |
| 82 } | |
| 83 } ], | |
| 84 ], | |
| 85 } ] | |
| 86 ], | |
| 87 | |
| 15 'target_defaults': { | 88 'target_defaults': { |
| 16 'conditions': [ | 89 'conditions': [ |
| 17 [ | 90 [ |
| 18 'build_type=="devbuild"', | 91 'build_type=="devbuild"', |
| 19 { | 92 { |
| 20 'defines': ['ADBLOCK_PLUS_TEST_MODE', 'ADBLOCKPLUS_TEST_MODE'], | 93 'defines': ['ADBLOCK_PLUS_TEST_MODE', 'ADBLOCKPLUS_TEST_MODE'], |
| 21 }, | 94 }, |
| 22 { | 95 { |
| 23 'defines': ['ADBLOCK_PLUS_PRODUCTION_MODE', 'ADBLOCKPLUS_PRODUCTION_MO DE'], | 96 'defines': ['ADBLOCK_PLUS_PRODUCTION_MODE', 'ADBLOCKPLUS_PRODUCTION_MO DE'], |
| 24 }, | 97 }, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 ], | 215 ], |
| 143 } | 216 } |
| 144 ]], | 217 ]], |
| 145 'AdditionalLibraryDirectories': [ | 218 'AdditionalLibraryDirectories': [ |
| 146 '$(VCInstallDir)atlmfc/lib', | 219 '$(VCInstallDir)atlmfc/lib', |
| 147 ], | 220 ], |
| 148 'DelayLoadDLLs': ['Shell32.dll'], | 221 'DelayLoadDLLs': ['Shell32.dll'], |
| 149 }, | 222 }, |
| 150 }, | 223 }, |
| 151 }, | 224 }, |
| 225 | |
| 226 { | |
| 227 'target_name': 'Developer Install', | |
| 228 'type': 'none', | |
| 229 'dependencies': [ | |
| 230 'AdblockPlus' | |
| 231 ], | |
| 232 'actions': [ { | |
| 233 'action_name': 'Install', | |
| 234 'message': 'Performing a developer installation', | |
| 235 'inputs': [], | |
| 236 'outputs': [ | |
| 237 # This file is never written, meaning the action always runs. | |
|
Oleksandr
2013/07/02 08:16:17
Can you please elaborate on this part? I don't qui
Eric
2013/07/02 12:58:06
MSBuild is essentially a glorified Makefile, speci
| |
| 238 '<(PRODUCT_DIR)/timestamp.txt' | |
| 239 ], | |
| 240 'action': [ | |
| 241 '..\\..\\dev_install.cmd "$(OutDir)Adblockplus.dll" "$(ProjectDir)" <(re g32) <(reg64)', | |
| 242 ], | |
| 243 } ], | |
| 244 }, | |
| 245 | |
| 246 { | |
| 247 'target_name': 'Developer Uninstall', | |
| 248 'type': 'none', | |
| 249 'actions': [ { | |
| 250 'action_name': 'Uninstall', | |
| 251 'message': 'Removing any developer installation', | |
| 252 'inputs': [], | |
| 253 'outputs': [ | |
| 254 # This file is never written, meaning the action always runs. | |
| 255 '<(PRODUCT_DIR)/timestamp.txt' | |
| 256 ], | |
| 257 'action': [ | |
| 258 '..\\..\\dev_uninstall.cmd <(reg32) <(reg64)', | |
|
Felix Dahlke
2013/07/02 08:00:46
So this means that I cannot just run dev_uninstall
Eric
2013/07/02 12:58:06
It would be possible to pass in the architecture i
| |
| 259 ], | |
| 260 } ], | |
| 261 }, | |
| 152 | 262 |
| 153 { | 263 { |
| 154 'target_name': 'tests', | 264 'target_name': 'tests', |
| 155 'type': 'executable', | 265 'type': 'executable', |
| 156 'dependencies': [ | 266 'dependencies': [ |
| 157 'libadblockplus/third_party/googletest.gyp:googletest_main', | 267 'libadblockplus/third_party/googletest.gyp:googletest_main', |
| 158 ], | 268 ], |
| 159 'sources': [ | 269 'sources': [ |
| 160 'test/CommunicationTest.cpp', | 270 'test/CommunicationTest.cpp', |
| 161 'test/DictionaryTest.cpp', | 271 'test/DictionaryTest.cpp', |
| 162 '<@(shared_files)', | 272 '<@(shared_files)', |
| 163 ], | 273 ], |
| 164 'defines': ['WINVER=0x0501'], | 274 'defines': ['WINVER=0x0501'], |
| 165 'link_settings': { | 275 'link_settings': { |
| 166 'libraries': ['-ladvapi32', '-lshell32', '-lole32'], | 276 'libraries': ['-ladvapi32', '-lshell32', '-lole32'], |
| 167 }, | 277 }, |
| 168 'msvs_settings': { | 278 'msvs_settings': { |
| 169 'VCLinkerTool': { | 279 'VCLinkerTool': { |
| 170 'SubSystem': '1', # Console | 280 'SubSystem': '1', # Console |
| 171 'EntryPointSymbol': 'mainCRTStartup', | 281 'EntryPointSymbol': 'mainCRTStartup', |
| 172 }, | 282 }, |
| 173 }, | 283 }, |
| 174 }] | 284 }] |
| 175 } | 285 } |
| OLD | NEW |