views:

311

answers:

3

I'd like to divide tasks for the development of a NSIS installer among a couple of developers. How can I physically organize the code? Do they have to edit and merge the single .nsi script when they check into SVN? Is it possible to divide NSIS scripts into modular, separate files? This would be ideal.

Thanks!

A: 

!include "uninstaller.nsh" etc (include files normally have the .nsh extension)

Anders
A: 

You can break out some code into header files (.nsh) and include them in your script as you see fit. For instance all of my installers have the same basic MUI pages, text, images, as well as prerequisites (.NET framework). So I have an include file that sets up the MUI with all the !defines and !insertmacro MUI_PAGE_x. Then another file contains the functions used to determine if the necessary prereqs are in place.

Kyle Gagnet
+2  A: 

I use a "main" nsi file that makes up the actual installer generation and MUI code, but it includes "extra" function definitions from nsi files as well as seperate files for each installer "section".

Example:


!include "LibraryFunction1.nsh"
!include "LibraryFunction2.nsh"
!include "LibraryFunction3.nsh"

; Basic Defines and MUI code Go HERE

; Output file information
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "File-${BUILD_VER_ABRV}-${BUILD_VER_MIN}.exe"
InstallDir "$PROGRAMFILES\Location\"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""

; now include file sections
!include "FileSectionDefinition1.nsh"
!include "FileSectionDefinition2.nsh"
!include "FileSectionDefinition3.nsh"
!include "Uninstall.nsh"
crashmstr