From a12dcc89780ddec69beec723ac444c5fab388a9a Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 29 May 2007 10:21:43 +0000 Subject: [PATCH] Build Windows installer when making a bindist if ISCC is set It doesn't work yet, but I'm pretty sure that's because the bindist is broken rather than the installer is broken. --- Makefile | 31 +++++++++++++++++++-- distrib/ghc.iss | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ distrib/hsicon.ico | Bin 0 -> 2734 bytes mk/config.mk.in | 4 +++ 4 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 distrib/ghc.iss create mode 100644 distrib/hsicon.ico diff --git a/Makefile b/Makefile index 16a352d..787a48e 100644 --- a/Makefile +++ b/Makefile @@ -291,6 +291,13 @@ binary-dist:: @echo "Generating a shippable configure script.." $(MV) $(BIN_DIST_DIR)/configure-bin.ac $(BIN_DIST_DIR)/configure.ac ( cd $(BIN_DIST_DIR); autoconf ) + +ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" +binary-dist:: + $(MKDIRHIER) $(BIN_DIST_DIR)/icons + cp distrib/hsicon.ico $(BIN_DIST_DIR)/icons +endif + # # binary dist'ing the documentation. # The default documentation to build/install is given below; overrideable @@ -394,6 +401,22 @@ tar-binary-dist: ( cd $(BIN_DIST_TOPDIR); tar cf - $(BIN_DIST_NAME) | bzip2 >$(BIN_DIST_TARBALL) ) ( cd $(BIN_DIST_TOPDIR); bunzip2 -c $(BIN_DIST_TARBALL) | tar tf - | sed "s/^ghc-$(ProjectVersion)/fptools/" | sort >bin-manifest-$(ProjectVersion) ) +PUBLISH_FILES = $(BIN_DIST_TARBALL) + +# Upload the distribution and documentation +ifneq "$(ISCC)" "" +WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TARGETPLATFORM) +WINDOWS_INSTALLER = $(WINDOWS_INSTALLER)$(exeext) + +PUBLISH_FILES += $(WINDOWS_INSTALLER) + +binary-dist :: generate-windows-installer + +.PHONY: generate-windows-installer +generate-windows-installer :: + $(SED) "s/@VERSION@/$(ProjectVersion)/" distrib/ghc.iss | $(ISCC) /O. /F$(WINDOWS_INSTALLER_BASE) - +endif + # Upload the distribution and documentation ifneq "$(PublishLocation)" "" binary-dist :: publish-binary-dist @@ -401,9 +424,11 @@ endif .PHONY: publish-binary-dist publish-binary-dist :: - @for i in 0 1 2 3 4 5 6 7 8 9; do \ - echo "Try $$i: $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation)/dist"; \ - if $(PublishCp) $(BIN_DIST_TARBALL) $(PublishLocation)/dist; then break; fi; \ + @for f in $(PUBLISH_FILES); do \ + @for i in 0 1 2 3 4 5 6 7 8 9; do \ + echo "Try $$i: $(PublishCp) $$f $(PublishLocation)/dist"; \ + if $(PublishCp) $$f $(PublishLocation)/dist; then break; fi; \ + done \ done ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" diff --git a/distrib/ghc.iss b/distrib/ghc.iss new file mode 100644 index 0000000..dcadd73 --- /dev/null +++ b/distrib/ghc.iss @@ -0,0 +1,77 @@ + +[Setup] +AppName=GHC +AppVerName=GHC @VERSION@ +DefaultDirName={sd}\ghc\ghc-@VERSION@ +UsePreviousAppDir=no +DefaultGroupName=GHC +UninstallDisplayIcon={app}\bin\ghci.exe +Compression=lzma +SolidCompression=yes +PrivilegesRequired=none +ChangesAssociations=yes +ChangesEnvironment=yes + + +[Files] +Source: "ghc-@VERSION@\*"; DestDir: "{app}"; Flags: recursesubdirs +Source: "ghc-@VERSION@\README.txt"; DestDir: "{app}"; Flags: isreadme + +[Icons] +Name: "{group}\@VERSION@\GHCi"; Filename: "{app}\bin\ghci.exe" +Name: "{group}\@VERSION@\GHC Documentation"; Filename: "{app}\doc\html\index.html" +Name: "{group}\@VERSION@\GHC Library Documentation"; Filename: "{app}\doc\html\libraries\index.html" +Name: "{group}\@VERSION@\GHC Readme"; Filename: "{app}\README.txt" + +[Registry] +; set up icon associations +; this does _not_ follow the "play nice" proposal +; future version should +Root: HKCR; Subkey: ".hs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue +Root: HKCR; Subkey: ".lhs"; ValueType: string; ValueName: ""; ValueData: "ghc_haskell"; Flags: uninsdeletevalue +Root: HKCR; Subkey: "ghc_haskell"; ValueType: string; ValueName: ""; ValueData: "Haskell Source File"; Flags: uninsdeletekey +Root: HKCR; Subkey: "ghc_haskell\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\icons\hsicon.ico" +Root: HKCR; Subkey: "ghc_haskell\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\bin\ghci.exe"" ""%1""" + +; these flags were always set in the past, by the installer +; some programs may rely on them to find GHC +Root: HKCU; Subkey: "Software\Haskell\GHC\ghc-@VERSION@"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletekey +Root: HKCU; Subkey: "Software\Haskell\GHC"; ValueType: string; ValueName: "InstallDir"; ValueData: "{app}"; Flags: uninsdeletevalue + +; set the PATH variable, for both GHC and Cabal +Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{app}\bin;{olddata}"; Check: NotOnPathAlready('{app}\bin'); Flags: preservestringtype +Root: HKCU; Subkey: "Environment"; ValueName: "Path"; ValueType: "string"; ValueData: "{pf}\Haskell\bin;{olddata}"; Check: NotOnPathAlready('{pf}\Haskell\bin'); Flags: preservestringtype + + +; stolen from Gtk2Hs, I'm sure they like us :-) +; @dcoutts++ +[Code] + +function NotOnPathAlready(NewValue : String): Boolean; +var + Path: String; +begin + // Log('Checking if Gtk2Hs\bin dir is already on the %PATH%'); + if RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Path) then + begin // Successfully read the value + // Log('HKCU\Environment\PATH = ' + Path); + NewValue := ExpandConstant(NewValue); + // Log('Looking for Gtk2Hs\bin dir in %PATH%: ' + BinDir + ' in ' + Path); + if Pos(LowerCase(NewValue), Lowercase(Path)) = 0 then + begin + // Log('Did not find Gtk2Hs\bin dir in %PATH% so will add it'); + Result := True; + end + else + begin + // Log('Found Gtk2Hs bin dir in %PATH% so will not add it again'); + Result := False; + end + end + else // The key probably doesn't exist + begin + // Log('Could not access HKCU\Environment\PATH so assume it is ok to add it'); + Result := True; + end; +end; + diff --git a/distrib/hsicon.ico b/distrib/hsicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..cd0ec6292ffacd2fcb4e21eeb98edcfe0bdb1fea GIT binary patch literal 2734 zcmeHIy^<3#3|6=sk}i3JOG$YZ?NRX<3?=1uNw@BD-M&&D|EBp^BJbFZeN_AvSv6L(@skPhnF&loJb;9EvdPKiiuX!yqoLfAaD0cGD z%Sg?u8vfwh+*kdR7G{slEa8X=D}5v7V{<10qp=jjnb&;gvoDdF&AhVyR>PfYDD;GF=I_U9#l z+5P(f_>y+5AZ=om@s@b$;`u9l7Vdn~nU{)J9CmOv*if6;SzrXT?@#L}HJW`)Og}*n z4Q+V#dj|VmGuAg8j_IJ#eUHNd_rpwU*pf{jr<3k!L$Nh)xI5qts5n74+%p?Iiw^h9 z65Nt*`kt9>+a(SacE_pH&nR8FgEKQ;#73PyGn*MEsmD<=3xAEnK@ESQ4+phr3mlo< z#qDAsN9Pq+UJ+13_(5#x)QeUlQW~$E%4Xo*|^mBA&6_4VB7qqnVGrV?dZKtKR z@_PqoB&}PW9ovK+KKkRt>@OG*K7uXwj`%A^Y%1VqTR=(JLUM6`lf?UHAROG;nS+!FT;X|ARU_McrP4 VkHK*Xu%4UX55c#=_ragQe*jr#xo-df literal 0 HcmV?d00001 diff --git a/mk/config.mk.in b/mk/config.mk.in index ff1b564..ae7b743 100644 --- a/mk/config.mk.in +++ b/mk/config.mk.in @@ -1014,6 +1014,10 @@ UNAME = uname # GTK+ GTK_CONFIG = @GTK_CONFIG@ +# Set this if you want to use Inno Setup to build a Windows installer +# when you make a bindist +ISCC = + #----------------------------------------------------------------------------- # DocBook XML stuff -- 1.7.10.4