Creating a Windows installer for PHENIX

Contents

Introduction

Once you are satisfied that your Windows build of PHENIX passes all tests you may want to bundle it into an executable setup program to make installation easy for users. Currently the lightweight tool Makensis from Nullsoft Scriptable Install System is used for creating the installer.

Download and install it on your PC and modify the %PATH% environment variable to make makensis.exe accesible from a command prompt. It is useful to install the syntax highlightening editor "HM NIS Edit" for editing .nsi scripts. In addition it provides context sensitive help on keywords in the scripts.

How makensis.exe is run

Whether the build is done through Buildbot or done manually creating the installer starts with calling

build\bin\libtbx.create_installer.bat

with appropriate arguments as in the last line of example build script, Phenixbuild.cmd. It calls

cctbx_project\libtbx\command_line\create_installer.py

which calls

cctbx_project\libtbx\auto_build\create_installer.py

which calls

cctbx_project\libtbx\auto_build\create_windows_installer.py

which creates a short preamble of definitions such as version of Phenix and location of directories and then calls

Makensis.exe /OMakeWindowsInstaller.log /NOCD /V4 tmp\tmpinstscript.nsi

The file, tmpinstscript.nsi, is the script specifying which files to include and where to place them on the users PC. It is composed of the preamble prepended to the file

cctbx_project\libtbx\auto_build\mainphenixinstaller.nsi

which contains the bulk of information for creating the setup program. The instructions in this file are documented in the online help. Once Makensis has finished running the setup program is available as a file with the name:

dist\<version>\Phenix-<version>-<platform>-Setup.exe

which can then be deployed to users.

A few details of what is installed

The mainphenixinstaller.nsi script has been written to allow the user to install Phenix as a standard user as well as an administrator. The macro _UserIsAdmin is used for evaluating if the installer was invoked with admin rights. In the latter case the produced setup program should be invoked with administrative privileges. Phenix will then default to be installed in the directory pointed to by the %ProgramFiles(x86)% or %ProgramFiles% environment variables. The function .onInit is used for determining the location of the installation directory according to user rights. The installer will also allow the user to install the C/C++ source code used for the build. It will create a Startup group named Phenix\<version> which contains links to

  • documentation,
  • the main GUI,
  • a Phenix.python prompt,
  • a command prompt where the Phenix environment variables have been defined,
  • the uninstaller program.

The installer will also create a registry value of type string in the key:

HKEY_CURRENT_USER\Software\Phenix\<version>\InstallPath

or, if the installer is invoked with administrative privileges:

HKEY_LOCAL_MACHINE\SOFTWARE\Phenix\<version>\InstallPath

which stores the full path of where Phenix has been installed. This is useful for 3rd party programs that may want to know the location of Phenix on the PC.

During the installation a command prompt window will appear that compiles all the python sources.

The uninstaller is also defined in mainphenixinstaller.nsi. Uninstalling Phenix is done in 5 steps of which the one lasting the longest is removing all the installed files As a side effect, during uninstallation the progress bar will hang until this step has been completed.