The TerraLib binary and source code distribution packages for Windows are created from a set of scripts built with NSIS (Nullsoft Scriptable Install System). These scripts can generate packges containing binaries and libraries with their dependencies, sample code, unit test code, headers, configuration files and documentation.
The set of scripts provided can be used to create general packages or specific platform packges. The following platforms are already supported by the install scripts:
This section explains in detail the design and how to customize the install scripts.
Explicar
Script for TerraLib components manipulation. Contains macros that make the insertion of all TerraLib modules in the installer separately, besides the configuration files and modules description that appears in the installer.
Script that contains the macro that applies the general settings, such as the project name, version, installation types, TerraLib path, platform and other settings.
Script for TerraLib dependencies manipulation. Contains macros that make the insertion of all TerraLib dependencies in the installer.
Script for TerraLib documentation manipulation. Contains macros that make the insertion of all TerraLib API documentation in the installer, besides the creation of some shortcuts to facilitate the user's access to the documentation after installed.
Script for TerraLib examples manipulation. Contains macros that make the insertion of all TerraLib examples source code in the installer.
Script for TerraLib header files manipulation. Contains macros that make the insertion of all TerraLib header files in the installer.
Script that contains some installer configurations, such as functions that execute when the intaller starts (.onInit), star menu shortcuts, system registry end other configurations.
Script that contains specific configurations for TerraLib installers for MinGW.
Script that contains specific configurations for TerraLib installers for Visual Studio 2010.
Script that contains configurations about the modern user interface, that defines the icons path, the installer pages (welcome, licence, components, directory), installer languages and other configurations.
Script for TerraLib plugins manipulation. Contains macros that make the insertion of all TerraLib plugins in the installer.
Script for TerraLib installer sections manipulation. This sections appear in the components page of the installers and contains the installations options where the user can unselect a specific module or documentation sections for example.
Script that contains some uninstaller configurations, such as the informations that the uninstaller must remove.
Script for TerraLib unit tests manipulation. Contains macros that make the insertion of all TerraLib unit tests source code in the installer.
Contains all specific configurations to generate a TerraLib 64 bit installer for MinGW.
Contains all specific configurations to generate a TerraLib 32 bit installer for MinGW.
Contains all specific configurations to generate a TerraLib 32 and 64 bit installer for MinGW.
Contains all specific configurations to generate a TerraLib 64 bit installer for Visual Studio 2010.
Contains all specific configurations to generate a TerraLib 32 bit installer for Visual Studio 2010.
Contains all specific configurations to generate a TerraLib 32 and 64 bit installer for Visual Studio 2010.
During the installation, the TerraLib installer insert some informations on Windows uninstaller registry. These informations inform Windows about de TerraLib, such as system name, version and especially the uninstaller path. With this registry, the Windows insert TerraLib informations on Windows uninstall manager, found in Control Panel/Programs and Features.
<color red>documentar: as chaves do registro do windows que devem ser alteradas; a questão de sistemas que são multiusuário; variáveis de ambiente; estruturas de diretórios</color>
Explicar quais são os scripts e o que cada um deles faz. justificar o porque!
installer/nsis
.You may want to modify the installer, removing some modules, removing the dependencies, and other options. We will see how to make these customizations.
If you want to remove TerraLib modules of the installation, you can do with few steps.
For example:
... !include "TeSections.nsh" ;!insertmacro TE_INSERT_COMPONENTS_SUBSECTION !include "TeComponents.nsh" ;!insertmacro TE_INCLUDE_CONFIG_FILES !insertmacro TE_INSERT_PLUGINS_SECTION !insertmacro TE_INSERT_DOCUMENTATION_SECTION ...
!macro TE_INSERT_MSVC_DEBUG_SECTION !insertmacro TE_MSVC_CONFIG SubSection "Debug" SEC_MSVC_DEBUG ;!insertmacro TE_MSVC_DEBUG_ANNOTATIONTEXT_SECTION !insertmacro TE_MSVC_DEBUG_COLOR_SECTION !insertmacro TE_MSVC_DEBUG_COMMON_SECTION ...
If you want to add a new TerraLib dependencie, you will:
!macro TE_INSERT_DEPENDENCIES_DEBUG_32 SetOutPath "$INSTDIR\bin${PLATFORM}\${GENERATOR}" File /nonfatal "${TERRALIB_DIR}\bin${PLATFORM}\${GENERATOR}\boost_date_time-vc100-mt-gd-1_44.dll" File /nonfatal "${TERRALIB_DIR}\bin${PLATFORM}\${GENERATOR}\boost_filesystem-vc100-mt-gd-1_44.dll" . . . File /nonfatal "${TERRALIB_DIR}\bin${PLATFORM}\${GENERATOR}\terralib_new_dependencie.dll"
If a new module is created in TerraLib, to insert it into the installer we should:
TeComponents.nsh
!macro TE_GET_COMPONENTS_DESCRIPTION !define TE_ANNOTATIONTEXT_DESCRIPTION "TerraLib Annotation Text Module" !define TE_NEWMODULE_DESCRIPTION "TerraLib New Module" ... !macroend !macro TE_INSERT_NEWMODULE_DEBUG SetOutPath "$INSTDIR\bin${PLATFORM}\${GENERATOR}" File /nonfatal "${TERRALIB_DIR}\bin${PLATFORM}\${GENERATOR}\terralib_NewModule_d.dll" SetOutPath "$INSTDIR\lib${PLATFORM}\${GENERATOR}" File /nonfatal "${TERRALIB_DIR}\lib${PLATFORM}\${GENERATOR}\terralib_NewModule_d.${LIB_EXTENSION}" !macroend !macro TE_INSERT_NEWMODULE_RELEASE SetOutPath "$INSTDIR\bin${PLATFORM}\${GENERATOR}" File /nonfatal "${TERRALIB_DIR}\bin${PLATFORM}\${GENERATOR}\terralib_NewModule.dll" SetOutPath "$INSTDIR\lib${PLATFORM}\${GENERATOR}" File /nonfatal "${TERRALIB_DIR}\lib${PLATFORM}\${GENERATOR}\terralib_NewModule.${LIB_EXTENSION}" !macroend
TeSections.nsh
, for Msvc Debug and Release, and MinGW Debug and Release!macro TE_MSVC_DEBUG_NEWMODULE_SECTION Section "NewModule" SEC_MSVC_DEBUG_ANNOTATIONTEXT SectionIn 1 2 4 !insertmacro TE_INSERT_NEWMODULE_DEBUG !ifdef x86-and-x64 !undef PLATFORM !define PLATFORM "64" !insertmacro TE_INSERT_NEWMODULE_DEBUG !undef PLATFORM !define PLATFORM "32" !endif SectionEnd !macroend
!macro TE_INSERT_MSVC_DEBUG_SECTION !insertmacro TE_MSVC_CONFIG SubSection "Debug" SEC_MSVC_DEBUG !insertmacro TE_MSVC_DEBUG_ANNOTATIONTEXT_SECTION !insertmacro TE_MSVC_DEBUG_NEWMODULE_SECTION ...
TeMuiConfig.nsh
:... !define MUI_ICON "${TERRALIB_DIR}\images\icons\64x64\terralib_install_icon.ico" !define MUI_UNICON "${TERRALIB_DIR}\images\icons\64x64\terralib_uninstall_icon.ico" ...
.ico
type.... !define MUI_HEADERIMAGE_BITMAP "${TERRALIB_DIR}\images\bmp\logo\terralib_installer_logo_150x57.bmp" ...
.bmp
type
To add a new language suport, just edit the TeMuiConfig.nsh
near the lines:
; Language files !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "PortugueseBR"
Contrib\Language files
.A partir daqui precisamos rever o que pode ser aproveitado!!!!!!
In order to generate the install packages one will need to install NSIS:
The compiler program - makensis
- compiles scripts like the following example into executable installation programs.
# Example script Name "Example1" OutFile "example1.exe" InstallDir "$PROGRAMFILES\Example1" Page Directory Page InstFiles Section SetOutPath $INSTDIR File ..\makensis.exe SectionEnd
The script full reference can be found here.
HM NSIS Edit is an editor/IDE for Nullsoft Scriptable Install System (NSIS). Its useful for experts and beginners in the creation of Setup programs with the NSIS. Its Script Wizard will help you to create standard Setup programs with only few clicks, also its InstallOptions designer will help you to create your own custom pages with a friendly drag and drop interface.
The HM NSIS Edit has used to create the first TerraLib Installer.
The following script is the skeleton to generate a TerraLib Installer. More details, see the file on TerraLib repository: ./terralib5/installer/nsis/terralib.nsis
.
# TerraLib Installer Script Skeleton ; Defines !define PRODUCT_NAME "TerraLib" !define PRODUCT_VERSION "5.0" !define PRODUCT_PUBLISHER "Instituto Nacional de Pesquisas Espaciais - INPE" !define PRODUCT_WEB_SITE "www.terralib.org" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" ; MUI 1.67 compatible ; Using the modern interface - http://nsis.sourceforge.net/Docs/Modern%20UI/Readme.html !include "MUI.nsh" ; Installer UIs ; License page !insertmacro MUI_PAGE_LICENSE "..\..\COPYING" ; Directory page - Enables the user select the installation directory !insertmacro MUI_PAGE_DIRECTORY ; Instfiles page - Shows the extract files !insertmacro MUI_PAGE_INSTFILES ; Finish page !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_INSTFILES ; MUI end ; Installer definitions Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "install.exe" InstallDir "$PROGRAMFILES\TerraLib" ShowInstDetails show ShowUnInstDetails show BrandingText "TerraLib Development Team" Function .onInit ; Init install commands. FunctionEnd ; TerraLib Section ; The files that will be installed goes here. ; For example: the install directory will have a folder called 'bin' that contains some build TerraLib DLLs; Section "TerraLib" SetOutPath $INSTDIR CreateDirectory "bin" ; Create the output directory SetOutPath $INSTDIR\bin ; Sets it as current directory ; Coping the files! File ..\..\bin\msvc2008\terralib_common.dll ; ... Section -Post ; Post install commands. For example, writes the unistall file, writes reg keys, etc. SectionEnd Section Uninstall ; Uninstall commands. For example, delete the created directory, delete reg keys, etc. SectionEnd
Nowadays, the script generates a installer that when executed, creates the following structure of directories with the following files:
If you installed the NSIS package, click with rigth button on file and select the option: Compile NSIS Script
.
It will be generated a executable called install.exe
.