OSDN Git Service

import original 0.9.5 release
[handbrake-jp/handbrake-jp.git] / win / C# / Installer / MakeNightly.nsi.tmpl
diff --git a/win/C#/Installer/MakeNightly.nsi.tmpl b/win/C#/Installer/MakeNightly.nsi.tmpl
new file mode 100644 (file)
index 0000000..55db341
--- /dev/null
@@ -0,0 +1,359 @@
+/*  Resources.Designer.cs $\r
+\r
+          This file is part of the HandBrake source code.\r
+          Homepage: <http://handbrake.fr/>.\r
+          It may be used under the terms of the GNU General Public License. */\r
+\r
+; Script generated by the HM NIS Edit Script Wizard.\r
+\r
+; HM NIS Edit Wizard helper defines\r
+!define PRODUCT_NAME "Handbrake"\r
+!define PRODUCT_VERSION "$WCREV$ Nightly"\r
+!define PRODUCT_VERSION_NUMBER "svn$WCREV$"\r
+!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Handbrake.exe"\r
+!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"\r
+!define PRODUCT_UNINST_ROOT_KEY "HKLM"\r
+\r
+;Required .NET framework\r
+!define MIN_FRA_MAJOR "3"\r
+!define MIN_FRA_MINOR "5"\r
+!define MIN_FRA_BUILD "*"\r
+\r
+SetCompressor lzma\r
+\r
+; MUI 1.67 compatible ------\r
+!include "MUI.nsh"\r
+\r
+; MUI Settings\r
+!define MUI_ABORTWARNING\r
+!define MUI_ICON "handbrakepineapple.ico"\r
+!define MUI_UNICON "handbrakepineapple.ico"\r
+\r
+; Welcome page\r
+!insertmacro MUI_PAGE_WELCOME\r
+; License page\r
+!insertmacro MUI_PAGE_LICENSE "doc\COPYING"\r
+; Directory page\r
+!insertmacro MUI_PAGE_DIRECTORY\r
+; Instfiles page\r
+!insertmacro MUI_PAGE_INSTFILES\r
+; Finish page\r
+!define MUI_FINISHPAGE_RUN "$INSTDIR\Handbrake.exe"\r
+!insertmacro MUI_PAGE_FINISH\r
+\r
+; Uninstaller pages\r
+!insertmacro MUI_UNPAGE_INSTFILES\r
+\r
+; Language files\r
+!insertmacro MUI_LANGUAGE "English"\r
+\r
+; MUI end ------\r
+\r
+Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"\r
+OutFile "HandBrake-${PRODUCT_VERSION_NUMBER}-Win_GUI.exe"\r
+\r
+!include WordFunc.nsh\r
+!insertmacro VersionCompare\r
+!include LogicLib.nsh\r
+\r
+InstallDir "$PROGRAMFILES\Handbrake"\r
+InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""\r
+ShowInstDetails show\r
+ShowUnInstDetails show\r
+\r
+Var InstallDotNET\r
+\r
+Function .onInit\r
+\r
+  ; Begin Only allow one version\r
+  System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'\r
+  Pop $R0\r
+\r
+  StrCmp $R0 0 +3\r
+  MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."\r
+  Abort\r
+\r
+  ;Remove previous version\r
+  ReadRegStr $R0 HKLM \\r
+  "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}\" \\r
+  "UninstallString"\r
+  StrCmp $R0 "" done\r
+\r
+  MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \\r
+  "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \\r
+  previous version or `Cancel` to continue." \\r
+  IDOK uninst\r
+  goto done\r
+\r
+ ;Run the uninstaller\r
+  uninst:\r
+   Exec $INSTDIR\uninst.exe\r
+  done:\r
+FunctionEnd\r
+\r
+Section "Handbrake" SEC01\r
+  SetOutPath "$INSTDIR"\r
+  SetOverwrite ifnewer\r
+\r
+  ; Begin Check .NET version\r
+  StrCpy $InstallDotNET "No"\r
+  Call CheckFramework\r
+     StrCmp $0 "1" +3\r
+        StrCpy $InstallDotNET "Yes"\r
+      MessageBox MB_OK|MB_ICONINFORMATION "${PRODUCT_NAME} requires that the .NET Framework 3.5 SP1 is installed. The latest .NET Framework will be downloaded and installed automatically during installation of ${PRODUCT_NAME}."\r
+     Pop $0\r
+\r
+  ; Get .NET if required\r
+  ${If} $InstallDotNET == "Yes"\r
+     SetDetailsView hide\r
+     inetc::get /caption "Downloading .NET Framework 3.5" /canceltext "Cancel" "http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=ab99342f-5d1a-413d-8319-81da479ab0d7&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f0%2f6%2f1%2f061f001c-8752-4600-a198-53214c69b51f%2fdotnetfx35setup.exe" "$INSTDIR\dotnetfx.exe" /end\r
+     Pop $1\r
+\r
+     ${If} $1 != "OK"\r
+           Delete "$INSTDIR\dotnetfx.exe"\r
+           Abort "Installation cancelled, ${PRODUCT_NAME} requires the .NET 3.5 Framework"\r
+     ${EndIf}\r
+\r
+     ExecWait "$INSTDIR\dotnetfx.exe"\r
+     Delete "$INSTDIR\dotnetfx.exe"\r
+\r
+     SetDetailsView show\r
+  ${EndIf}\r
+  \r
+  ; Install Files\r
+  File "Handbrake.exe"\r
+  File "HandBrakeCLI.exe"\r
+  CreateDirectory "$SMPROGRAMS\Handbrake"\r
+  CreateShortCut "$SMPROGRAMS\Handbrake\Handbrake.lnk" "$INSTDIR\Handbrake.exe"\r
+  CreateShortCut "$DESKTOP\Handbrake.lnk" "$INSTDIR\Handbrake.exe"\r
+  File "Interop.QTOLibrary.dll"\r
+  File "Interop.QTOControlLib.dll"\r
+  File "AxInterop.QTOControlLib.dll"\r
+  File "Growl.Connector.dll"\r
+  File "Growl.CoreLibrary.dll"\r
+  File "Handbrake.exe.config"\r
+  File "HandBrake.ApplicationServices.dll"\r
+  File "HandBrake.Framework.dll"\r
+  File "Microsoft.WindowsAPICodePack.Shell.dll"\r
+  File "Microsoft.WindowsAPICodePack.dll"\r
+\r
+  ;File "Caliburn.Castle.dll"\r
+  ;File "Caliburn.Core.dll"\r
+  ;File "Castle.Core.dll"\r
+  ;File "Castle.DynamicProxy2.dll"\r
+  ;File "Castle.MicroKernel.dll"\r
+  ;File "Castle.Windsor.dll"\r
+  ;File "Microsoft.Practices.ServiceLocation.dll"\r
+\r
+  ; Copy the standard doc set into the doc folder\r
+  SetOutPath "$INSTDIR\doc"\r
+  SetOverwrite ifnewer\r
+  File "doc\AUTHORS"\r
+  File "doc\COPYING"\r
+  File "doc\CREDITS"\r
+  File "doc\NEWS"\r
+  File "doc\THANKS"\r
+  File "doc\TRANSLATIONS"\r
+SectionEnd\r
+\r
+Section -AdditionalIcons\r
+  CreateShortCut "$SMPROGRAMS\Handbrake\Uninstall.lnk" "$INSTDIR\uninst.exe"\r
+SectionEnd\r
+\r
+Section -Post\r
+  WriteUninstaller "$INSTDIR\uninst.exe"\r
+  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Handbrake.exe"\r
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"\r
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"\r
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Handbrake.exe"\r
+  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"\r
+SectionEnd\r
+\r
+\r
+Function un.onUninstSuccess\r
+  HideWindow\r
+  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."\r
+FunctionEnd\r
+\r
+Function un.onInit\r
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2\r
+  Abort\r
+FunctionEnd\r
+\r
+Section Uninstall\r
+  Delete "$INSTDIR\uninst.exe"\r
+  \r
+  Delete "$INSTDIR\Interop.QTOLibrary.dll"\r
+  Delete "$INSTDIR\Interop.QTOControlLib.dll"\r
+  Delete "$INSTDIR\AxInterop.QTOControlLib.dll"\r
+  Delete "$INSTDIR\HandBrakeCLI.exe"\r
+  Delete "$INSTDIR\handbrakepineapple.ico"\r
+  Delete "$INSTDIR\Handbrake.exe"\r
+  Delete "$INSTDIR\Handbrake.exe.config"\r
+  Delete "$INSTDIR\Growl.Connector.dll"\r
+  Delete "$INSTDIR\Growl.CoreLibrary.dll"\r
+  Delete "$INSTDIR\libgcc_s_sjlj-1.dll"\r
+  Delete "$INSTDIR\HandBrake.ApplicationServices.dll"\r
+  Delete "$INSTDIR\HandBrake.Framework.dll"\r
+  Delete "$INSTDIR\Microsoft.WindowsAPICodePack.Shell.dll"\r
+  Delete "$INSTDIR\Microsoft.WindowsAPICodePack.dll"\r
+\r
+  Delete "$INSTDIR\Caliburn.Castle.dll"\r
+  Delete "$INSTDIR\Caliburn.Core.dll"\r
+  Delete "$INSTDIR\Castle.Core.dll"\r
+  Delete "$INSTDIR\Castle.DynamicProxy2.dll"\r
+  Delete "$INSTDIR\Castle.MicroKernel.dll"\r
+  Delete "$INSTDIR\Castle.Windsor.dll"\r
+  Delete "$INSTDIR\Microsoft.Practices.ServiceLocation.dll"\r
+\r
+  Delete "$INSTDIR\doc\AUTHORS"\r
+  Delete "$INSTDIR\doc\COPYING"\r
+  Delete "$INSTDIR\doc\CREDITS"\r
+  Delete "$INSTDIR\doc\NEWS"\r
+  Delete "$INSTDIR\doc\THANKS"\r
+  Delete "$INSTDIR\doc\TRANSLATIONS"\r
+  RMDir  "$INSTDIR"\r
+  Delete "$SMPROGRAMS\Handbrake\Uninstall.lnk"\r
+  Delete "$DESKTOP\Handbrake.lnk"\r
+  Delete "$SMPROGRAMS\Handbrake\Handbrake.lnk"\r
+  RMDir  "$SMPROGRAMS\Handbrake"\r
+  RMDir  "$INSTDIR"\r
+\r
+  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"\r
+  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"\r
+  SetAutoClose true\r
+SectionEnd\r
+\r
+;Check for .NET framework\r
+Function CheckFrameWork\r
+\r
+   ;Save the variables in case something else is using them\r
+  Push $0\r
+  Push $1\r
+  Push $2\r
+  Push $3\r
+  Push $4\r
+  Push $R1\r
+  Push $R2\r
+  Push $R3\r
+  Push $R4\r
+  Push $R5\r
+  Push $R6\r
+  Push $R7\r
+  Push $R8\r
+\r
+  StrCpy $R5 "0"\r
+  StrCpy $R6 "0"\r
+  StrCpy $R7 "0"\r
+  StrCpy $R8 "0.0.0"\r
+  StrCpy $0 0\r
+\r
+  loop:\r
+\r
+  ;Get each sub key under "SOFTWARE\Microsoft\NET Framework Setup\NDP"\r
+  EnumRegKey $1 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP" $0\r
+  StrCmp $1 "" done ;jump to end if no more registry keys\r
+  IntOp $0 $0 + 1\r
+  StrCpy $2 $1 1 ;Cut off the first character\r
+  StrCpy $3 $1 "" 1 ;Remainder of string\r
+\r
+  ;Loop if first character is not a 'v'\r
+  StrCmpS $2 "v" start_parse loop\r
+\r
+  ;Parse the string\r
+  start_parse:\r
+  StrCpy $R1 ""\r
+  StrCpy $R2 ""\r
+  StrCpy $R3 ""\r
+  StrCpy $R4 $3\r
+\r
+  StrCpy $4 1\r
+\r
+  parse:\r
+  StrCmp $3 "" parse_done ;If string is empty, we are finished\r
+  StrCpy $2 $3 1 ;Cut off the first character\r
+  StrCpy $3 $3 "" 1 ;Remainder of string\r
+  StrCmp $2 "." is_dot not_dot ;Move to next part if it's a dot\r
+\r
+  is_dot:\r
+  IntOp $4 $4 + 1 ; Move to the next section\r
+  goto parse ;Carry on parsing\r
+\r
+  not_dot:\r
+  IntCmp $4 1 major_ver\r
+  IntCmp $4 2 minor_ver\r
+  IntCmp $4 3 build_ver\r
+  IntCmp $4 4 parse_done\r
+\r
+  major_ver:\r
+  StrCpy $R1 $R1$2\r
+  goto parse ;Carry on parsing\r
+\r
+  minor_ver:\r
+  StrCpy $R2 $R2$2\r
+  goto parse ;Carry on parsing\r
+\r
+  build_ver:\r
+  StrCpy $R3 $R3$2\r
+  goto parse ;Carry on parsing\r
+\r
+  parse_done:\r
+\r
+  IntCmp $R1 $R5 this_major_same loop this_major_more\r
+  this_major_more:\r
+  StrCpy $R5 $R1\r
+  StrCpy $R6 $R2\r
+  StrCpy $R7 $R3\r
+  StrCpy $R8 $R4\r
+\r
+  goto loop\r
+\r
+  this_major_same:\r
+  IntCmp $R2 $R6 this_minor_same loop this_minor_more\r
+  this_minor_more:\r
+  StrCpy $R6 $R2\r
+  StrCpy $R7 R3\r
+  StrCpy $R8 $R4\r
+  goto loop\r
+\r
+  this_minor_same:\r
+  IntCmp $R3 $R7 loop loop this_build_more\r
+  this_build_more:\r
+  StrCpy $R7 $R3\r
+  StrCpy $R8 $R4\r
+  goto loop\r
+\r
+  done:\r
+\r
+  ;Have we got the framework we need?\r
+  IntCmp $R5 ${MIN_FRA_MAJOR} max_major_same fail OK\r
+  max_major_same:\r
+  IntCmp $R6 ${MIN_FRA_MINOR} max_minor_same fail OK\r
+  max_minor_same:\r
+  IntCmp $R7 ${MIN_FRA_BUILD} OK fail OK\r
+\r
+  ;Version on machine is greater than what we need\r
+  OK:\r
+  StrCpy $0 "1"\r
+  goto end\r
+\r
+  fail:\r
+  StrCmp $R8 "0.0.0" end\r
+\r
+\r
+  end:\r
+\r
+  ;Pop the variables we pushed earlier\r
+  Pop $R8\r
+  Pop $R7\r
+  Pop $R6\r
+  Pop $R5\r
+  Pop $R4\r
+  Pop $R3\r
+  Pop $R2\r
+  Pop $R1\r
+  Pop $4\r
+  Pop $3\r
+  Pop $2\r
+  Pop $1\r
+FunctionEnd
\ No newline at end of file