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 CVS checkouts.

Setting up the workspace

Create a new directory C:\workplace

Obtaining GNUmed

Get and install Eclipse or any other software that can get source code from a CVS. We will use Eclipse here. Get and install the CVS plugin for Eclipse. In Eclipse chose the menu item Window, select Open Perspective and choose CVS Repository Exploring

A new view will appear to the left of the Eclipse window. Click the icon that will display Add CVS Repository on mouse-over. Use cvs.savannah.gnu.org as host, use sources/gnumed as Repository path, use anoncvs as user and leave the password field blank. The connection methos is pserver.

Now switch back to the Resource browser via menu the item Window, select Open Perspective and choose Resource.

Check out the GNUmed code via menu item File>New>Project. Select Checkout Projects from CVS. In the next Window select Use existing repository location and click 'Next'. In the next window select Use and existing module and click on 'gnumed' when it appears in the list. Clicking next will bring you to the Check out window. In this window select Check out as project in the workspace. Give it the project name that corresponds to the version number of the client (e.g. gnumed-0-4-6). Click Next two times until you reach the 'Select tag' window. Click on Refresh Tags and then on the (+) icon in front of Versions. Choose rel-0-4-6 for the 'release 0.4.6' and click finish.

You can now quit Eclipse and open the folder C:\workplace.

Preparing the Build

Get and install 7zip from 7zip.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 download and extract the content of GNUmed-prerequisites.zip to the folder C:\workplace\prerequisites.

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

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.4.5.nsi). It is recommended to copy and rename it to the corresponding version (e.g. gnumed_client-0.4.6.nsi). Same goes for gnumed_server-v10.5.nsi. Be sure to open the files with an text editor and change the header to reflect the new version.

; Script generated by the HM NIS Edit Script Wizard.

; Find a way to automagically detect python location
; hardcode path and version for now - 2.3(23), 2.4(24)
;!define PYTHON_VERSION "24"
VAR PYTHON_PATH
Var /GLOBAL LANGGETTEXT
!define GNUMED_SOURCE_PATH "gnumed-0-4-6"

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "GNUmed-client"
!define PRODUCT_VERSION "0.4.6"
!define PRODUCT_SUBREV "1"
!define PRODUCT_PUBLISHER "Hilbros"

and for the server

; Script generated by the HM NIS Edit Script Wizard.
VAR PYTHON_PATH
VAR POSTGRES_PATH

!define GNUMED_SOURCE_PATH "gnumed-0-4-6"

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "GNUmed-server"
!define PRODUCT_VERSION "v10.6"
!define PRODUCT_SUBREV "2"
!define PRODUCT_PUBLISHER "Hilbros"

It is now possible to run the nsi files to build the installer. However it will fail due to the missing translations (.mo). Those need to be compiled from the .po files. To avoid this manual work helper scripts are provided in the file workplace.zip.

Copy and rename the file make_dists-0.4.5.bat to make_dists-0.4.6.bat and change it to reflect the path to the current version in the header.

SET WORKING_DIR=C:\workplace
SET VER=0.4.6
SET SERVER_VER=v10.6
SET REV=1
SET SOURCEDIR=0-4-6
SET COMPILER=c:\programme\nsis

SET ZIP=C:\Programme\7-zip
SET PREREQUS=%WORKING_DIR%\prerequisites

Change into the directory C:\workplace\gnumed-0-4-6\gnumed\dists\Windows and open the file 7zip.conf in an editor. Change 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.4.6-1.exe"
;!@InstallEnd@!

Build the installer packages.

Run the script make_dists-0.4.6.bat and watch its output. It will create three packages.

  • GNUmed-client.0.4.6-full1.exe
  • GNUmed-client.0.4.6-1.exe
  • GNUmed-server.v10.6-1.exe

Done. Install your packages. Test them. Make them available.

Topic revision: r5 - 01 Jul 2009 - 15:36:47 - SebastianHilbert
 

TWIKI.NET
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 TWiki? Send feedback