From: John Darrington Date: Sun, 18 Apr 2021 11:08:41 +0000 (+0200) Subject: Added rules to build nsis installers for w32 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=f22edc385038b2d29f72af8f9fa882574493f72c Added rules to build nsis installers for w32 * Windows/AdvUninstLog.nsh: New file. * Windows/MUI_EXTRAPAGES.nsh: New file. * Windows/automake.mk: New file. * Windows/pspp.nsi: New file. * Makefile.am: include Windows/automake.mk. * configure.ac: Add conditional for sizeof ptr. --- diff --git a/Makefile.am b/Makefile.am index 9254dd8b68..5967656765 100644 --- a/Makefile.am +++ b/Makefile.am @@ -88,6 +88,7 @@ include $(top_srcdir)/src/automake.mk include $(top_srcdir)/utilities/automake.mk include $(top_srcdir)/tests/automake.mk include $(top_srcdir)/doc/automake.mk +include $(top_srcdir)/Windows/automake.mk if WITH_PERL_MODULE include $(top_srcdir)/perl-module/automake.mk diff --git a/Windows/AdvUninstLog.nsh b/Windows/AdvUninstLog.nsh new file mode 100644 index 0000000000..84024e7d8f --- /dev/null +++ b/Windows/AdvUninstLog.nsh @@ -0,0 +1,434 @@ +# Advanced Uninstall Log NSIS header +# Version 1.0 2007-01-31 +# By Red Wine (http://nsis.sf.net/User:Red_Wine) + +# Usage: See included examples Uninstall_Log_Default_UI.nsi - Uninstall_Log_Modern_UI.nsi + +!verbose push + !verbose 3 + +!ifndef ADVANCED_UNINSTALL.LOG_NSH + !define ADVANCED_UNINSTALL.LOG_NSH + +!ifndef INSTDIR_REG_ROOT | INSTDIR_REG_KEY + !error "You must properly define both INSTDIR_REG_ROOT and INSTDIR_REG_KEY" +!endif + +!ifndef UNINSTALL_LOG + !define UNINSTALL_LOG "Uninstall" +!endif + +!ifndef UNINST_LOG_VERBOSE + !define UNINST_LOG_VERBOSE "3" +!endif + +!verbose pop + +!echo "Advanced Uninstall Log NSIS header v1.0 2007-01-31 by Red Wine (http://nsis.sf.net/User:Red_Wine)" + +!verbose push + !verbose ${UNINST_LOG_VERBOSE} + +!define UNINST_EXE "$INSTDIR\${UNINSTALL_LOG}.exe" +!define UNINST_DAT "$INSTDIR\${UNINSTALL_LOG}.dat" +!define UNLOG_PART "$PLUGINSDIR\part." +!define UNLOG_TEMP "$PLUGINSDIR\unlog.tmp" +!define EXCLU_LIST "$PLUGINSDIR\exclude.tmp" +!define UNLOG_HEAD "=========== Uninstaller Log please do not edit this file ===========" + + var unlog_tmp_0 + var unlog_tmp_1 + var unlog_tmp_2 + var unlog_tmp_3 + var unlog_error + +!include FileFunc.nsh +!include TextFunc.nsh + +!insertmacro Locate +!insertmacro un.Locate +!insertmacro DirState +!insertmacro un.DirState +!insertmacro FileJoin +!insertmacro TrimNewLines +!insertmacro un.TrimNewLines + +;.............................. Uninstaller Macros .............................. + +!macro UNINSTALL.LOG_BEGIN_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + IfFileExists "${UNINST_DAT}" +3 + MessageBox MB_ICONSTOP|MB_OK "${UNINST_DAT} not found, unable to perform uninstall." /SD IDOK + Quit + + StrCmp "$PLUGINSDIR" "" 0 +2 + InitPluginsDir + + CopyFiles "${UNINST_DAT}" "${UNLOG_TEMP}" + FileOpen $unlog_tmp_2 "${UNLOG_TEMP}" r + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_END_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + FileClose $unlog_tmp_2 + DeleteRegValue ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}.dat" + DeleteRegValue ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL TargetDir + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifndef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef INTERACTIVE_UNINSTALL + GetTempFileName $unlog_tmp_5 "$PLUGINSDIR" + FileOpen $unlog_tmp_4 "$unlog_tmp_5" a + !endif + + ${PerfomUninstall} "${TargetDir}" "${UnLog_Uninstall_CallBackFunc}" + + !ifdef INTERACTIVE_UNINSTALL + FileClose $unlog_tmp_4 + !endif + + !verbose pop +!macroend + + +!define PerfomUninstall "!insertmacro PERFORMUNINSTALL" + +!macro PERFORMUNINSTALL TargetDir UninstCallBackFunc + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !define ID ${__LINE__} + + ${un.Locate} "${TargetDir}" "/L=F" "${UninstCallBackFunc}" + + loop_${ID}: + + StrCpy $unlog_tmp_1 0 + + ${un.Locate} "${TargetDir}" "/L=DE" "${UninstCallBackFunc}" + StrCmp $unlog_tmp_1 "0" 0 loop_${ID} + + ${un.DirState} "${TargetDir}" $unlog_tmp_0 + StrCmp "$unlog_tmp_0" "0" 0 +2 + RmDir "${TargetDir}" + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "${UNINSTALL_LOG} Log error" /SD IDOK + + !undef ID + + !verbose pop +!macroend + + +!macro INTERACTIVE_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifdef INTERACTIVE_UNINSTALL + !error "INTERACTIVE_UNINSTALL is already defined" + !endif + + var unlog_tmp_4 + var unlog_tmp_5 + + !define INTERACTIVE_UNINSTALL + + !ifdef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef UnLog_Uninstall_CallBackFunc + !undef UnLog_Uninstall_CallBackFunc + !endif + + !ifndef UnLog_Uninstall_CallBackFunc + !insertmacro UNINSTALL.LOG_UNINSTALL_INTERACTIVE + !define UnLog_Uninstall_CallBackFunc "un._LocateCallBack_Function_Interactive" + !endif + + !verbose pop +!macroend + + +!macro UNATTENDED_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifdef UNATTENDED_UNINSTALL + !error "UNATTENDED_UNINSTALL is already defined" + !endif + + !define UNATTENDED_UNINSTALL + + !ifdef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef UnLog_Uninstall_CallBackFunc + !undef UnLog_Uninstall_CallBackFunc + !endif + + !ifndef UnLog_Uninstall_CallBackFunc + !insertmacro UNINSTALL.LOG_UNINSTALL_UNATTENDED + !define UnLog_Uninstall_CallBackFunc "un._LocateCallBack_Function_Unattended" + !endif + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL_UNATTENDED + + Function un._LocateCallBack_Function_Unattended + start: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" islog + IfErrors nolog + goto start + + islog: + IfFileExists "$R9\*.*" isdir + + isfile: + Delete "$R9" + goto end + + isdir: + RmDir "$R9" + IntOp $unlog_tmp_1 $unlog_tmp_1 + 1 + goto end + + nolog: + ClearErrors + StrCmp "$R9" "${UNINST_EXE}" isfile + StrCmp "$R9" "${UNINST_DAT}" isfile + + end: + FileSeek $unlog_tmp_2 0 SET + Push $unlog_tmp_0 + FunctionEnd + +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL_INTERACTIVE + + Function un._LocateCallBack_Function_Interactive + start: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" islog + IfErrors nolog + goto start + + islog: + IfFileExists "$R9\*.*" isdir + + isfile: + Delete "$R9" + goto end + + isdir: + RmDir "$R9" + IntOp $unlog_tmp_1 $unlog_tmp_1 + 1 + goto end + + nolog: + ClearErrors + FileSeek $unlog_tmp_4 0 SET + read: + FileRead $unlog_tmp_4 "$unlog_tmp_3" + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" end + IfErrors +2 + goto read + ClearErrors + StrCmp "$R9" "${UNINST_EXE}" isfile + StrCmp "$R9" "${UNINST_DAT}" isfile + IfFileExists "$R9\*.*" msgdir + + MessageBox MB_ICONQUESTION|MB_YESNO \ + 'Delete File "$R9"?' /SD IDNO IDYES isfile IDNO nodel + + msgdir: + MessageBox MB_ICONQUESTION|MB_YESNO \ + 'Delete Directory "$R9"?' /SD IDNO IDYES isdir IDNO nodel + + nodel: + FileSeek $unlog_tmp_4 0 END + FileWrite $unlog_tmp_4 "$R9$\r$\n" + + end: + FileSeek $unlog_tmp_2 0 SET + Push $unlog_tmp_0 + FunctionEnd + +!macroend + +;................................. Installer Macros ................................. + +!macro UNINSTALL.LOG_INSTALL_UNATTENDED + + Function _LocateCallBack_Function_Install + loop: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + IfErrors 0 +4 + ClearErrors + FileSeek $unlog_tmp_2 0 SET + goto next + StrCmp "$R9" "$unlog_tmp_3" end + goto loop + next: + FileWrite $unlog_tmp_1 "$R9$\r$\n" + end: + Push $unlog_tmp_0 + FunctionEnd + +!macroend + + +!ifdef UnLog_Install_Func_CallBack + !undef UnLog_Install_Func_CallBack +!endif + +!ifndef UnLog_Install_Func_CallBack + !insertmacro UNINSTALL.LOG_INSTALL_UNATTENDED + !define UnLog_Install_Func_CallBack "_LocateCallBack_Function_Install" +!endif + + +!macro UNINSTALL.LOG_PREPARE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + Push $0 + Push $1 + ClearErrors + ReadRegStr "$0" ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" + IfErrors next + ${DirState} "$0" $1 + StrCmp "$1" "-1" next + StrCmp "$1" "0" next + IfFileExists "$0\${UNINSTALL_LOG}.dat" next + MessageBox MB_ICONEXCLAMATION|MB_OK \ + "Previous installation detected at $0.$\n\ + Required file ${UNINSTALL_LOG}.dat is missing.$\n$\nIt is highly recommended \ + to select an empty directory and perform a fresh installation." /SD IDOK + StrCpy $unlog_error "error" + + next: + ClearErrors + StrCmp "$PLUGINSDIR" "" 0 +2 + InitPluginsDir + + GetTempFileName "$1" + FileOpen $0 "$1" w + FileWrite $0 "${UNLOG_HEAD}$\r$\n" + FileClose $0 + Rename "$1" "${UNLOG_TEMP}" + Pop $1 + Pop $0 + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UPDATE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + Delete "${UNINST_DAT}" + Rename "${UNLOG_TEMP}" "${UNINST_DAT}" + WriteUninstaller "${UNINST_EXE}" + WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}.dat" "${UNINST_DAT}" + WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" "$INSTDIR" + + !verbose pop +!macroend + + +!define uninstall.log_install "!insertmacro UNINSTALL.LOG_INSTALL" + +!macro UNINSTALL.LOG_INSTALL FileOpenWrite FileOpenRead TargetDir + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + FileOpen $unlog_tmp_1 "${FileOpenWrite}" w + FileOpen $unlog_tmp_2 "${FileOpenRead}" r + + ${Locate} "${TargetDir}" "/L=FD" "${UnLog_Install_Func_CallBack}" + + StrCmp $unlog_error "error" 0 +2 + ClearErrors + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "Error creating ${UNINSTALL_LOG} Log." /SD IDOK + + FileClose $unlog_tmp_1 + FileClose $unlog_tmp_2 + + !verbose pop +!macroend + + +!define uninstall.log_mergeID "!insertmacro UNINSTALL.LOG_MERGE" + +!macro UNINSTALL.LOG_MERGE UnlogPart + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + ${FileJoin} "${UNLOG_TEMP}" "${UnlogPart}" "${UNLOG_TEMP}" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_OPEN_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + StrCmp $unlog_error "error" +2 + ${uninstall.log_install} "${EXCLU_LIST}" "${UNINST_DAT}" "$OUTDIR" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_CLOSE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !define ID ${__LINE__} + + ${uninstall.log_install} "${UNLOG_PART}${ID}" "${EXCLU_LIST}" "$OUTDIR" + ${uninstall.log_mergeID} "${UNLOG_PART}${ID}" + + !undef ID + + !verbose pop +!macroend + +!endif + +!verbose pop + ;_____________________________ HEADER FILE END ____________________________ diff --git a/Windows/MUI_EXTRAPAGES.nsh b/Windows/MUI_EXTRAPAGES.nsh new file mode 100644 index 0000000000..4da2acd44c --- /dev/null +++ b/Windows/MUI_EXTRAPAGES.nsh @@ -0,0 +1,60 @@ +# MUI_EXTRAPAGES.nsh +# By Red Wine Jan 2007 + +!verbose push +!verbose 3 + +!ifndef _MUI_EXTRAPAGES_NSH +!define _MUI_EXTRAPAGES_NSH + +!ifmacrondef MUI_EXTRAPAGE_README & MUI_PAGE_README & MUI_UNPAGE_README & ReadmeLangStrings + +!macro MUI_EXTRAPAGE_README UN ReadmeFile +!verbose push +!verbose 3 + !define MUI_PAGE_HEADER_TEXT "Read Me" + !define MUI_PAGE_HEADER_SUBTEXT "Please read the following important information!" + !define MUI_LICENSEPAGE_TEXT_TOP "" + !define MUI_LICENSEPAGE_TEXT_BOTTOM "Click on scrollbar arrows or press Page Down to review the entire text." + !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" + !insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" +!verbose pop +!macroend + +!define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README" + + +!macro MUI_PAGE_README ReadmeFile +!verbose push +!verbose 3 + ${ReadmeRun} "" "${ReadmeFile}" +!verbose pop +!macroend + + +!macro MUI_UNPAGE_README ReadmeFile +!verbose push +!verbose 3 + ${ReadmeRun} "UN" "${ReadmeFile}" +!verbose pop +!macroend + + +!macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom +!verbose push +!verbose 3 + LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" + LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" + LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" + LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" +!verbose pop +!macroend + +!define ReadmeLanguage `!insertmacro ReadmeLangStrings ""` + +!define Un.ReadmeLanguage `!insertmacro ReadmeLangStrings "UN"` + +!endif +!endif + +!verbose pop diff --git a/Windows/automake.mk b/Windows/automake.mk new file mode 100644 index 0000000000..918c0b179f --- /dev/null +++ b/Windows/automake.mk @@ -0,0 +1,85 @@ +# Copyright (C) 2021 John Darrington +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +EXTRA_DIST+=Windows/build-dependencies \ +Windows/AdvUninstLog.nsh \ +Windows/MUI_EXTRAPAGES.nsh \ +Windows/README \ +Windows/pspp.nsi + +nsis_installer_deps=$(DESTDIR)$(prefix)/share/doc/pspp/pspp.html \ + $(DESTDIR)$(prefix)/share/doc/pspp/pspp.pdf \ + Windows/AdvUninstLog.nsh Windows/MUI_EXTRAPAGES.nsh + +environment_dir=${shell echo $(LDFLAGS) | sed -e 's/^-L//' -e 's|/lib$$||'} +libgcc_dir=${dir ${shell $(CC) -print-libgcc-file-name}} + +# Note that install is a PHONY target. Therefore this rule is always executed. +Windows/nsis-bin: install + @$(RM) -r $@ + @$(MKDIR_P) $@ + cp $(DESTDIR)$(prefix)/bin/* $@ + cp `$(CC) -print-file-name=libwinpthread-1.dll` $@ + cp $(environment_dir)/bin/*.dll $@ + cp $(environment_dir)/bin/*.exe $@ + cp $(libgcc_dir)/*.dll $@ + + +# Create a hash from everything in Windows/nsis-bin, but don't +# update it unless it has changed +Windows/nsis-bin-hashes: Windows/nsis-bin + md5sum Windows/nsis-bin/* > $@,tmp + @diff -q $@,tmp $@ || mv $@,tmp $@ + +# Copy Windows/nsis-bin/* into Windows/nsis-bin-stripped and then strip everything +Windows/nsis-bin-stripped: Windows/nsis-bin-hashes + @$(MKDIR_P) $@ + cp Windows/nsis-bin/* $@ + $(STRIP) $@/* + +# Create a hash from everything in Windows/nsis-bin-stripped, but don't +# update it unless it has changed +Windows/nsis-bin-stripped-hashes: Windows/nsis-bin-stripped + md5sum Windows/nsis-bin-stripped/* > $@,tmp + @diff -q $@,tmp $@ || mv $@,tmp $@ + + +Windows/pspp-$(binary_width)bit-debug-install.exe: Windows/pspp.nsi Windows/nsis-bin-hashes $(nsis_installer_deps) + @$(top_builddir)/config.status --config | grep -e --enable-relocatable > /dev/null || \ + (echo "PSPP must be configured with --enable-relocatable"; false) + @$(MKDIR_P) ${@D} + makensis -Dpspp_version=$(PACKAGE_VERSION) \ + -DDEBUG=1 \ + -DPtrSize=$(binary_width) \ + -DPrefix=$(DESTDIR)$(prefix) \ + -DBinDir=$(abs_top_builddir)/Windows/nsis-bin \ + -DEnvDir=$(environment_dir) \ + -DSourceDir=$(abs_top_srcdir) \ + -DOutExe=$(abs_builddir)/$@ $< + +Windows/pspp-$(binary_width)bit-install.exe: Windows/pspp.nsi Windows/nsis-bin-stripped-hashes $(nsis_installer_deps) + @$(top_builddir)/config.status --config | grep -e --enable-relocatable > /dev/null || \ + (echo "PSPP must be configured with --enable-relocatable"; false) + @$(MKDIR_P) ${@D} + makensis -Dpspp_version=$(PACKAGE_VERSION) \ + -DDEBUG=0 \ + -DPtrSize=$(binary_width) \ + -DPrefix=$(DESTDIR)$(prefix) \ + -DBinDir=$(abs_top_builddir)/Windows/nsis-bin-stripped \ + -DEnvDir=$(environment_dir) \ + -DSourceDir=$(abs_top_srcdir) \ + -DOutExe=$(abs_builddir)/$@ $< + +Windows/installers: Windows/pspp-$(binary_width)bit-install.exe Windows/pspp-$(binary_width)bit-debug-install.exe diff --git a/Windows/pspp.nsi b/Windows/pspp.nsi new file mode 100644 index 0000000000..a7624be4a1 --- /dev/null +++ b/Windows/pspp.nsi @@ -0,0 +1,443 @@ +# pspp.nsi - a NSIS script for generating a PSPP MSWindows installer. +# Copyright (C) 2012-2013 Harry Thijssen +# Copyright (C) 2021 John Darrington +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +SetCompressor lzma + +;; Turning compression off saves a huge amount of time when working on the +;; installer. Keeping it on makes the installer much smaller. +;SetCompress off + +!searchparse /${pspp_version} "." vers_min "." + +;Include Modern UI +!include "MUI2.nsh" + + !define MUI_ICON "${Prefix}/share/pspp/icons/pspp.ico" + !define MUI_UNICON "${Prefix}/share/pspp/icons/pspp.ico" + !if ${PtrSize} == 64 + !define ProgramFiles $Programfiles64 + !else if ${PtrSize} == 32 + !define ProgramFiles $Programfiles32 + !else + !error "Unknown architecture" + !endif + !define MUI_EXTRAPAGES MUI_EXTRAPAGES.nsh + !define AdvUninstLog AdvUninstLog.nsh + + +;-------------------------------- +!define APP_NAME "PSPP" +!define INSTDIR_REG_ROOT "HKLM" +!define INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}" + +!include "${MUI_EXTRAPAGES}" +!include "${AdvUninstLog}" + +;------------------------------- Settings -----------------------------------------------; + + !define SavExt ".sav" + !define ZSavExt ".zsav" + !define PorExt ".por" + !define SpsExt ".sps" + ;Name and file + Name "${APP_NAME}" ; The name of the installer + OutFile "${OutExe}" ; The file to write + + ;Request application privileges for Windows 7 + RequestExecutionLevel highest + +;-------------------------------- + +;Interface Settings + + !define MUI_ABORTWARNING + +;-------------------------------- +;Pages + +;Add the install read me page + !insertmacro MUI_PAGE_README "${SourceDir}/COPYING" + + !insertmacro MUI_PAGE_DIRECTORY + !insertmacro MUI_PAGE_INSTFILES + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + + !insertmacro UNATTENDED_UNINSTALL + +;-------------------------------- +;Languages + + !insertmacro MUI_LANGUAGE "English" ;first language is the default language + !insertmacro MUI_LANGUAGE "French" + !insertmacro MUI_LANGUAGE "German" + !insertmacro MUI_LANGUAGE "Spanish" +; !insertmacro MUI_LANGUAGE "SpanishInternational" + !insertmacro MUI_LANGUAGE "SimpChinese" +; !insertmacro MUI_LANGUAGE "TradChinese" + !insertmacro MUI_LANGUAGE "Japanese" +; !insertmacro MUI_LANGUAGE "Korean" +; !insertmacro MUI_LANGUAGE "Italian" + !insertmacro MUI_LANGUAGE "Dutch" +; !insertmacro MUI_LANGUAGE "Danish" +; !insertmacro MUI_LANGUAGE "Swedish" +; !insertmacro MUI_LANGUAGE "Norwegian" +; !insertmacro MUI_LANGUAGE "NorwegianNynorsk" +; !insertmacro MUI_LANGUAGE "Finnish" + !insertmacro MUI_LANGUAGE "Greek" + !insertmacro MUI_LANGUAGE "Russian" +; !insertmacro MUI_LANGUAGE "Portuguese" + !insertmacro MUI_LANGUAGE "PortugueseBR" + !insertmacro MUI_LANGUAGE "Polish" + !insertmacro MUI_LANGUAGE "Ukrainian" + !insertmacro MUI_LANGUAGE "Czech" +; !insertmacro MUI_LANGUAGE "Slovak" +; !insertmacro MUI_LANGUAGE "Croatian" +; !insertmacro MUI_LANGUAGE "Bulgarian" + !insertmacro MUI_LANGUAGE "Hungarian" +; !insertmacro MUI_LANGUAGE "Thai" +; !insertmacro MUI_LANGUAGE "Romanian" +; !insertmacro MUI_LANGUAGE "Latvian" +; !insertmacro MUI_LANGUAGE "Macedonian" +; !insertmacro MUI_LANGUAGE "Estonian" + !insertmacro MUI_LANGUAGE "Turkish" + !insertmacro MUI_LANGUAGE "Lithuanian" + !insertmacro MUI_LANGUAGE "Slovenian" +; !insertmacro MUI_LANGUAGE "Serbian" +; !insertmacro MUI_LANGUAGE "SerbianLatin" +; !insertmacro MUI_LANGUAGE "Arabic" +; !insertmacro MUI_LANGUAGE "Farsi" +; !insertmacro MUI_LANGUAGE "Hebrew" +; !insertmacro MUI_LANGUAGE "Indonesian" +; !insertmacro MUI_LANGUAGE "Mongolian" +; !insertmacro MUI_LANGUAGE "Luxembourgish" +; !insertmacro MUI_LANGUAGE "Albanian" +; !insertmacro MUI_LANGUAGE "Breton" +; !insertmacro MUI_LANGUAGE "Belarusian" +; !insertmacro MUI_LANGUAGE "Icelandic" +; !insertmacro MUI_LANGUAGE "Malay" +; !insertmacro MUI_LANGUAGE "Bosnian" +; !insertmacro MUI_LANGUAGE "Kurdish" +; !insertmacro MUI_LANGUAGE "Irish" +; !insertmacro MUI_LANGUAGE "Uzbek" + !insertmacro MUI_LANGUAGE "Galician" +; !insertmacro MUI_LANGUAGE "Afrikaans" + !insertmacro MUI_LANGUAGE "Catalan" +; !insertmacro MUI_LANGUAGE "Esperanto" +; !insertmacro MUI_LANGUAGE "Asturian" + +;-------------------------------- + +;Installer Sections + +!macro FilePresent name +!if /FileExists ${name} + nop +!else + !error "Missing item: ${name}" +!endif +!macroend + +Section "PSPP" SecDummy + + ;; If these are missing, then someone probably forgot to run "make install-html" + ;; and/or "make install-pdf" + !insertmacro FilePresent "${Prefix}/share/doc/pspp/pspp.html" + !insertmacro FilePresent "${Prefix}/share/doc/pspp/pspp.pdf" + + SetOutPath "$INSTDIR" + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + + SetOutPath "$INSTDIR\etc" + File /r "${EnvDir}/etc/*" + + SetOutPath "$INSTDIR\bin" + File ${BinDir}/*.dll + File ${BinDir}/gdbus.exe + File ${BinDir}/glib-compile-schemas.exe + File ${BinDir}/pspp.exe + File ${BinDir}/psppire.exe + File ${BinDir}/pspp-*.exe + File ${BinDir}/gtk-update-icon-cache.exe + + SetOutPath "$INSTDIR\share" + File /r "${Prefix}/share/*" + + SetOutPath "$INSTDIR\share\icons\hicolor" + File /r "${EnvDir}/share/icons/hicolor/*" + + SetOutPath "$INSTDIR\share\icons\Adwaita" + File /r /x cursors /x legacy "${EnvDir}/share/icons/Adwaita/*" ;; legacy and cursors are HUGE! + + SetOutPath "$INSTDIR\share\glib-2.0\schemas" + File /r "${EnvDir}/share/glib-2.0/schemas/*" + ExecWait '"$INSTDIR\bin\glib-compile-schemas.exe" "$INSTDIR\share\glib-2.0\schemas"' $0 + + SetOutPath "$INSTDIR\share\locale" + File /r /x "gtk30-properties.mo" "${EnvDir}/share/locale/*" + + File "/oname=$INSTDIR\share\README.txt" "${SourceDir}/README" + File "/oname=$INSTDIR\share\COPYING.txt" "${SourceDir}/COPYING" + File "/oname=$INSTDIR\share\NEWS.txt" "${SourceDir}/NEWS" + File "/oname=$INSTDIR\share\THANKS.txt" "${SourceDir}/THANKS" + File "/oname=$INSTDIR\share\AUTHORS.txt" "${SourceDir}/AUTHORS" + + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + + # call userInfo plugin to get user info. The plugin puts the result in the stack + userInfo::getAccountType + pop $0 + strCmp $0 "Admin" Admin + # not admin + WriteRegStr HKCU "Software\Classes\${SavExt}" "" "PSPP System File" + WriteRegStr HKCU "Software\Classes\${SavExt}" "Content Type" "application/x-spss-sav" + WriteRegStr HKCU "Software\Classes\PSPP System File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-sav.ico" + WriteRegStr HKCU "Software\Classes\PSPP System File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCU "Software\Classes\${ZSavExt}" "" "PSPP System File Compressed" +# WriteRegStr HKCU "Software\Classes\${ZSavExt}" "Content Type" "application/x-spss-sav" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\application/x-spss-sav" "Extension" ".sav" + WriteRegStr HKCU "Software\Classes\PSPP System File Compressed\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-zsav.ico" + WriteRegStr HKCU "Software\Classes\PSPP System File Compressed\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCU "Software\Classes\${PorExt}" "" "PSPP Portable File" + WriteRegStr HKCU "Software\Classes\${PorExt}" "Content Type" "application/x-spss-por" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\application/x-spss-por" "Extension" ".por" + WriteRegStr HKCU "Software\Classes\PSPP Portable File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-por.ico,0" + WriteRegStr HKCU "Software\Classes\PSPP Portable File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCU "Software\Classes\${SpsExt}" "" "PSPP Syntax File" + WriteRegStr HKCU "Software\Classes\${SpsExt}" "Content Type" "application/x-spss-sps" + WriteRegStr HKCU "Software\Classes\PSPP Syntax File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-sps.ico,0" + WriteRegStr HKCU "Software\Classes\PSPP Syntax File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + # registering additional mime types + WriteRegStr HKCU "Software\Classes\.txt" "Content Type" "text/plain" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\text/plain" "Extension" ".txt" + WriteRegStr HKCU "Software\Classes\.text" "Content Type" "text/plain" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\text/plain" "Extension" ".text" + WriteRegStr HKCU "Software\Classes\.csv" "Content Type" "text/csv" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\text/csv" "Extension" ".csv" + WriteRegStr HKCU "Software\Classes\.tsv" "Content Type" "text/tab-separated-values" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\text/tab-separated-values" "Extension" ".tsv" + WriteRegStr HKCU "Software\Classes\.gnumeric" "Content Type" "application/x-gnumeric" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\text/plain" "Extension" ".gnumeric" + WriteRegStr HKCU "Software\Classes\.ods" "Content Type" "application/vnd.oasis.opendocument.spreadsheet" + WriteRegStr HKCU "Software\Classes\MIME\Database\Content Type\application/vnd.oasis.opendocument.spreadsheet" "Extension" ".ods" + + WriteRegStr HKCU ${INSTDIR_REG_KEY} "DisplayName" "${APP_NAME}" + WriteRegStr HKCU ${INSTDIR_REG_KEY} "UninstallString" '"$INSTDIR\UNINSTALL.exe"' + WriteRegStr HKCU ${INSTDIR_REG_KEY} "Publisher" "Free Software Foundation, Inc." + WriteRegStr HKCU ${INSTDIR_REG_KEY} "DisplayIcon" '"$INSTDIR\bin\psppire.exe"' + WriteRegStr HKCU ${INSTDIR_REG_KEY} "DisplayVersion" "${pspp_version}" + + Goto EndStrCmp + Admin: ;MultiUser Install + SetShellVarContext all + WriteRegStr HKCR "${SavExt}" "" "PSPP System File" + WriteRegStr HKCR "${SavExt}" "Content Type" "application/x-spss-sav" + WriteRegStr HKCR "MIME\Database\Content Type\application/x-spss-sav" "Extension" ".sav" + WriteRegStr HKCR "PSPP System File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-sav.ico,0" + WriteRegStr HKCR "PSPP System File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCR "${ZSavExt}" "" "PSPP System File Compressed" + WriteRegStr HKCR "PSPP System File Compressed\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-zsav.ico,0" + WriteRegStr HKCR "PSPP System File Compressed\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCR "${PorExt}" "" "PSPP Portable File" + WriteRegStr HKCR "${PorExt}" "Content Type" "application/x-spss-por" + WriteRegStr HKCR "MIME\Database\Content Type\application/x-spss-por" "Extension" ".por" + WriteRegStr HKCR "PSPP Portable File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-por.ico,0" + WriteRegStr HKCR "PSPP Portable File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + WriteRegStr HKCR "${SpsExt}" "" "PSPP Syntax File" + WriteRegStr HKCR "${SpsExt}" "Content Type" "application/x-spss-sps" + WriteRegStr HKCR "PSPP Syntax File\DefaultIcon" "" "$INSTDIR\share\pspp\icons\pspp-sps.ico,0" + WriteRegStr HKCR "PSPP Syntax File\Shell\Open\Command" "" '$INSTDIR\bin\psppire.exe "%1"' + + # registering additional mime types + WriteRegStr HKCR ".txt" "Content Type" "text/plain" + WriteRegStr HKCR "MIME\Database\Content Type\text/plain" "Extension" ".txt" + WriteRegStr HKCR ".text" "Content Type" "text/plain" + WriteRegStr HKCR "MIME\Database\Content Type\text/plain" "Extension" ".text" + WriteRegStr HKCR ".csv" "Content Type" "text/csv" + WriteRegStr HKCR "MIME\Database\Content Type\text/csv" "Extension" ".csv" + WriteRegStr HKCR ".tsv" "Content Type" "text/tab-separated-values" + WriteRegStr HKCR "MIME\Database\Content Type\text/tab-separated-values" "Extension" ".tsv" + WriteRegStr HKCR ".gnumeric" "Content Type" "application/x-gnumeric" + WriteRegStr HKCR "MIME\Database\Content Type\text/plain" "Extension" ".gnumeric" + WriteRegStr HKCR ".ods" "Content Type" "application/vnd.oasis.opendocument.spreadsheet" + WriteRegStr HKCR "MIME\Database\Content Type\application/vnd.oasis.opendocument.spreadsheet" "Extension" ".ods" + + WriteRegStr HKLM ${INSTDIR_REG_KEY} "DisplayName" "${APP_NAME}" + WriteRegStr HKLM ${INSTDIR_REG_KEY} "UninstallString" '"$INSTDIR\UNINSTALL.exe"' + WriteRegStr HKLM ${INSTDIR_REG_KEY} "Publisher" "Free Software Foundation, Inc." + WriteRegStr HKLM ${INSTDIR_REG_KEY} "DisplayIcon" '"$INSTDIR\bin\psppire.exe"' + WriteRegStr HKLM ${INSTDIR_REG_KEY} "DisplayVersion" "${pspp_version}" + + EndStrCmp: + + +# flush the icon cache + System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)' + + ; Now create shortcuts + SetOutPath "%HOMEDRIVE%HOMEPATH" + CreateDirectory "$SMPROGRAMS\${APP_NAME}" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\PSPP.lnk" "$INSTDIR\bin\psppire.exe" "" "$INSTDIR\share\pspp\icons\pspp.ico" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\README.lnk" "$INSTDIR\share\README.txt" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\Manual.lnk" "$INSTDIR\share\doc\pspp\pspp.pdf" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\License.lnk" "$INSTDIR\share\COPYING.txt" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\NEWS.lnk" "$INSTDIR\share\NEWS.txt" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\THANKS.lnk" "$INSTDIR\share\THANKS.txt" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\AUTHORS.lnk" "$INSTDIR\share\AUTHORS.txt" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\Examples.lnk" "$INSTDIR\share\pspp\examples" + CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall PSPP.lnk" "$INSTDIR\Uninstall.exe" + CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\bin\psppire.exe" "" "$INSTDIR\share\pspp\icons\pspp.ico" + IfFileExists "$INSTDIR\bin\gdb.exe" file_found file_not_found + file_found: + IfFileExists "c:\windows\command\start.exe" on-wine on-windows + on-wine: + SetOutPath "$INSTDIR" + CreateShortcut "$DESKTOP\DebugPSPP.lnk" "$INSTDIR\bin\gdb" 'bin\psppire.exe' '"$INSTDIR\bin"' + CreateShortcut "$INSTDIR\DebugPSPP.lnk" "$INSTDIR\bin\gdb" 'bin\psppire.exe' '"$INSTDIR\bin"' + SetOutPath "%HOMEDRIVE%HOMEPATH" + goto end_of_test-win + on-windows: + SetOutPath "$INSTDIR" + CreateShortCut "$DESKTOP\PSPPDebug.lnk" "$INSTDIR\bin\DebugPSPP.bat" '"$INSTDIR\bin"' + CreateShortcut "$SMPROGRAMS\PSPP\DebugPSPP.lnk" "$INSTDIR\bin\DebugPSPP.BAT" '"$INSTDIR\bin"' + SetOutPath "%HOMEDRIVE%HOMEPATH" + CreateShortcut "$DESKTOP\GDB Manual.lnk" "http://sourceware.org/gdb/current/onlinedocs/gdb/" + CreateShortcut "$SMPROGRAMS\PSPP\GDB Manual.lnk" "http://sourceware.org/gdb/current/onlinedocs/gdb/" + end_of_test-win: + file_not_found: + CreateShortCut "$DESKTOP\PSPP Manual.lnk" "$INSTDIR\share\doc\pspp\pspp.pdf" + CreateShortcut "$SMPROGRAMS\PSPP\PSPP_Commandline.lnk" "$INSTDIR\bin\pspp.exe" '"$INSTDIR\bin"' + + ;Create uninstaller + SetOutPath "$INSTDIR" + WriteUninstaller "$INSTDIR\Uninstall.exe" + +SectionEnd + +;-------------------------------- +;Installer Functions + +Function .onInit + ;; Test Versions get a default directory of "PSPP-TESTING" + ;; Released Versions have "PSPP" + ;; Debug Versions have "PSPP-DEBUG" + Var /global DefaultInstallDir + ${If} ${DEBUG} == 1 + StrCpy $DefaultInstallDir "${APP_NAME}-DEBUG" + ${Else} + Intop $0 ${vers_min} % 2 + ${If} $0 == 0 + StrCpy $DefaultInstallDir "${APP_NAME}" + ${Else} + StrCpy $DefaultInstallDir "${APP_NAME}-TESTING" + ${Endif} + ${Endif} + + MessageBox MB_OKCANCEL "This windoze installer is work in progress. It is known to have deficiencies and is recommended for testing and evaluation purposes only." IDOK continue + Abort ; Allow the use to decide not to continue + continue: + +; initial actions + + # call userInfo plugin to get user info. The plugin puts the result in the stack + userInfo::getAccountType + pop $0 + strCmp $0 "Admin" Admin + # not admin + StrCpy $INSTDIR "$PROFILE\$DefaultInstallDir" + Goto EndStrCmp + Admin: + StrCpy $INSTDIR "${ProgramFiles}\$DefaultInstallDir" + EndStrCmp: + + !insertmacro UNINSTALL.LOG_PREPARE_INSTALL +FunctionEnd + +Function .onInstSuccess + !insertmacro UNINSTALL.LOG_UPDATE_INSTALL +FunctionEnd + +;Uninstaller Section + +Section "Uninstall" + + ;; Remove these directories in a single operation. + ;; Doing so makes uninstallation much faster. However don't + ;; be tempted to do "Rmdir /r $INSTDIR" - this would wipe out + ;; the user's entire system if she had decided that INSTDIR is + ;; the C:\ directory. + + Rmdir /r "$INSTDIR\etc" + Rmdir /r "$INSTDIR\bin" + Rmdir /r "$INSTDIR\share" + + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR" + !insertmacro UNINSTALL.LOG_UNINSTALL "$APPDATA\${APP_NAME}" + !insertmacro UNINSTALL.LOG_END_UNINSTALL + + userInfo::getAccountType + pop $0 + strCmp $0 "Admin" Admin + # not admin + DeleteRegKey HKCU "Software\Classes\${PorExt}" + DeleteRegKey HKCU "Software\Classes\${SavExt}" + DeleteRegKey HKCU "Software\Classes\${SpsExt}" + DeleteRegKey HKCU "Software\Classes\PSPP Portable File" + DeleteRegKey HKCU "Software\Classes\PSPP System File" + DeleteRegKey HKCU "Software\Classes\PSPP Syntax File" + + DeleteRegKey HKCU "${INSTDIR_REG_KEY}" + + Goto EndStrCmp + Admin: + SetShellVarContext all + DeleteRegKey HKCR "${PorExt}" + DeleteRegKey HKCR "${SavExt}" + DeleteRegKey HKCR "${SpsExt}" + DeleteRegKey HKCR "PSPP Portable File" + DeleteRegKey HKCR "PSPP System File" + DeleteRegKey HKCR "PSPP Syntax File" + + DeleteRegKey HKLM "${INSTDIR_REG_KEY}" + + EndStrCmp: + + ; Now remove shortcuts too + RMDIR /r "$SMPROGRAMS\PSPP" + Delete "$DESKTOP\PSPP.lnk" + Delete "$DESKTOP\PSPPDebug.lnk" + Delete "$DESKTOP\PSPP Manual.lnk" + Delete "$DESKTOP\GDB Manual.lnk" + + # call userInfo plugin to get user info. The plugin puts the result in the stack + +SectionEnd + +;---------------------------------------------------- + +Function UN.onInit + !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL +FunctionEnd +;-------------------------------------------- diff --git a/configure.ac b/configure.ac index a9d8d84eee..28f70cfaca 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,12 @@ AC_LIBTOOL_WIN32_DLL AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL AC_HEADER_TIOCGWINSZ + +AC_CHECK_SIZEOF([ptrdiff_t]) +binary_width=`expr 8 '*' $ac_cv_sizeof_ptrdiff_t` +AC_SUBST([binary_width]) + + PKG_PROG_PKG_CONFIG m4_pattern_forbid([PKG_CHECK_MODULES]) PSPP_CHECK_CLICKSEQUENCE