1##########################
2# Included files
3##########################
4!addincludedir ${NSIDIR}
5!addplugindir ${NSIDIR}/plugin
6
7!include Sections.nsh
8!include MUI2.nsh
9!include nsDialogs.nsh
10!include Memento.nsh
11!include FileFunc.nsh
12!include UAC.nsh
13!include WinVer.nsh
14!include WordFunc.nsh
15!include AvidemuxVersion.nsh
16SetCompressor /SOLID lzma
17SetCompressorDictSize 96
18RequestExecutionLevel user
19
20##########################
21# Defines
22##########################
23!define REVISION ${SVN_VERSION}
24!define EXEDIR "${NSIDIR}/install"
25
26!define PRODUCT_VERSION "${CORE_VERSION}.${POINT_RELEASE}.${SVN_VERSION}"
27!define PRODUCT_NAME "Avidemux ${CORE_VERSION} - ${BUILD_BITS} bits${EXTRA}"
28!define PRODUCT_FULLNAME "Avidemux ${PRODUCT_VERSION} (${BUILD_BITS}-bits${EXTRA} Release)"
29
30!if ${BUILD_BITS} == 64
31    !define SHORTCUT_NAME "${PRODUCT_NAME}"
32    !define REG_GROUPNAME "${PRODUCT_NAME} (${BUILD_BITS}-bit${EXTRA})"
33!else
34    !define SHORTCUT_NAME "${PRODUCT_NAME} (${BUILD_BITS}-bit${EXTRA})"
35    !define REG_GROUPNAME "${PRODUCT_NAME}"
36!endif
37
38!define REGKEY "SOFTWARE\${REG_GROUPNAME}"
39!define UNINST_REGKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${REG_GROUPNAME}"
40!define COMPANY "Free Software Foundation"
41!define URL "http://www.avidemux.org"
42
43OutFile "${BINARY_FOLDER}/avidemux_${CORE_VERSION}.${POINT_RELEASE}${EXTRA} r${REVISION}_win${BUILD_BITS}.exe"
44Name "${PRODUCT_FULLNAME}"
45
46##########################
47# Memento defines
48##########################
49!define MEMENTO_REGISTRY_ROOT HKLM
50!define MEMENTO_REGISTRY_KEY "${REGKEY}"
51
52##########################
53# MUI defines
54##########################
55!define MUI_ICON "${SOURCE_FOLDER}/avidemux/common/xpm/adm.ico"
56!define MUI_HEADERIMAGE
57!define MUI_HEADERIMAGE_RIGHT
58!define MUI_HEADERIMAGE_BITMAP "${NSIDIR}/PageHeader.bmp"
59!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
60!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGKEY}"
61!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
62!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Avidemux (${BUILD_BITS} bits${EXTRA})"
63!define MUI_STARTMENUPAGE_NODISABLE
64!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
65!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${NSIDIR}/WelcomeFinishStrip.bmp"
66!define MUI_UNICON "${SOURCE_FOLDER}/avidemux/common/xpm/adm.ico"
67!define MUI_COMPONENTSPAGE_NODESC
68
69##########################
70# Variables
71##########################
72Var CreateDesktopIcon
73Var CreateStartMenuGroup
74Var CreateQuickLaunchIcon
75Var StartMenuGroup
76Var PreviousVersion
77Var PreviousVersionState
78Var ReinstallUninstall
79
80##########################
81# Installer pages
82##########################
83!define MUI_WELCOMEPAGE_TITLE "${PRODUCT_FULLNAME} Setup Wizard"
84!insertmacro MUI_PAGE_WELCOME
85!insertmacro MUI_PAGE_LICENSE "${NSIDIR}/License.rtf"
86 Page custom ReinstallPage ReinstallPageLeave
87!insertmacro MUI_PAGE_COMPONENTS
88Page custom InstallOptionsPage
89!define MUI_PAGE_CUSTOMFUNCTION_PRE IsStartMenuRequired
90!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
91!insertmacro MUI_PAGE_DIRECTORY
92!define MUI_PAGE_CUSTOMFUNCTION_PRE ActivateInternalSections
93!define MUI_PAGE_CUSTOMFUNCTION_SHOW InstFilesPageShow
94!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstFilesPageLeave
95!insertmacro MUI_PAGE_INSTFILES
96!define MUI_FINISHPAGE_RUN
97!define MUI_FINISHPAGE_RUN_FUNCTION RunAvidemux
98!define MUI_FINISHPAGE_RUN_TEXT "Run ${PRODUCT_NAME} now"
99!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ChangeLog.html"
100!define MUI_FINISHPAGE_SHOWREADME_TEXT "View Change Log now"
101!define MUI_FINISHPAGE_LINK "Visit the Avidemux website"
102!define MUI_FINISHPAGE_LINK_LOCATION "http://www.avidemux.org"
103!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfigureFinishPage
104!insertmacro MUI_PAGE_FINISH
105
106!define MUI_PAGE_CUSTOMFUNCTION_PRE un.ConfirmPagePre
107!insertmacro MUI_UNPAGE_CONFIRM
108!insertmacro MUI_UNPAGE_INSTFILES
109!define MUI_PAGE_CUSTOMFUNCTION_PRE un.FinishPagePre
110!insertmacro MUI_UNPAGE_FINISH
111
112##########################
113# Installer languages
114##########################
115!insertmacro MUI_LANGUAGE English
116
117##########################
118# Installer attributes
119##########################
120!if ${BUILD_BITS} == 64
121    InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
122!else
123    InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
124!endif
125
126CRCCheck on
127XPStyle on
128ShowInstDetails nevershow
129ShowUninstDetails nevershow
130VIProductVersion ${PRODUCT_VERSION}
131VIAddVersionKey ProductName Avidemux
132VIAddVersionKey ProductVersion "${PRODUCT_VERSION}"
133VIAddVersionKey FileVersion ""
134VIAddVersionKey FileDescription ""
135VIAddVersionKey LegalCopyright ""
136InstallDirRegKey HKLM "${REGKEY}" Path
137BrandingText "Packaged by Mean/Gruntster"
138InstType Standard
139InstType Full
140#########################################
141#
142#########################################
143Function GetAfterChar
144  Exch $0 ; chop char
145  Exch
146  Exch $1 ; input string
147  Push $2
148  Push $3
149  StrCpy $2 0
150  loop:
151    IntOp $2 $2 - 1
152    StrCpy $3 $1 1 $2
153    StrCmp $3 "" 0 +3
154      StrCpy $0 ""
155      Goto exit2
156    StrCmp $3 $0 exit1
157    Goto loop
158  exit1:
159    IntOp $2 $2 + 1
160    StrCpy $0 $1 "" $2
161  exit2:
162    Pop $3
163    Pop $2
164    Pop $1
165    Exch $0 ; output
166FunctionEnd
167#####################################################################©
168!define StrReplace '!insertmacro "_Name"'
169
170##########################
171# Uninstaller macros
172##########################
173!insertmacro un.GetOptions
174!insertmacro un.GetParameters
175
176!define UninstallLogPath "$INSTDIR\uninstall.log"
177Var UninstallLogHandle
178
179; Uninstall log file missing.
180LangString UninstallLogMissing ${LANG_ENGLISH} "uninstall.log not found!$\r$\nUninstallation cannot proceed!"
181# Regexep Does not work with cross
182# Use only one file at a time
183!macro InstallFile FILEZ
184    File "${FILEZ}"
185    Push "${FILEZ}"
186    Push "/"
187    Call GetAfterChar
188    Pop $R0
189    FileWrite $UninstallLogHandle "$OUTDIR\$R0$\r$\n"
190!macroend
191!define File "!insertmacro InstallFile"
192
193!macro InstallFolder FILEREGEX
194    File /r "${FILEREGEX}/*"
195    Push "$OUTDIR"
196    Call InstallFolderInternal
197!macroend
198!define Folder "!insertmacro InstallFolder"
199
200Function InstallFolderInternal
201    Pop $9
202    !define Index 'Line${__LINE__}'
203    FindFirst $0 $1 "$9/*"
204    StrCmp $0 "" "${Index}-End"
205"${Index}-Loop:"
206    StrCmp $1 "" "${Index}-End"
207    StrCmp $1 "." "${Index}-Next"
208    StrCmp $1 ".." "${Index}-Next"
209    IfFileExists "$9\$1\*" 0 "${Index}-Write"
210        Push $0
211        Push $9
212        Push "$9\$1"
213        Call InstallFolderInternal
214        Pop $9
215        Pop $0
216        Goto "${Index}-Next"
217"${Index}-Write:"
218    FileWrite $UninstallLogHandle "$9\$1$\r$\n"
219"${Index}-Next:"
220    FindNext $0 $1
221    Goto "${Index}-Loop"
222"${Index}-End:"
223    !undef Index
224FunctionEnd
225
226; WriteUninstaller macro
227!macro WriteUninstaller Path
228    WriteUninstaller "${Path}"
229    FileWrite $UninstallLogHandle "${Path}$\r$\n"
230!macroend
231!define WriteUninstaller "!insertmacro WriteUninstaller"
232
233##########################
234# Macros
235##########################
236
237!macro InstallQtLanguage LANG_NAME LANG_CODE
238    SetOverwrite on
239
240    !insertmacro SectionFlagIsSet ${SecUiQt} ${SF_SELECTED} installQt${LANG_CODE} endQt${LANG_CODE}
241
242installQt${LANG_CODE}:
243    SetOutPath $INSTDIR\qt5\i18n
244    ${File} qt5/i18n/avidemux_${LANG_CODE}.qm
245    ${File} qt5/i18n/qt_${LANG_CODE}.qm
246
247endQt${LANG_CODE}:
248!macroend
249#
250!macro InstallDev xname
251         SetOutPath $INSTDIR\include\avidemux\${API_VERSION}\${xname}
252         ${File} ${DEV_FOLDER}/include/avidemux/${API_VERSION}/${xname}/*
253!macroend
254!macro InstallDevQt5 xname
255         SetOutPath $INSTDIR\include\avidemux\${API_VERSION}\qt5\${xname}
256         ${File} ${DEV_FOLDER}/include/avidemux/${API_VERSION}/qt5/${xname}/*
257!macroend
258
259
260
261##########################
262# Installer sections
263##########################
264Section -OpenLogFile
265    CreateDirectory "$INSTDIR"
266    FileOpen $UninstallLogHandle ${UninstallLogPath} a
267    FileSeek $UninstallLogHandle 0 END
268SectionEnd
269Section  "User interfaces" SecGrpUI
270        SectionIn  1 2 RO
271        SetOutPath $INSTDIR
272        SetOverwrite on
273        ${File} ${BINARY_FOLDER}/avidemux_cli.exe
274        ${File} ${BINARY_FOLDER}/avidemux.exe
275        ${File} ${BINARY_FOLDER}/avidemux_jobs.exe
276        SetOutPath $INSTDIR\qt5\i18n
277        ${File} ${BINARY_FOLDER}/qt5/i18n/*.qm
278SectionEnd
279# !!
280Section "Plugins" SecGrpPlugins
281        SectionIn 1 2 RO
282        SetOverwrite on
283        SetOutPath $INSTDIR\plugins\audioDevices
284        ${File} ${BINARY_FOLDER}/plugins/audioDevices/*.dll
285        SetOutPath $INSTDIR\plugins\audioDecoder
286        ${File} ${BINARY_FOLDER}/plugins/audioDecoder/*.dll
287        SetOutPath $INSTDIR\plugins\audioEncoders
288        ${File} ${BINARY_FOLDER}/plugins/audioEncoders/*.dll
289        SetOutPath $INSTDIR\plugins\demuxers
290        ${File} ${BINARY_FOLDER}/plugins/demuxers/*.dll
291        SetOutPath $INSTDIR\plugins\muxers
292        ${File} ${BINARY_FOLDER}/plugins/muxers/*.dll
293        SetOutPath $INSTDIR\plugins\scriptEngines
294        ${File} ${BINARY_FOLDER}/plugins/scriptEngines/libADM_script_tinyPy.dll
295        SetOutPath $INSTDIR\plugins\autoScripts
296        ${Folder} ${BINARY_FOLDER}/plugins/autoScripts
297        #
298        SetOutPath $INSTDIR\plugins\videoDecoders
299        ${File} ${BINARY_FOLDER}/plugins/videoDecoders/*.dll
300        #
301        SetOutPath $INSTDIR\plugins\videoEncoders
302        ${File} ${BINARY_FOLDER}/plugins/videoEncoders/*.dll
303        #
304        SetOutPath $INSTDIR\plugins\videoEncoders\qt5
305        ${File} ${BINARY_FOLDER}/plugins/videoEncoders/qt5/*.dll
306        #SetOutPath $INSTDIR\plugins\videoEncoders\cli
307        #${File} ${BINARY_FOLDER}/plugins/videoEncoders/cli/*.dll
308        SetOutPath $INSTDIR\plugins\videoFilters
309        ${File} ${BINARY_FOLDER}/plugins/videoFilters/*.dll
310        SetOutPath $INSTDIR\plugins\videoFilters\qt5
311        ${File} ${BINARY_FOLDER}/plugins/videoFilters/qt5/*.dll
312        SetOutPath $INSTDIR\plugins\videoFilters\cli
313        ${File} ${BINARY_FOLDER}/plugins/videoFilters/cli/*.dll
314        # Fonts
315        SetOutPath $INSTDIR\etc\fonts
316        ${Folder} ${BINARY_FOLDER}/etc/fonts
317SectionEnd
318Section "PluginsSettings" SecGrpPluginsSettings
319        SectionIn 1 2 RO
320        SetOverwrite on
321        SetOutPath $INSTDIR\plugins\pluginSettings\x264\3
322        ${File} ${BINARY_FOLDER}/plugins/pluginSettings/x264/3/*.json
323        #SetOutPath $INSTDIR\plugins\pluginSettings\x264\3
324        #${File} ${BINARY_FOLDER}/plugins/pluginSettings/x264/3/*.json
325SectionEnd
326# !!
327Section "Avisynth_VapourSynth" SecGrpAvisynth
328        SectionIn 2
329        SetOutPath $INSTDIR
330        SetOverwrite on
331        ${File} ${BINARY_FOLDER}/avsproxy32.exe
332        ${File} ${BINARY_FOLDER}/avsproxy64.exe
333        #${File} ${BINARY_FOLDER}/avsproxy_gui.exe
334        # TMP ${File} ${BINARY_FOLDER}/vsProxy.exe
335        # TMP ${File} ${BINARY_FOLDER}/vsProxy_gui_qt5.exe
336SectionEnd
337#
338Section "ShaderDemo" SecShaderDemo
339        SectionIn  1 2 RO
340        SetOutPath $INSTDIR\shaderDemo
341        SetOverwrite on
342        ${File} ${BINARY_FOLDER}/plugins/shaderDemo/1/*.shader # FIXME
343SectionEnd
344#
345#
346Section "Support libs" SecGrpSupport
347        SectionIn  1 2 RO
348        SetOutPath $INSTDIR
349        SetOverwrite on
350        ${File} ${BINARY_FOLDER}/*.dll
351SectionEnd
352#
353Section "SDK (to write plugins)" SecGrpDev
354        SectionIn 2
355        SetOverwrite on
356        SetOutPath $INSTDIR
357        ${File} ${DEV_FOLDER}/*.dll.a
358        SetOutPath $INSTDIR\include\avidemux\${API_VERSION}
359        ${File} ${DEV_FOLDER}/include/avidemux/${API_VERSION}/*
360        SetOutPath $INSTDIR\include\avidemux\${API_VERSION}
361        ${File} ${DEV_FOLDER}/include/avidemux/${API_VERSION}/*
362        !insertmacro InstallDev cmake
363        !insertmacro InstallDev ADM_core
364        !insertmacro InstallDev ADM_coreAudio
365        !insertmacro InstallDev ADM_coreAudioDevice
366        !insertmacro InstallDev ADM_coreAudioEncoder
367        !insertmacro InstallDev ADM_coreAudioFilter
368        !insertmacro InstallDev ADM_coreAudioParser
369        !insertmacro InstallDev ADM_coreDemuxer
370        !insertmacro InstallDev ADM_coreDemuxerMpeg
371        !insertmacro InstallDev ADM_coreImage
372        !insertmacro InstallDev ADM_coreImageLoader
373        !insertmacro InstallDev ADM_coreJobs
374        !insertmacro InstallDev ADM_coreMuxer
375        !insertmacro InstallDev ADM_coreScript
376        !insertmacro InstallDev ADM_coreSocket
377        !insertmacro InstallDev ADM_coreSqlLight3
378        !insertmacro InstallDev ADM_coreSubtitles
379        !insertmacro InstallDev ADM_coreUI
380        !insertmacro InstallDev ADM_coreUtils
381        !insertmacro InstallDev ADM_coreVideoCodec
382        !insertmacro InstallDev ADM_coreVideoEncoder
383        !insertmacro InstallDev ADM_coreVideoFilter
384
385        !insertmacro InstallDev libavcodec
386        !insertmacro InstallDev libavformat
387        !insertmacro InstallDev libavutil
388        !insertmacro InstallDev libswscale
389        !insertmacro InstallDev libpostproc
390
391        !insertmacro InstallDev libpostproc
392        !insertmacro InstallDev qt5
393        !insertmacro InstallDevQt5 ADM_openGL
394        !insertmacro InstallDevQt5 ADM_UIs
395
396SectionEnd
397
398
399