1@echo off
2
3for /f %%d in ('wmic os get localdatetime ^|findstr /b [0-9]') do @set datetime=%%d
4
5REM Read from generated file during compile if exist
6REM Relative paths are relative to install_smplayer
7
8if exist win32inst_vars.cmd (
9
10  call win32inst_vars.cmd
11
12  set MPLAYER_DIR=mplayer
13  set MPV_DIR=mpv
14
15) else (
16
17  echo This batch file can help you to create a directory with all required files
18  echo Just change the variables at the beginning
19  echo.
20  echo Warning: it will only work with sources from the SVN and the command svn has to be in the path
21  echo.
22
23  set /P QT_VER="Qt Version (Default: 5.6.0): "
24  if "%QT_VER%"=="" set QT_VER=5.6.0
25
26  set SMPLAYER_DIR=svn\smplayer
27  REM set SMTUBE_DIR=svn\smtube
28  set SMPLAYER_THEMES_DIR=svn\smplayer-themes
29  set SMPLAYER_SKINS_DIR=svn\smplayer-skins
30  set MPLAYER_DIR=mplayer
31  set MPV_DIR=mpv
32  set QT_DIR=C:\Qt\%QT_VER%
33  set MINGW_DIR=C:\Qt\%QT_VER%\Tools\mingw492_32
34  set X86_64=
35  set BUILD_PREFIX=..
36  set DEBUG=
37
38)
39
40if [%X86_64%]==[yes] (
41  set BASE_BUILD_DIR=smplayer-build64
42  set OUTPUT_DIR=%BUILD_PREFIX%\smplayer-build64
43  set OPENSSL_DIR=openssl64
44) else (
45  set BASE_BUILD_DIR=smplayer-build
46  set OUTPUT_DIR=%BUILD_PREFIX%\smplayer-build
47  set OPENSSL_DIR=openssl
48)
49
50if exist "%OUTPUT_DIR%" (
51  ren "%OUTPUT_DIR%" "%BASE_BUILD_DIR%.%datetime%"
52)
53
54if [%DEBUG%]==[yes] (
55  set QT_DEBUG_DLL_SUFFIX=d
56  set QT_BUILD_DIR=debug
57) else (
58  set QT_DEBUG_DLL_SUFFIX=
59  set QT_BUILD_DIR=release
60)
61
62:begin
63echo.
64echo --      SMPlayer, QT libs      --
65echo.
66
67mkdir %OUTPUT_DIR%
68copy "%SMPLAYER_DIR%\src\%QT_BUILD_DIR%\smplayer.exe" "%OUTPUT_DIR%"
69copy "%SMPLAYER_DIR%\dxlist\release\dxlist.exe" "%OUTPUT_DIR%"
70copy "%SMPLAYER_DIR%\webserver\simple_web_server.exe" "%OUTPUT_DIR%"
71copy "%SMPLAYER_DIR%\zlib\zlib1.dll" "%OUTPUT_DIR%"
72copy "%SMPLAYER_DIR%\*.txt" "%OUTPUT_DIR%"
73REM copy "%SMPLAYER_DIR%\setup\sample.avi" "%OUTPUT_DIR%"
74
75REM Core files
76if %QT_VER% lss 5.0.0 (
77
78  copy "%QT_DIR%\bin\QtCore%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
79  copy "%QT_DIR%\bin\QtDBus%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
80  copy "%QT_DIR%\bin\QtGui%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
81  copy "%QT_DIR%\bin\QtNetwork%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
82  copy "%QT_DIR%\bin\QtXml%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
83  copy "%QT_DIR%\bin\QtScript%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%"
84
85) else if %QT_VER% geq 5.0.0 (
86
87  REM copy "%QT_DIR%\bin\icudt*.dll" "%OUTPUT_DIR%"
88  REM copy "%QT_DIR%\bin\icuin*.dll" "%OUTPUT_DIR%"
89  REM copy "%QT_DIR%\bin\icuuc*.dll" "%OUTPUT_DIR%"
90  copy "%QT_DIR%\bin\Qt5Core%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
91  REM copy "%QT_DIR%\bin\Qt5DBus%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
92  copy "%QT_DIR%\bin\Qt5Gui%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
93  copy "%QT_DIR%\bin\Qt5Network%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
94  copy "%QT_DIR%\bin\Qt5Widgets%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
95  copy "%QT_DIR%\bin\Qt5Xml%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
96  copy "%QT_DIR%\bin\Qt5Script%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%"
97
98)
99
100REM Qt Plugins
101mkdir "%OUTPUT_DIR%\imageformats"
102if %QT_VER% lss 5.0.0 (
103
104  copy "%QT_DIR%\plugins\imageformats\qjpeg%QT_DEBUG_DLL_SUFFIX%4.dll" "%OUTPUT_DIR%\imageformats\"
105
106) else if %QT_VER% geq 5.0.0 (
107
108  mkdir "%OUTPUT_DIR%\platforms"
109  copy "%QT_DIR%\plugins\imageformats\qjpeg%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%\imageformats\"
110  copy "%QT_DIR%\plugins\platforms\qwindows%QT_DEBUG_DLL_SUFFIX%.dll" "%OUTPUT_DIR%\platforms\"
111
112)
113
114REM Toolchain specific files
115copy "%QT_DIR%\bin\mingwm10.dll" "%OUTPUT_DIR%"
116copy "%QT_DIR%\bin\libgcc_s_*.dll" "%OUTPUT_DIR%"
117copy "%QT_DIR%\bin\libstdc++-6.dll" "%OUTPUT_DIR%"
118copy "%QT_DIR%\bin\libwinpthread-1.dll" "%OUTPUT_DIR%"
119
120REM OpenSSL
121copy "%OPENSSL_DIR%\*.dll" "%OUTPUT_DIR%"
122
123if not exist "%QT_DIR%\bin\libeay32.dll" goto skip_toolchain_ssl
124if not exist "%QT_DIR%\bin\ssleay32.dll" goto skip_toolchain_ssl
125copy /y "%QT_DIR%\bin\libeay32.dll" "%OUTPUT_DIR%"
126copy /y "%QT_DIR%\bin\ssleay32.dll" "%OUTPUT_DIR%"
127
128:skip_toolchain_ssl
129
130REM echo.
131REM echo --           Fonts             --
132REM echo.
133REM mkdir "%OUTPUT_DIR%\open-fonts"
134REM copy "open-fonts\*.*" "%OUTPUT_DIR%\open-fonts\"
135
136echo.
137echo --        Translations         --
138echo.
139mkdir "%OUTPUT_DIR%\translations"
140copy "%SMPLAYER_DIR%\src\translations\*.qm" "%OUTPUT_DIR%\translations"
141
142echo.
143echo --       Qt Translations       --
144echo.
145copy "%QT_DIR%\translations\qt_*.qm" %OUTPUT_DIR%\translations
146copy "%QT_DIR%\translations\qtbase*.qm" %OUTPUT_DIR%\translations
147copy "%SMPLAYER_DIR%\qt-translations\qt_*.qm" "%OUTPUT_DIR%\translations"
148del "%OUTPUT_DIR%\translations\qt_help_*.qm"
149
150echo.
151echo --         Shortcuts           --
152echo.
153mkdir "%OUTPUT_DIR%\shortcuts"
154copy "%SMPLAYER_DIR%\src\shortcuts\*.keys" "%OUTPUT_DIR%\shortcuts"
155
156echo.
157echo --        Documentation        --
158echo.
159svn export --force "%SMPLAYER_DIR%\docs" "%OUTPUT_DIR%\docs"
160
161echo.
162echo --         Icon Themes         --
163echo.
164for /f "tokens=*" %%a in ('dir /ad /b ^"%SMPLAYER_THEMES_DIR%\themes^"') do (
165xcopy "%SMPLAYER_THEMES_DIR%\themes\%%a\*.rcc" "%OUTPUT_DIR%\themes\%%a\"
166xcopy "%SMPLAYER_THEMES_DIR%\themes\%%a\*.qss" "%OUTPUT_DIR%\themes\%%a\"
167xcopy "%SMPLAYER_THEMES_DIR%\themes\%%a\README.txt" "%OUTPUT_DIR%\themes\%%a\"
168)
169
170echo.
171echo --            Skins            --
172echo.
173for /f "tokens=*" %%b in ('dir /ad /b ^"%SMPLAYER_SKINS_DIR%\themes^"') do (
174xcopy "%SMPLAYER_SKINS_DIR%\themes\%%b\*.rcc" "%OUTPUT_DIR%\themes\%%b\"
175xcopy "%SMPLAYER_SKINS_DIR%\themes\%%b\main.css" "%OUTPUT_DIR%\themes\%%b\"
176)
177
178echo.
179echo --           MPlayer           --
180echo.
181for /f %%i in ("%MPLAYER_DIR%") do set MPLAYER_DIR=%%~fi
182mklink /D "%OUTPUT_DIR%\mplayer" "%MPLAYER_DIR%"
183if not errorlevel 0 (
184  xcopy "%MPLAYER_DIR%" "%OUTPUT_DIR%\mplayer\" /E
185)
186
187echo.
188echo --           MPV           --
189echo.
190for /f %%i in ("%MPV_DIR%") do set MPV_DIR=%%~fi
191mklink /D "%OUTPUT_DIR%\mpv" "%MPV_DIR%"
192if not errorlevel 0 (
193  xcopy "%MPV_DIR%" "%OUTPUT_DIR%\mpv\" /E
194)
195
196echo.
197
198:end
199
200set SMPLAYER_DIR=
201set SMTUBE_DIR=
202set SMPLAYER_THEMES_DIR=
203set SMPLAYER_SKINS_DIR=
204set MPLAYER_DIR=
205set MPV_DIR=
206set QT_DIR=
207set QT_VER=
208set MINGW_DIR=
209set X86_64=
210set BUILD_PREFIX=
211
212set QT_DEBUG_DLL_SUFFIX=
213set QT_BUILD_DIR=
214