Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Uninstall previous installation if one exists.

Add shell scripts to launch gource to PATH rather than the directory.

Require a patched version of EnvVarUpdate.nsh
  • Loading branch information...
commit 96ba6bf6c867c4c91f03830121a6533324102c5f 1 parent 42c3920
@acaudwell authored
Showing with 46 additions and 3 deletions.
  1. +46 −3 dev/bin/build_win32.pl
View
49 dev/bin/build_win32.pl
@@ -39,7 +39,7 @@ sub dosify {
my $nsis_script = q[
!include "MUI2.nsh"
-!include "EnvVarUpdate.nsh"
+!include "SafeEnvVarUpdate.nsh"
Name "Gource GOURCE_VERSION"
@@ -61,6 +61,22 @@ sub dosify {
!insertmacro MUI_LANGUAGE "English"
+Function .onInit
+
+ ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gource" "UninstallString"
+ StrCmp $R0 "" done
+ MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
+ "Gource appears to already be installed. $\n$\nClick OK to remove the previous version and continue the installation." \
+ IDOK uninst
+ Abort
+
+ uninst:
+ ClearErrors
+ ExecWait $R0
+done:
+
+FunctionEnd
+
Section "Gource" SecGource
SectionIn RO
@@ -78,11 +94,11 @@ sub dosify {
SectionEnd
Section "Add to PATH" SecAddtoPath
- ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR"
+ ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\cmd"
SectionEnd
Section "Uninstall"
- ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR"
+ ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\cmd"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Gource"
GOURCE_UNINSTALL_LIST
@@ -93,6 +109,18 @@ sub dosify {
SectionEnd
];
+my $cmd_script = q[
+@echo off
+"%~dp0\..\gource.exe" %*
+];
+$cmd_script =~ s{\n}{\r\n}g;
+
+my $bash_script = q[
+#!/bin/sh
+GOURCE_CMD_DIR=`dirname "$0"`
+"$GOURCE_CMD_DIR/../gource.exe" "$@"
+];
+
my @gource_files = qw(
gource.exe
README
@@ -139,6 +167,7 @@ sub dosify {
data
data/fonts
data/shaders
+ cmd
);
my $tmp_dir = "$builds_dir/gource-build.$$";
@@ -171,6 +200,17 @@ sub dosify {
push @gource_bundle, "$file.txt";
}
+# shell scripts for running gource
+foreach my $shell_script (["cmd/gource.cmd", $cmd_script], ["cmd/gource", $bash_script]) {
+ my($script_file, $script) = @$shell_script;
+
+ open my $script_handle, ">$tmp_dir/$script_file" or die("failed to open $script_file: $!");
+ print $script_handle $script;
+ close $script_handle;
+
+ push @gource_bundle, $script_file;
+}
+
my $version = gource_version();
my $installer_name = "gource-${version}-setup.exe";
@@ -218,6 +258,9 @@ sub dosify {
# generate installer
+# assert we have the long string build of NSIS
+doit("makensis -HDRINFO | grep -q NSIS_MAX_STRLEN=8192");
+
doit("makensis $output_file");
doit("rm $output_file");
Please sign in to comment.
Something went wrong with that request. Please try again.