Skip to content
Permalink
Browse files

creatensis.pl: update to support 32 and 64bit packages

  • Loading branch information
jef-n committed Sep 3, 2013
1 parent 668a44f commit c8d1a0cdd1564bf9cd6b2a2c81ced382efdce233
Showing with 33 additions and 25 deletions.
  1. +33 −25 ms-windows/osgeo4w/creatensis.pl
@@ -28,6 +28,7 @@
my $binary;
my $root = "http://download.osgeo.org/osgeo4w";
my $ininame = "setup.ini";
my $arch = "";
my $help;

my $result = GetOptions(
@@ -40,6 +41,7 @@
"shortname=s" => \$shortname,
"ininame=s" => \$ininame,
"mirror=s" => \$root,
"arch=s" => \$arch,
"help" => \$help
);

@@ -53,9 +55,13 @@
die "download of System.dll failed" if $?;
}

mkdir "packages", 0755 unless -d "packages";
chdir "packages";
my $archpath = $arch eq "" ? "" : "/$arch";
my $archpostfix = $arch eq "" ? "" : "-$arch";
my $unpacked = "unpacked" . ($arch eq "" ? "" : "-$arch");
my $packages = "packages" . ($arch eq "" ? "" : "-$arch");

mkdir $packages, 0755 unless -d $packages;
chdir $packages;

system "wget $wgetopt -c http://nsis.sourceforge.net/mediawiki/images/9/9d/Untgz.zip" unless -f "Untgz.zip";
die "download of Untgz.zip failed" if $?;
@@ -66,7 +72,7 @@
my %sdesc;
my $package;

system "wget $wgetopt -O setup.ini -c $root/$ininame";
system "wget $wgetopt -O setup.ini -c $root$archpath/$ininame";
die "download of setup.ini failed" if $?;
open F, "setup.ini" || die "setup.ini not found";
while(<F>) {
@@ -146,42 +152,42 @@ sub getDeps {
# Add addons
#

if( -d "unpacked" ) {
if( -d $unpacked ) {
unless( $keep ) {
print "Removing unpacked directory\n" if $verbose;
system "rm -rf unpacked";
print "Removing $unpacked directory\n" if $verbose;
system "echo rm -rf $unpacked";
} else {
print "Keeping unpacked directory\n" if $verbose;
print "Keeping $unpacked directory\n" if $verbose;
}
}

my $taropt = "v" x $verbose;

unless(-d "unpacked") {
mkdir "unpacked", 0755;
unless(-d $unpacked ) {
mkdir $unpacked, 0755;

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

print "Unpacking $p...\n" if $verbose;
system "tar $taropt -C unpacked -xjf $p";
system "tar $taropt -C $unpacked -xjf $p";
die "unpacking of $p failed" if $?;
}

chdir "unpacked";
chdir $unpacked;

mkdir "bin", 0755;

unless( -f "bin/nircmd.exe" ) {
unless( -f "../packages/nircmd.zip" ) {
system "cd ../packages; wget $wgetopt -c http://www.nirsoft.net/utils/nircmd.zip";
unless( -f "../$packages/nircmd.zip" ) {
system "cd ../$packages; wget $wgetopt -c http://www.nirsoft.net/utils/nircmd.zip";
die "download of nircmd.zip failed" if $?;
}

mkdir "apps", 0755;
mkdir "apps/nircmd", 0755;
system "cd apps/nircmd; unzip ../../../packages/nircmd.zip && mv nircmd.exe nircmdc.exe ../../bin";
system "cd apps/nircmd; unzip ../../../$packages/nircmd.zip && mv nircmd.exe nircmdc.exe ../../bin";
die "unpacking of nircmd failed" if $?;
}

@@ -210,7 +216,7 @@ sub getDeps {
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>postinstall.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>postinstall.log 2>&1\r\n";

chdir "unpacked";
chdir $unpacked;
for my $p (<etc/postinstall/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
@@ -237,7 +243,7 @@ sub getDeps {
print F "PATH %OSGEO4W_ROOT%\\bin;%PATH%>>preremove.log 2>&1\r\n";
print F "cd %OSGEO4W_ROOT%>>preremove.log 2>&1\r\n";

chdir "unpacked";
chdir $unpacked;
for my $p (<etc/preremove/*.bat>) {
$p =~ s/\//\\/g;
my($dir,$file) = $p =~ /^(.+)\\([^\\]+)$/;
@@ -282,7 +288,7 @@ sub getDeps {
}

unless(-d "untgz") {
system "unzip packages/Untgz.zip";
system "unzip $packages/Untgz.zip";
die "unpacking Untgz.zip failed" if $?;
}

@@ -292,7 +298,7 @@ sub getDeps {
print "Creating license file\n" if $verbose;
open O, ">license.tmp";
my $lic;
for my $l ( ( "osgeo4w/unpacked/apps/$shortname/doc/LICENSE", "../COPYING", "./Installer-Files/LICENSE.txt" ) ) {
for my $l ( ( "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE", "../COPYING", "./Installer-Files/LICENSE.txt" ) ) {
next unless -f $l;
$lic = $l;
last;
@@ -304,6 +310,7 @@ sub getDeps {
if( @lic ) {
print O "License overview:\n";
print O "1. QGIS\n";
$i = 1;
for my $l ( @desc ) {
print O ++$i . ". $l\n";
}
@@ -322,7 +329,7 @@ sub getDeps {
for my $l (@lic) {
print " Including license $l\n" if $verbose;

open I, "osgeo4w/packages/$l" or die "License $l not found.";
open I, "osgeo4w/$packages/$l" or die "License $l not found.";
print O "\n\n----------\n\n" . ++$i . ". License of '" . shift(@desc) . "'\n\n";
while(<I>) {
s/\s*$/\n/;
@@ -334,16 +341,16 @@ sub getDeps {
close O;

my $license = "license.tmp";
if( -f "osgeo4w/unpacked/apps/$shortname/doc/LICENSE" ) {
open O, ">osgeo4w/unpacked/apps/$shortname/doc/LICENSE";
if( -f "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE" ) {
open O, ">osgeo4w/$unpacked/apps/$shortname/doc/LICENSE";
open I, $license;
while(<I>) {
print O;
}
close O;
close I;

$license = "osgeo4w/unpacked/apps/$shortname/doc/LICENSE";
$license = "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE";
}


@@ -356,11 +363,11 @@ sub getDeps {
$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-$binary-Setup.exe'";
$cmd .= " -DINSTALLER_NAME='QGIS-OSGeo4W-$version-$binary-Setup$archpostfix.exe'";
$cmd .= " -DDISPLAYED_NAME='$packagename \'$releasename\' ($version)'";
$cmd .= " -DSHORTNAME='$shortname'";
$cmd .= " -DINSTALLER_TYPE=OSGeo4W";
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/unpacked";
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/$unpacked";
$cmd .= " -DLICENSE_FILE='$license'";
$cmd .= " QGIS-Installer.nsi";

@@ -392,6 +399,7 @@ =head1 SYNOPSIS
-packagename=s name of package (defaults to 'QGIS')
-shortname=s shortname used for batch file (defaults to 'qgis')
-mirror=s default mirror (defaults to 'http://download.osgeo.org/osgeo4w')
-arch=s architecture (x86 or x86_64; defaults to '')
-help this help
If no packages are given 'qgis-full' and it's dependencies will be retrieved

0 comments on commit c8d1a0c

Please sign in to comment.
You can’t perform that action at this time.