Creating installer packages for Windows using NSIS (guide)

The following guide will describe how to set up a workspace to continously build Windows binary packages from GNUmed releases obtained via offically released source code (tar.gz) packages.

Once your build environment has been set up, here is a short list of steps needed from release to release:
  1. copy existing nsi files to new version
  2. backup the old nsi files and *.exe files
  3. change the version for GNUmed in the gnumed-client-foo.nsh
  4. change the version for GNUmed server in gnumed-server.nsh
  5. make a copy/rename the batch file make-dists
  6. backup and the old make-dists batch file
  7. change version info in make-dists batch file
  8. change version info in patch-dbconfig and run it to get the password into db config files
  9. copy setup.py from directory misc into client directory
  10. make version info changes to setup.py
  11. open gnumed-from-cvs.conf and add 'name = GNUmed Default' in section workplace
  12. eliminate the profile local database on this PC (Linux)
  13. open the 7-zip.conf files in directory 7zip and let it point to the correct exe files
  14. now run the make-dists batch file and see the *.exe files appearing

Setting up the workspace

Create a new directory C:\workplace

Preparing the Build

Get and install 7zip from 7-zip.org

Get and install NSIS (Nullsoft installer) to C:\Programme. If it installs to another location on your system don't forget to change the path in the build scripts accordingly.

Now get and extract the content of workplace.zip to the folder C:\workplace.

Obtaining GNUmed

Get the client source code package from client repository and the server source code package from the server repository.

Extract the content of gnumed-server.xy.tgz and gnumed-client.xy.tgz to the folder C:\workplace. Older versions are already in that folder to serve as an example.

Preparing the Build scripts

It is good practice to keep older revisions. So don't just change the Nullsoft installer files (e.g. gnumed_client-0.8.6.nsi and gnumed_client-config.nsh). It is recommended to copy and rename it to the corresponding version (e.g. gnumed_client-0.8.7.nsi and gnumed_client-0.8.7frozen.nsi). Same goes for gnumed_server-14.6.nsi and gnumed_server-14.6frozen.nsi. Be sure to open the gnumed_client-config.nsh and gnumed_server-config.nsh files with an text editor and change the header to reflect the new version.

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "GNUmed-client"
!define PRODUCT_VERSION "0.8.6"
!define PRODUCT_PUBLISHER "Hilbros"
!define PRODUCT_WEB_SITE "http://wiki.gnumed.de"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

!define GNUMED_SOURCE_PATH "gnumed-client.${PRODUCT_VERSION}"

and for the server

!define PRODUCT_VERSION "14.6"
!define PRODUCT_NAME "GNUmed-server"
!define PRODUCT_PUBLISHER "Hilbros"
!define PRODUCT_WEB_SITE "http://www.gnumed.de"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

!define GNUMED_SOURCE_PATH "gnumed-server.${PRODUCT_VERSION}"
VAR PYTHON_PATH
VAR POSTGRES_PATH

Copy and rename the file make_dists-0.8.6_v14.6.bat (e.g. make_dists-0.8.7_v14.7.bat) and change its contents to reflect the path to the current version in the header .

SET WORKING_DIR=C:\workplace
SET CLIENT_VER=0.8.6
SET CLIENT_REV=2
SET SERVER_VER=14.6
SET SERVER_REV=1
SET SOURCEDIR=%CLIENT_VER%
SET COMPILER=c:\programme\nsis
SET FREEZER=C:\workplace\pyinstaller-1.4-rc1\build.py

SET ZIP=C:\Programme\7-zip
SET PREREQUSCLIENT=%WORKING_DIR%\prerequisitesclient
SET PREREQUSSERVER=%WORKING_DIR%\prerequisitesserver

Change into the directory C:\workplace\7zip\ and open 7zip_client.conf , 7zip_server.conf and 7zip_frozenserver.conf= in an editor. Edit it so it reflects the filename of the new installer file. This is neccessary so the package that includes all prerequisites will pick up the correct GNUmed client.

;!@Install@!UTF-8!
Title="Software Installation"
RunProgram="GNUmed-client.0.8.6-1.exe"
;!@InstallEnd@!

;!@Install@!UTF-8!
Title="Software Installation"
RunProgram="GNUmed-server.14.6-1.exe"
;!@InstallEnd@!

Build the installer packages.

It is now possible to run the nsi files to build the installer by invoking the gnumed_client-0.8.6.nsi and gnumed_server-14.6.nsi However we have created the helper batch file above so this is done for us.

Run the script make_dists-0.8.6_v14.6.bat and watch its output. It will create these packages.

  • GNUmed-client.0.8.6-1.exe
  • GNUmed-client.0.8.6-full1.exe
  • GNUmed-client.0.8.6-1frozen.exe
  • GNUmed-server.v14.6-1.exe
  • GNUmed-server.v14.6-full1.exe
  • GNUmed-server.v14.6-fullfrozen1.exe

Done. Install your packages. Test them. Make them available. Enjoy.
Topic revision: 03 Mar 2011, SebastianHilbert
 
Download.png
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
Powered by Olark