;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; @(#) $Id: zint.nsi,v 1.1 2009/09/02 20:39:05 hooper114 Exp $ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Script generated by the HM NIS Edit Script Wizard. ; HM NIS Edit Wizard helper defines ;****************************************************************************** !define PRODUCT_NAME "Zint" !define PRODUCT_EXE "qtZint.exe" !define PRODUCT_VERSION "2.2.1.0" !define PRODUCT_WEB_SITE "http://www.zint.org.uk" !define PRODUCT_PUBLISHER "Robin Stuart & BogDan Vatra" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_EXE}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" ;****************************************************************************** Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "Setup_${PRODUCT_NAME}_${PRODUCT_VERSION}.exe" BrandingText "GPLv3, ${PRODUCT_PUBLISHER}" ;****************************************************************************** ;ShowInstDetails show -ne zapisuje podatke u log datoteku ShowInstDetails show ShowUnInstDetails show XPStyle on SetCompress auto SetCompressor lzma AutoCloseWindow false CRCCheck force ;****************************************************************************** ; MUI 1.8 compatible ------ !define MULTIUSER_EXECUTIONLEVEL Highest !define MULTIUSER_MUI !define MULTIUSER_INSTALLMODE_COMMANDLINE !define MULTIUSER_INSTALLMODE_INSTDIR "${PRODUCT_NAME}\" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME "InstallLocation" ;****************************************************************************** !include MultiUser.nsh !include MUI2.nsh !include LogicLib.nsh !include WinMessages.nsh !include FileFunc.nsh ;****************************************************************************** ; MUI Settings !define MUI_ABORTWARNING ; odkomentirati za prikaz MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_UNFINISHPAGE_NOAUTOCLOSE ;****************************************************************************** Var USER Var ICONS_GROUP ;****************************************************************************** ; Welcome page !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "gpl-3.0.txt" ; Mixed mode instalation page !insertmacro MULTIUSER_PAGE_INSTALLMODE ; Components page ; !insertmacro MUI_PAGE_COMPONENTS ; Directory page !insertmacro MUI_PAGE_DIRECTORY !define MUI_STARTMENUPAGE_NODISABLE !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${PRODUCT_NAME}" !define MUI_STARTMENUPAGE_REGISTRY_ROOT SHCTX !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}" !insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ;Finish page !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ; MUI end ------ ;****************************************************************************** ; Language files !insertmacro MUI_LANGUAGE "English" !insertmacro MUI_RESERVEFILE_LANGDLL ;****************************************************************************** Function .onInit !insertmacro MULTIUSER_INIT FunctionEnd ;****************************************************************************** Function startInstall SetOutPath "$INSTDIR" StrCpy $USER 0 UserInfo::GetName Pop $USER ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6 # LogSet on DetailPrint "--------------------------------------------------------------------------------" DetailPrint "Install start $2-$1-$0 $4:$5:$6 user:$USER ($MultiUser.Privileges)" DetailPrint "--------------------------------------------------------------------------------" FunctionEnd ;****************************************************************************** Function WinSxS_HasAssembly ;legacyDllName,(Strong)AssemblyName /* push 'msvcr90.dll' push 'Microsoft.VC90.CRT,version="9.0.21022.8",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"' call WinSxS_HasAssembly pop $0 ;0 on fail, 1 if it is in WinSxS or 2 if LoadLibrary worked on pre xp (call GetDLLVersion to make sure if you require a minimum version) */ Exch $8 Exch Exch $7 push $9 StrCpy $9 0 push $0 push $R0 push $R1 ${If} ${AtLeastWinXP} System::Call "sxs::CreateAssemblyCache(*i.R0,i0)i.r0" ${If} $0 == 0 System::Call '*(i 24,i0,l,i0,i0)i.R1' ;TODO,BUGBUG: check alloc success System::Call `$R0->4(i 0,w '$8',i $R1)i.r0` ;IAssemblyCache::QueryAssemblyInfo ${If} $0 == 0 System::Call '*$R1(i,i.r0)' IntOp $0 $0 & 1 ;ASSEMBLYINFO_FLAG_INSTALLED=1 ${IfThen} $0 <> 0 ${|} StrCpy $9 1 ${|} ${EndIf} System::Free $R1 System::Call $R0->2() ;IAssemblyCache::Release ${EndIf} ${Else} System::Call kernel32::LoadLibrary(t"$7")i.r0 ${If} $0 != 0 StrCpy $9 2 System::Call 'kernel32::FreeLibrary(i r0)' ${EndIf} ${EndIf} pop $R1 pop $R0 pop $0 Exch 2 pop $8 pop $7 Exch $9 FunctionEnd ;****************************************************************************** Section ${PRODUCT_NAME} SEC01 SectionIn RO Call startInstall var /GLOBAL hasCRT !define CRTCHECKDLL msvcr90.dll !define CRTCHECKNAME 'Microsoft.VC90.CRT,version="9.0.21022.8",type="win32",processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b"' push '${CRTCHECKDLL}' push '${CRTCHECKNAME}' call WinSxS_HasAssembly pop $hasCRT DetailPrint ${CRTCHECKDLL}=$hasCRT ${If} $hasCRT != 1 Abort "The Zint requires \nMicrosoft Visual C++ 2008 Service Pack 1 Redistributable Package." ${EndIf} SetOverwrite ifnewer File ".\frontend_qt4\release\${PRODUCT_EXE}" File ".\win32\Release\zint.exe" WriteUninstaller "$INSTDIR\uninst.exe" !insertmacro MUI_STARTMENU_WRITE_BEGIN Application CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\qtZint.lnk" "$INSTDIR\${PRODUCT_EXE}" CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd ;****************************************************************************** Section -Post WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${PRODUCT_EXE}" WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "Path" "$INSTDIR" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXE}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_WEB_SITE}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR" WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallSource" "$EXEDIR" WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 1 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 1 DetailPrint "--------------------------------------------------------------------------------" ClearErrors SectionEnd ;****************************************************************************** LangString MSG1 ${LANG_ENGLISH} "$(^Name) was successfully removed from your computer." LangString MSG2 ${LANG_ENGLISH} "${PRODUCT_EXE} could not be closed.$\r$\nTry again?" LangString MSG3 ${LANG_ENGLISH} "Are you sure you want to completely remove $(^Name) and all of its components?" LangString MSG4 ${LANG_ENGLISH} "$(^Name) application" LangString MSG5 ${LANG_ENGLISH} "Unable to create $INSTDIR" ;****************************************************************************** Function un.onInit !insertmacro MULTIUSER_UNINIT StrCpy $USER 0 UserInfo::GetName Pop $USER ${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6 # LogSet on DetailPrint "--------------------------------------------------------------------------------" DetailPrint "Uninstall start $2-$1-$0 $4:$5:$6 user:$USER ($MultiUser.Privileges)" DetailPrint "--------------------------------------------------------------------------------" MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 $(MSG3) /SD IDYES IDYES +2 Abort FunctionEnd ;****************************************************************************** Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK $(MSG1) /SD IDOK DetailPrint "--------------------------------------------------------------------------------" DetailPrint "*** Uninstall finish OK ***" DetailPrint "--------------------------------------------------------------------------------" FunctionEnd ;****************************************************************************** Function un.onUninstFailed DetailPrint "--------------------------------------------------------------------------------" DetailPrint "*** Uninstall finish FAILED ***" DetailPrint "--------------------------------------------------------------------------------" FunctionEnd ;****************************************************************************** Section Uninstall DetailPrint "--------------------------------------------------------------------------------" DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}" DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}" !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP RmDir /r "$SMPROGRAMS\$ICONS_GROUP" Delete /REBOOTOK "$INSTDIR\${PRODUCT_EXE}" Delete /REBOOTOK "$INSTDIR\zint.exe" Delete /REBOOTOK "$INSTDIR\uninst.exe" Delete /REBOOTOK "$INSTDIR\install.log" RmDir /REBOOTOK "$INSTDIR" SectionEnd ;****************************************************************************** VIProductVersion ${PRODUCT_VERSION} VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "${PRODUCT_NAME}" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${PRODUCT_PUBLISHER}" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${PRODUCT_NAME} Setup" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${PRODUCT_VERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright © 2009 Robin Stuart & BogDan Vatra" VIAddVersionKey /LANG=${LANG_ENGLISH} "License" "GNU General Public License version 3" VIAddVersionKey /LANG=${LANG_ENGLISH} "WWW" "${PRODUCT_WEB_SITE}" ;******************************************************************************