Skip to content

Commit c8d1a0c

Browse files
committed
creatensis.pl: update to support 32 and 64bit packages
1 parent 668a44f commit c8d1a0c

File tree

1 file changed

+33
-25
lines changed

1 file changed

+33
-25
lines changed

ms-windows/osgeo4w/creatensis.pl

+33-25
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
my $binary;
2929
my $root = "http://download.osgeo.org/osgeo4w";
3030
my $ininame = "setup.ini";
31+
my $arch = "";
3132
my $help;
3233

3334
my $result = GetOptions(
@@ -40,6 +41,7 @@
4041
"shortname=s" => \$shortname,
4142
"ininame=s" => \$ininame,
4243
"mirror=s" => \$root,
44+
"arch=s" => \$arch,
4345
"help" => \$help
4446
);
4547

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

56-
mkdir "packages", 0755 unless -d "packages";
57-
chdir "packages";
58+
my $archpath = $arch eq "" ? "" : "/$arch";
59+
my $archpostfix = $arch eq "" ? "" : "-$arch";
60+
my $unpacked = "unpacked" . ($arch eq "" ? "" : "-$arch");
61+
my $packages = "packages" . ($arch eq "" ? "" : "-$arch");
5862

63+
mkdir $packages, 0755 unless -d $packages;
64+
chdir $packages;
5965

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

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

149-
if( -d "unpacked" ) {
155+
if( -d $unpacked ) {
150156
unless( $keep ) {
151-
print "Removing unpacked directory\n" if $verbose;
152-
system "rm -rf unpacked";
157+
print "Removing $unpacked directory\n" if $verbose;
158+
system "echo rm -rf $unpacked";
153159
} else {
154-
print "Keeping unpacked directory\n" if $verbose;
160+
print "Keeping $unpacked directory\n" if $verbose;
155161
}
156162
}
157163

158164
my $taropt = "v" x $verbose;
159165

160-
unless(-d "unpacked") {
161-
mkdir "unpacked", 0755;
166+
unless(-d $unpacked ) {
167+
mkdir $unpacked, 0755;
162168

163169
foreach my $p ( keys %pkgs ) {
164170
$p = $file{$p};
165-
$p =~ s#^.*/#packages/#;
171+
$p =~ s#^.*/#$packages/#;
166172

167173
print "Unpacking $p...\n" if $verbose;
168-
system "tar $taropt -C unpacked -xjf $p";
174+
system "tar $taropt -C $unpacked -xjf $p";
169175
die "unpacking of $p failed" if $?;
170176
}
171177

172-
chdir "unpacked";
178+
chdir $unpacked;
173179

174180
mkdir "bin", 0755;
175181

176182
unless( -f "bin/nircmd.exe" ) {
177-
unless( -f "../packages/nircmd.zip" ) {
178-
system "cd ../packages; wget $wgetopt -c http://www.nirsoft.net/utils/nircmd.zip";
183+
unless( -f "../$packages/nircmd.zip" ) {
184+
system "cd ../$packages; wget $wgetopt -c http://www.nirsoft.net/utils/nircmd.zip";
179185
die "download of nircmd.zip failed" if $?;
180186
}
181187

182188
mkdir "apps", 0755;
183189
mkdir "apps/nircmd", 0755;
184-
system "cd apps/nircmd; unzip ../../../packages/nircmd.zip && mv nircmd.exe nircmdc.exe ../../bin";
190+
system "cd apps/nircmd; unzip ../../../$packages/nircmd.zip && mv nircmd.exe nircmdc.exe ../../bin";
185191
die "unpacking of nircmd failed" if $?;
186192
}
187193

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

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

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

284290
unless(-d "untgz") {
285-
system "unzip packages/Untgz.zip";
291+
system "unzip $packages/Untgz.zip";
286292
die "unpacking Untgz.zip failed" if $?;
287293
}
288294

@@ -292,7 +298,7 @@ sub getDeps {
292298
print "Creating license file\n" if $verbose;
293299
open O, ">license.tmp";
294300
my $lic;
295-
for my $l ( ( "osgeo4w/unpacked/apps/$shortname/doc/LICENSE", "../COPYING", "./Installer-Files/LICENSE.txt" ) ) {
301+
for my $l ( ( "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE", "../COPYING", "./Installer-Files/LICENSE.txt" ) ) {
296302
next unless -f $l;
297303
$lic = $l;
298304
last;
@@ -304,6 +310,7 @@ sub getDeps {
304310
if( @lic ) {
305311
print O "License overview:\n";
306312
print O "1. QGIS\n";
313+
$i = 1;
307314
for my $l ( @desc ) {
308315
print O ++$i . ". $l\n";
309316
}
@@ -322,7 +329,7 @@ sub getDeps {
322329
for my $l (@lic) {
323330
print " Including license $l\n" if $verbose;
324331

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

336343
my $license = "license.tmp";
337-
if( -f "osgeo4w/unpacked/apps/$shortname/doc/LICENSE" ) {
338-
open O, ">osgeo4w/unpacked/apps/$shortname/doc/LICENSE";
344+
if( -f "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE" ) {
345+
open O, ">osgeo4w/$unpacked/apps/$shortname/doc/LICENSE";
339346
open I, $license;
340347
while(<I>) {
341348
print O;
342349
}
343350
close O;
344351
close I;
345352

346-
$license = "osgeo4w/unpacked/apps/$shortname/doc/LICENSE";
353+
$license = "osgeo4w/$unpacked/apps/$shortname/doc/LICENSE";
347354
}
348355

349356

@@ -356,11 +363,11 @@ sub getDeps {
356363
$cmd .= " -DBINARY_REVISION=$binary";
357364
$cmd .= sprintf( " -DVERSION_INT='%d%02d%02d%02d'", $major, $minor, $patch, $binary );
358365
$cmd .= " -DQGIS_BASE='$packagename $releasename'";
359-
$cmd .= " -DINSTALLER_NAME='QGIS-OSGeo4W-$version-$binary-Setup.exe'";
366+
$cmd .= " -DINSTALLER_NAME='QGIS-OSGeo4W-$version-$binary-Setup$archpostfix.exe'";
360367
$cmd .= " -DDISPLAYED_NAME='$packagename \'$releasename\' ($version)'";
361368
$cmd .= " -DSHORTNAME='$shortname'";
362369
$cmd .= " -DINSTALLER_TYPE=OSGeo4W";
363-
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/unpacked";
370+
$cmd .= " -DPACKAGE_FOLDER=osgeo4w/$unpacked";
364371
$cmd .= " -DLICENSE_FILE='$license'";
365372
$cmd .= " QGIS-Installer.nsi";
366373

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

0 commit comments

Comments
 (0)