Skip to content
Permalink
Browse files
osgeo4w: backport packaging updates to 1.8.0
  • Loading branch information
jef-n committed Jan 27, 2013
1 parent 3d2bcfc commit f440b60f2799deb89c41ffcac30476b3053bc596
@@ -119,27 +119,27 @@ ShowUnInstDetails show

;----------------------------------------------------------------------------------------------------------------------------

;.onInit Function (called when the installer is nearly finished initializing)
; .onInit Function (called when the installer is nearly finished initializing)

;Check if QGIS is already installed on the system and, if yes, what version and binary release;
;depending on that, select the install procedure:
; Check if QGIS is already installed on the system and, if yes, what version and binary release;
; depending on that, select the install procedure:

;1. first installation = if QGIS is not already installed
;install QGIS asking for the install PATH
; 1. first installation = if QGIS is not already installed
; install QGIS asking for the install PATH

;2. upgrade installation = if an older release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
;QGIS will be installed in the same PATH of the previous installation
; 2. upgrade installation = if an older release of QGIS is already installed
; call the uninstaller of the currently installed QGIS release
; if the uninstall procedure succeeded, call the current installer without asking for the install PATH
; QGIS will be installed in the same PATH of the previous installation

;3. downgrade installation = if a newer release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer without asking for the install PATH
;QGIS will be installed in the same PATH of the previous installation
; 3. downgrade installation = if a newer release of QGIS is already installed
; call the uninstaller of the currently installed QGIS release
; if the uninstall procedure succeeded, call the current installer without asking for the install PATH
; QGIS will be installed in the same PATH of the previous installation

;4. repair installation = if the same release of QGIS is already installed
;call the uninstaller of the currently installed QGIS release
;if the uninstall procedure succeeded, call the current installer asking for the install PATH
; 4. repair installation = if the same release of QGIS is already installed
; call the uninstaller of the currently installed QGIS release
; if the uninstall procedure succeeded, call the current installer asking for the install PATH

;the currently installed release of QGIS is defined by the variable $INSTALLED_VERSION = $INSTALLED_SVN_REVISION + $INSTALLED_BINARY_REVISION

@@ -150,20 +150,20 @@ Function .onInit

Var /GLOBAL UNINSTALL_STRING
Var /GLOBAL INSTALL_PATH

Var /GLOBAL INSTALLED_VERSION_NUMBER
Var /GLOBAL INSTALLED_SVN_REVISION
Var /GLOBAL INSTALLED_BINARY_REVISION

Var /GLOBAL INSTALLED_VERSION

Var /GLOBAL DISPLAYED_INSTALLED_VERSION

Var /GLOBAL MESSAGE_0_
Var /GLOBAL MESSAGE_1_
Var /GLOBAL MESSAGE_2_
Var /GLOBAL MESSAGE_3_

ReadRegStr $UNINSTALL_STRING HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${QGIS_BASE}" "UninstallString"
ReadRegStr $INSTALL_PATH HKLM "Software\${QGIS_BASE}" "InstallPath"
ReadRegStr $INSTALLED_VERSION_NUMBER HKLM "Software\${QGIS_BASE}" "VersionNumber"
@@ -174,22 +174,22 @@ Function .onInit
${EndIf}

ReadRegStr $INSTALLED_BINARY_REVISION HKLM "Software\${QGIS_BASE}" "BinaryRevision"

StrCpy $MESSAGE_0_ "${CHECK_INSTALL_NAME} is already installed on your system.$\r$\n"
StrCpy $MESSAGE_0_ "$MESSAGE_0_$\r$\n"
!if ${INSTALLER_TYPE} == "Release"

!if ${INSTALLER_TYPE} == "Release"
${If} $INSTALLED_BINARY_REVISION == ""
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER"
${Else}
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
${EndIf}
!else
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_SVN_REVISION-$INSTALLED_BINARY_REVISION"
StrCpy $DISPLAYED_INSTALLED_VERSION "$INSTALLED_VERSION_NUMBER-$INSTALLED_BINARY_REVISION"
!endif

StrCpy $MESSAGE_0_ "$MESSAGE_0_The installed release is $DISPLAYED_INSTALLED_VERSION$\r$\n"

StrCpy $MESSAGE_1_ "$MESSAGE_0_$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_1_You are going to install a newer release of ${CHECK_INSTALL_NAME}$\r$\n"
StrCpy $MESSAGE_1_ "$MESSAGE_1_$\r$\n"
@@ -422,6 +422,8 @@ Section "Quantum GIS" SecQGIS
GetFullPathName /SHORT $0 $INSTALL_DIR
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_ROOT", "$0").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_STARTMENU", "$SMPROGRAMS\${QGIS_BASE}").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_MENU_LINKS", "1").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP_LINKS", "1").r0'

ReadEnvStr $0 COMSPEC
nsExec::ExecToLog '"$0" /c "$INSTALL_DIR\postinstall.bat"'
@@ -433,13 +435,23 @@ RebootNecessary:
SetRebootFlag true

NoRebootNecessary:

Delete "$DESKTOP\Quantum GIS (${VERSION_NUMBER}).lnk"
CreateShortCut "$DESKTOP\Quantum GIS (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
Delete "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS (${VERSION_NUMBER}).lnk"

Delete "$DESKTOP\Quantum GIS Desktop (${VERSION_NUMBER}).lnk"
CreateShortCut "$DESKTOP\Quantum GIS Desktop (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS (${VERSION_NUMBER}).lnk"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
Delete "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS Desktop (${VERSION_NUMBER}).lnk"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS Desktop (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$DESKTOP\Quantum GIS Browser (${VERSION_NUMBER}).lnk"
CreateShortCut "$DESKTOP\Quantum GIS Browser (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}-browser.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"

Delete "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS Browser (${VERSION_NUMBER}).lnk"
CreateShortCut "$SMPROGRAMS\${QGIS_BASE}\Quantum GIS Browser (${VERSION_NUMBER}).lnk" "$INSTALL_DIR\bin\nircmd.exe" 'exec hide "$INSTALL_DIR\bin\${SHORTNAME}-browser.bat"' \
"$INSTALL_DIR\icons\QGIS.ico" "" SW_SHOWNORMAL "" "Launch ${COMPLETE_NAME}"
!else
CreateShortCut "$DESKTOP\${QGIS_BASE}.lnk" "$INSTALL_DIR\bin\qgis.exe" ""\
@@ -509,7 +521,7 @@ Section /O "North Carolina Data Set" SecNorthCarolinaSDB
;Set the size (in KB) of the unpacked archive file
AddSize 293314

StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
StrCpy $HTTP_PATH "http://grass.osgeo.org/sampledata"
StrCpy $ARCHIVE_NAME "nc_spm_latest.tar.gz"
StrCpy $EXTENDED_ARCHIVE_NAME "North Carolina"
StrCpy $ORIGINAL_UNTAR_FOLDER "nc_spm_08"
@@ -565,19 +577,18 @@ Section "Uninstall"
GetFullPathName /SHORT $0 $INSTDIR
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_ROOT", "$0").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_STARTMENU", "$SMPROGRAMS\${QGIS_BASE}").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_MENU_LINKS", "1").r0'
System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("OSGEO4W_DESKTOP_LINKS", "1").r0'

ReadEnvStr $0 COMSPEC
nsExec::ExecToLog '"$0" /c "$INSTALL_DIR\preremove.bat"'

Delete "$INSTDIR\Uninstall-QGIS.exe"
Delete "$INSTDIR\postinstall.bat.done"
Delete "$INSTDIR\postinstall.bat"
Delete "$INSTDIR\postinstall.log"

Delete "$INSTDIR\preremove.bat.done"
Delete "$INSTDIR\preremove.bat"
Delete "$INSTDIR\preremove.log"
Delete "$INSTDIR\*.bat.done"
Delete "$INSTDIR\*.log"
Delete "$INSTDIR\*.txt"
Delete "$INSTDIR\*.ico"
Delete "$INSTDIR\*.bat"

RMDir /r "$INSTDIR\bin"
RMDir /r "$INSTDIR\apps"
@@ -632,7 +643,10 @@ Section "Uninstall"

;remove the Desktop ShortCut
SetShellVarContext all
Delete "$DESKTOP\Quantum GIS Desktop (${VERSION_NUMBER}).lnk"
Delete "$DESKTOP\Quantum GIS Browser (${VERSION_NUMBER}).lnk"
Delete "$DESKTOP\Quantum GIS (${VERSION_NUMBER}).lnk"
Delete "$DESKTOP\OSGeo4W.lnk"

;remove the Programs Start ShortCut
SetShellVarContext all
@@ -25,17 +25,19 @@
my $releasename;
my $shortname;
my $version;
my $revision;
my $binary;
my $ininame = "setup.ini";
my $help;

my $result = GetOptions(
"verbose+" => \$verbose,
"keep" => \$keep,
"releasename=s" => \$releasename,
"version=s" => \$version,
"revision=s" => \$revision,
"binary=i" => \$binary,
"packagename=s" => \$packagename,
"shortname=s" => \$shortname,
"ininame=s" => \$ininame,
"help" => \$help
);

@@ -62,7 +64,7 @@
my %file;
my $package;

system "wget $wgetopt -c $root/setup.ini";
system "wget $wgetopt -O setup.ini -c $root/$ininame";
open F, "setup.ini" || die "setup.ini not found";
while(<F>) {
chop;
@@ -83,7 +85,7 @@ sub getDeps {

return if exists $pkgs{$pkg};

print " Including package $pkg" if $verbose;
print " Including package $pkg\n" if $verbose;
$pkgs{$pkg} = 1;

foreach my $p ( @{ $dep{$pkg} } ) {
@@ -137,7 +139,9 @@ sub getDeps {
unless(-d "unpacked") {
mkdir "unpacked", 0755;

for my $p (<packages/*.tar.bz2>) {
foreach my $p ( keys %pkgs ) {
$p = $file{$p};
$p =~ s#^.*/#packages/#;

print "Unpacking $p...\n" if $verbose;
system "tar $taropt -C unpacked -xjf $p";
@@ -152,7 +156,7 @@ sub getDeps {
system "cd apps/nircmd; unzip ../../../packages/nircmd.zip && mv nircmd.exe ../../bin";

if( -d "../addons" ) {
print " Including addons..." if $verbose;
print " Including addons...\n" if $verbose;
system "tar -C ../addons -cf - . | tar $taropt -xf -";
}

@@ -221,7 +225,6 @@ sub getDeps {

open F, "../../CMakeLists.txt";
while(<F>) {
print;
if(/SET\(CPACK_PACKAGE_VERSION_MAJOR "(\d+)"\)/) {
$major = $1;
} elsif(/SET\(CPACK_PACKAGE_VERSION_MINOR "(\d+)"\)/) {
@@ -236,15 +239,17 @@ sub getDeps {

$version = "$major.$minor.$patch" unless defined $version;

unless( defined $revision ) {
open F, "svnversion|";
$revision = <F>;
$revision =~ s/\D+$//g;
close F;
unless( defined $binary ) {
if( -f "binary-$version" ) {
open P, "binary-$version";
$binary = <P>;
close P;
$binary++;
} else {
$binary = 1;
}
}

$revision = 14615 unless $revision =~ /^\d+$/;

system "unzip packages/Untgz.zip" unless -d "untgz";

chdir "..";
@@ -254,20 +259,25 @@ sub getDeps {

my $cmd = "makensis";
$cmd .= " -V$verbose";
$cmd .= " -DVERSION_NUMBER='$version'";
$cmd .= " -DVERSION_NAME='$releasename'";
$cmd .= " -DSVN_REVISION='$revision'";
$cmd .= " -DVERSION_NUMBER='$version'";
$cmd .= " -DBINARY_REVISION=$binary";
$cmd .= sprintf( " -DVERSION_INT='%d%02d%02d%02d'", $major, $minor, $patch, $binary );
$cmd .= " -DQGIS_BASE='$packagename $releasename'";
$cmd .= " -DINSTALLER_NAME='QGIS-OSGeo4W-$version-$revision-Setup.exe'";
$cmd .= " -DINSTALLER_NAME='QGIS-OSGeo4W-$version-$binary-Setup.exe'";
$cmd .= " -DDISPLAYED_NAME='$packagename \'$releasename\' ($version)'";
$cmd .= " -DBINARY_REVISION=1";
$cmd .= " -DSHORTNAME='$shortname'";
$cmd .= " -DINSTALLER_TYPE=OSGeo4W";
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/unpacked";
$cmd .= " QGIS-Installer.nsi";

system $cmd;

open P, ">osgeo4w/binary-$version";
print P $binary;
close P;


__END__
=head1 NAME
@@ -283,7 +293,8 @@ =head1 SYNOPSIS
-releasename=name name of release (defaults to CMakeLists.txt setting)
-keep don't start with a fresh unpacked directory
-version=m.m.p package version (defaults to CMakeLists.txt setting)
-revision=rNNNNN svn revision of package (determined by svnversion if not given)
-binary=b binary version of package
-ininame=filename name of the setup.ini (defaults to setup.ini)
-packagename=s name of package (defaults to 'Quantum GIS')
-shortname=s shortname used for batch file (defaults to 'qgis')
-help this help
@@ -1,5 +1,5 @@
@echo off
set GRASS_VERSION=6.4.3RC1
set GRASS_VERSION=6.4.3RC2

set BUILDDIR=%CD%\build
REM set BUILDDIR=%TEMP%\qgis_unstable
@@ -86,6 +86,7 @@ if errorlevel 1 goto error

set LIB=%LIB%;%OSGEO4W_ROOT%\lib
set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
set GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION%

cmake -G "Visual Studio 9 2008" ^
-D PEDANTIC=TRUE ^
@@ -94,14 +95,13 @@ cmake -G "Visual Studio 9 2008" ^
-D WITH_GLOBE=TRUE ^
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
-D GEOS_LIBRARY=%O4W_ROOT%/lib/geos_c_i.lib ^
-D GEOS_LIBRARY=%O4W_ROOT%/lib/geos_c.lib ^
-D SQLITE3_LIBRARY=%O4W_ROOT%/lib/sqlite3_i.lib ^
-D SPATIALITE_LIBRARY=%O4W_ROOT%/lib/spatialite_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^
-D PYTHON_INCLUDE_PATH=%O4W_ROOT%/apps/Python27/include ^
-D PYTHON_LIBRARY=%O4W_ROOT%/apps/Python27/libs/python27.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION% ^
-D QT_BINARY_DIR=%O4W_ROOT%/bin ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
-D QT_HEADERS_DIR=%O4W_ROOT%/include/qt4 ^
@@ -1,4 +1,4 @@
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
path %PATH%;%OSGEO4W_ROOT%\apps\@package@\bin
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\@package@
%OSGEO4W_ROOT%\apps\@package@\crssync
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/@package@
"%OSGEO4W_ROOT%"\apps\@package@\crssync
@@ -3,8 +3,9 @@ textreplace -std -t bin\@package@-browser.bat

mkdir "%OSGEO4W_STARTMENU%"
xxmklink "%OSGEO4W_STARTMENU%\Quantum GIS Desktop (@version@).lnk" "%OSGEO4W_ROOT%\bin\@package@.bat" " " \ "Quantum GIS - Desktop GIS (@version@)" 1 "%OSGEO4W_ROOT%\apps\@package@\icons\QGIS.ico"
xxmklink "%ALLUSERSPROFILE%\Desktop\Quantum GIS Desktop (@version@).lnk" "%OSGEO4W_ROOT%\bin\@package@.bat" " " \ "Quantum GIS - Desktop GIS (@version@)" 1 "%OSGEO4W_ROOT%\apps\@package@\icons\QGIS.ico"
xxmklink "%OSGEO4W_STARTMENU%\Quantum GIS Browser (@version@).lnk" "%OSGEO4W_ROOT%\bin\@package@-browser.bat" " " \ "Quantum GIS - Desktop GIS (@version@)" 1 "%OSGEO4W_ROOT%\apps\@package@\icons\QGIS.ico"

xxmklink "%ALLUSERSPROFILE%\Desktop\Quantum GIS Desktop (@version@).lnk" "%OSGEO4W_ROOT%\bin\@package@.bat" " " \ "Quantum GIS - Desktop GIS (@version@)" 1 "%OSGEO4W_ROOT%\apps\@package@\icons\QGIS.ico"
xxmklink "%ALLUSERSPROFILE%\Desktop\Quantum GIS Browser (@version@).lnk" "%OSGEO4W_ROOT%\bin\@package@-browser.bat" " " \ "Quantum GIS - Desktop GIS (@version@)" 1 "%OSGEO4W_ROOT%\apps\@package@\icons\QGIS.ico"

set O4W_ROOT=%OSGEO4W_ROOT%

0 comments on commit f440b60

Please sign in to comment.