-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmake.cmd
More file actions
156 lines (141 loc) · 4.65 KB
/
make.cmd
File metadata and controls
156 lines (141 loc) · 4.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@echo off
chcp 866
if /I "%~1"=="debug" (
rem ¥à¥¤ ¢ ª ç¥á⢥ ¯ à ¬¥âà debug
set DEBUG=
) else (
rem ¨ ç¥ ¢ë¢®¤ë ¢ë¡à áë¢ ¥¬ ¢ NUL
set DEBUG=^> NUL
)
set OUTPUT=bin
goto begin
rem á®§¤ ¨¥ áá뫪¨ ä ©«, á 㤠«¥¨¥¬ áãé¥áâ¢ãî饩
:link
if exist %~s2\NUL (
rem ª â «®£
rmdir /s /q "%~1"
mklink /j "%~1" "%~2"
) else (
rem ä ©«
call :delete "%~1"
mklink /h "%~1" "%~2"
)
goto :eof
rem 㤠«¥¨¥ ¥á«¨ ä ©« áãé¥áâ¢ã¥â
:delete
if exist "%~1" del "%~1"
goto :eof
:begin
rem ======================
rem ======================
rem Hardlinks
rem ======================
rem ======================
echo ==== Hardlinks ====
mkdir "%OUTPUT%"
rem ==================
rem Opera
rem ==================
call :link "opera extension\vkpatch.user.js" vkpatch.user.js
call :link "opera extension\components" components
call :link "opera extension\plugins" plugins
mkdir "opera extension\icons\"
call :link "opera extension\icons\icon_64.png" "resources\icon_64.png"
rem ==================
rem Chrome
rem ==================
rem Chromium packager won't work with Windows's junctions for some reason, using xcopy instead...
mkdir "chrome extension\icons\"
call :link "chrome extension\vkpatch.user.js" vkpatch.user.js
rem call :link "chrome extension\components" components
rem call :link "chrome extension\plugins" plugins
mkdir "chrome extension\components"
xcopy components "chrome extension\components" /e /y
mkdir "chrome extension\plugins"
xcopy plugins "chrome extension\plugins" /e /y
call :link "chrome extension\icons\icon_16.png" "resources\icon_16.png"
call :link "chrome extension\icons\icon_48.png" "resources\icon_48.png"
call :link "chrome extension\icons\icon_128.png" "resources\icon_128.png"
rem ==================
rem Firefox
rem ==================
call :link "firefox extension\content\vkpatch.user.js" vkpatch.user.js
call :link "firefox extension\content\components" components
call :link "firefox extension\content\plugins" plugins
mkdir "firefox extension\content\icons\"
call :link "firefox extension\content\icons\icon_48.png" "resources\icon_48.png"
call :link "firefox extension\content\icons\icon_64.png" "resources\icon_64.png"
rem ==================
rem IE
rem ==================
call :link "ie extension\vkpatch.user.js" vkpatch.user.js
rem ======================
rem ======================
rem Packaging
rem ======================
rem ======================
rem ˆ§¢«¥ç¥¨¥ ®¬¥à ¢¥àᨨ ¨§ ä ©« vkpatch.user.js
rem ¨§¢«¥ª ¥âáï ¨§ áâப¨ ¢¨¤
rem vkPatch.version = '11.11.11'
FOR /F "usebackq tokens=2 delims='" %%s IN (`findstr /R /I /C:"^[ ]*vkPatch.version[ ]*=[ ]*'[0-9a-zA-Z. ]*'" vkpatch.user.js`) do (
set version=%%s
)
echo.
echo ==== Packaging ====
rem 7-Zip Command Line Version - http://www.7-zip.org/download.html
echo ‚¥àá¨ï vkPatch: %version%
echo.
rem ==================
rem Opera
rem ==================
echo === Opera === %DEBUG%
call :delete "%OUTPUT%\vkpatch-%version%-opera.oex"
7za a -tzip "%OUTPUT%\vkpatch-%version%-opera.oex" ".\opera extension\*" %DEBUG%
if ERRORLEVEL 0 (
echo Opera extension done
) else (
echo Opera extension failed !
)
rem “¯ ª®¢ë¢ ¥¬ ¢ à娢
7za a -tzip -w "%OUTPUT%\vkpatch-%version%-opera.zip" "%OUTPUT%\vkpatch-%version%-opera.oex" %DEBUG%
rem ==================
rem Chrome
rem ==================
rem %chrome% - ¯ãâì ª chrome.exe
echo === Chrome === %DEBUG%
IF [%chrome%] EQU [] (
echo Chrome extension failed !
echo Please set up environment variable CHROME to point to chrome.exe
goto :firefox
)
rem adding quotes if there isn't any
set chrome="%chrome:"=%"
call :delete "%OUTPUT%\vkpatch-%version%-chrome.crx"
if exist "%cd%\vkpatch-chrome-key.pem" (
rem …áâì ª«îç à áè¨à¥¨ï å஬
echo Š«îç vkpatch-chrome-key.pem ©¤¥ %DEBUG%
set chrome_key=--pack-extension-key="%cd%\vkpatch-chrome-key.pem"
) else (
echo Š«îç vkpatch-chrome-key.pem ¥ ©¤¥ !!! %DEBUG%
)
%chrome% --pack-extension="%cd%\chrome extension" %chrome_key% --no-message-box
if EXIST "chrome extension.crx" (
move "chrome extension.crx" "%OUTPUT%\vkpatch-%version%-chrome.crx" %DEBUG%
echo Chrome extension done
) else (
echo Chrome extension failed !
)
rem ==================
rem Firefox
rem ==================
echo === Firefox === %DEBUG%
call :delete "%OUTPUT%\vkpatch-%version%-firefox.xpi"
7za a -tzip "%OUTPUT%\vkpatch-%version%-firefox.xpi" ".\firefox extension\*" %DEBUG%
if ERRORLEVEL 0 (
echo Firefox extension done
) else (
echo Firefox extension failed !
)
echo.
echo Complete
pause