Skip to content

Build Omaha Client from Sources

Andreas Niedermair edited this page Jun 27, 2018 · 4 revisions

At the moment, we're using Visual Studio 2015 Update 3 and Windows SDK 10.0.10586.0.

VS 2015, in turn, requires Windows 7 Service Pack 1 or later.

Required tools and libraries

You need to download and install the following tools and libraries:

Tools

Product Description Download link Additional instructions
Microsoft Visual Studio 2015 Upd 3. Community edition is sufficient to build. Download Instruction
WiX Toolkit version 3.0 or later Download
Python 2.4.x Exactly Python 2.4.x Download
pywin32 Download
SCons 1.3.x Exactly SCons 1.3.x Download
The GO programming language Download

Libraries

Product Description Download link
Omaha. Source code Git
Breakpad. Source code Git
Google Test. Source code Git
ATL Server headers For RegEx support Download
The Windows Template Library (WTL) Download
Google Software Construction Toolkit Download
PSTools Download

Setup a new development environment

Installation

  • You should install all tools listed above.
  • Please, make sure that the Python directory is added to the PATH environment variable.
  • Clone the Crystalnix Omaha repository and other libraries.

Finally, you should get the following folder structure:

      D:\src\omahaopensource\omaha>ls -l
      total 16
      ----rwx---+ 1 root Domain Users 752 Jul 14 12:27 README.md
      d---rwx---+ 1 root Domain Users   0 Jun 30 17:58 common
      d---rwx---+ 1 root Domain Users   0 Jul 15 11:34 omaha
      d---rwx---+ 1 root Domain Users   0 Jun 30 17:58 third_party
      ...
      
      d:\src\omahaopensource\omaha>ls -l third_party
      total 3
      d---rwx---+ 1 root Domain Users 0 Jul 14 12:52 breakpad
      drwxrwx---+ 1 root Domain Users 0 Sep  1 11:52 googletest
      d---rwx---+ 1 root Domain Users 0 Aug  7 18:58 lzma

Environment Variables

All environment variables are placed in the omaha\\hammer.bat file. Initially, it's set up for the x64 architecture and, in common case, you shouldn't change anything. Anyway, we would recommend making sure that all paths and variables are set properly:

Python and Go programming language toolchains set OMAHA_PYTHON_DIR=C:\Python24
set GOROOT=C:\go

Directories of ATL, WTL, SCT libraries
set OMAHA_ATL_SERVER_DIR=c:\atl_server
set OMAHA_WTL_DIR=c:\wtl
set SCT_DIR=c:\swtoolkit
set OMAHA_PSEXEC_DIR=%ProgramFiles(x86)%\pstools

and the others set OMAHA_TEST_BUILD_SYSTEM=1
set PATH=%PATH%;%OMAHA_PYTHON_DIR%
set OMAHA_NET_DIR=%WINDIR%\Microsoft.NET\Framework\v2.0.50727
set OMAHA_NETFX_TOOLS_DIR=%WindowsSDK_ExecutablePath_x86%
set OMAHA_WIX_DIR=%ProgramFiles(x86)%\WiX Toolset v3.11
set OMAHA_PLATFORM_SDK_DIR=%WindowsSdkDir%\
set OMAHA_WINDOWS_SDK_10_0_VERSION=%WindowsSDKVersion:~0,-1%
set OMAHA_SIGNTOOL_SDK_DIR=%WindowsSdkDir%\bin\x86
set PYTHONPATH=%OMAHA_PYTHON_DIR%
set SCONS_DIR=%OMAHA_PYTHON_DIR%\Lib\site-packages\scons-1.3.1

Customization

Due to the fact that Omaha builds "Google Update" which communicates with Google's update servers, you should customize Omaha Client. Please, see more information about this process in the Customization section.

Build

When everything is ready for a build, you can compile own version of Omaha Client by performing the following actions:

  • Open a Command Prompt as an administrator.
  • Move to the 'omaha' directory, e.g. C:\src\omahaopensource\omaha\omaha>
  • Run the vsvars.bat file corresponding to the Visual C++ instance that you want to use. In our case, it's %ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat. This step sets up the environment variables which the build scripts use.
  • Launch the hammer script to build Omaha! (Note: More advanced build options can be found in HammerOptions. In particular, if you are building on a multi-core or multi-processor, consider passing the -j# flag to Hammer to enable parallel compilation.)
  • To build all targets in all modes, type hammer --all --mode=all. This builds both debug and opt versions of the binaries, including all unit tests, and standalone installers.

Hammer should build Omaha, and then you can run a very limited set of unit tests, which must pass in order to complete the build.

Running Unit Tests

The Omaha build process includes building an automated unit test suite, based on the GTest framework. In order to run it, there are two pieces of preparation you must do:

  • Create the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\OmahaCompanyName\UpdateDev. Then, add a string value named TestSource with the value ossdev. (Note: If you are on 64 bit Windows and are using regedit to create the value then you need to place it in HKEY_LOCAL_MACHINE\Wow6432Node\SOFTWARE\OmahaCompanyName\UpdateDev. This allows 32-bit processes to read it.).
  • Download the Windows Sysinternals PSTools suite (it's available here) and save psexec.exe somewhere. Then, set the OMAHA_PSEXEC_DIR environment variable to the directory containing psexec.exe.

When running unit tests:

  • You must be connected to the Internet for some tests to pass.
  • We recommend running them with administrator privileges, as some tests do not run otherwise.
  • Some tests do not run by default because they take a long time or are otherwise inconvenient to run all the time. To run these tests, define the OMAHA_RUN_ALL_TESTS environment variable. For example, set OMAHA_RUN_ALL_TESTS=1.

To run the unit test suite, run the following executable after a successful build:

>scons-out\dbg-win\staging\omaha_unittest.exe