forked from jetwhiz/encfs4win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bat
235 lines (157 loc) · 5.1 KB
/
build.bat
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
@ECHO OFF
REM build.bat
REM *****************************************************************************
REM Author: Charles Munson <[email protected]>
REM
REM ****************************************************************************
REM Copyright (c) 2016, Charles Munson
REM
REM This program is free software: you can redistribute it and/or modify it
REM under the terms of the GNU Lesser General Public License as published by the
REM Free Software Foundation, either version 3 of the License, or (at your
REM option) any later version.
REM
REM This program is distributed in the hope that it will be useful, but WITHOUT
REM ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
REM FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
REM for more details.
REM
REM You should have received a copy of the GNU Lesser General Public License
REM along with this program. If not, see <http://www.gnu.org/licenses/>.
REM Allow building of encfs4win 2.0
set ENCFS_MAJOR_VERSION=1
if /I "%1"=="--beta" set ENCFS_MAJOR_VERSION=2
REM Remember the PWD for encfs4win project
set PROJECT_DIR=%CD%
REM Make sure perl is installed
perl < nul
if NOT %ERRORLEVEL% == 0 goto :no_perl
REM MSYS is required to build libgcrypt, and we don't know where it is yet
if "%ENCFS_MAJOR_VERSION%"=="2" (
set MSYS_BIN_DIR=C:\MinGW\msys\1.0\bin
if NOT exist "%MSYS_BIN_DIR%\sh.exe" (
SET /P MSYS_BIN_DIR=Please input the path to your MSYS bin directory:
)
if NOT exist "%MSYS_BIN_DIR%\sh.exe" goto :no_msys
)
REM Make sure MSBUILD is available (and set up environmemt)
set DEPS_DIR=%CD%\deps
set VCPath=%PROGRAMFILES(x86)%\MSBuild\14.0\Bin
set PATH=%PATH%;%VCPath%
set VCTargetsPath=%PROGRAMFILES(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140
if NOT exist "%VCPath%\msbuild.exe" goto :no_msbuild
if NOT exist "%PROGRAMFILES(x86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" goto :no_msbuild
if not defined DevEnvDir (
call "%PROGRAMFILES(x86)%\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
)
REM openssl
call build-openssl.bat
if NOT %ERRORLEVEL% == 0 goto :no_openssl
REM libgpg-error
if "%ENCFS_MAJOR_VERSION%"=="2" (
call build-libgpgerror.bat
if NOT %ERRORLEVEL% == 0 goto :no_libgpgerror
)
REM libgcrypt
if "%ENCFS_MAJOR_VERSION%"=="2" (
call build-libgcrypt.bat
if NOT %ERRORLEVEL% == 0 goto :no_libgcrypt
)
REM dokany
call build-dokany.bat
if NOT %ERRORLEVEL% == 0 goto :no_dokany
REM boost library
call build-boost.bat
if NOT %ERRORLEVEL% == 0 goto :no_boost
if "%BOOST_ROOT%"=="" goto :no_boost
REM (Clean,)? Build encfs
echo.
echo ==================================================
echo BUILDING ENCFS
echo ==================================================
msbuild encfs/encfs.sln /p:Configuration=Release /p:Platform=x86 /t:Clean,Build
REM verify necessary executables were successfully installed
if NOT exist ".\encfs\Release\encfs.exe" goto :build_failure
if NOT exist ".\encfs\Release\encfsctl.exe" goto :build_failure
goto :build_success
:build_success
echo.
echo ==================================================
echo Encfs successfully built!
echo ==================================================
echo.
goto :end
:build_failure
echo.
echo ==================================================
echo Failed to build necessary Encfs!
echo ==================================================
echo.
exit /b 1
goto :end
:no_msbuild
echo.
echo ==================================================
echo MSBuild V140 is required to build this project!
echo ==================================================
echo.
exit /b 1
goto :end
:no_msys
echo.
echo ==================================================
echo MSYS is required to build this project!
echo ==================================================
echo.
exit /b 1
goto :end
:no_perl
echo.
echo ==================================================
echo Perl is required to build this project!
echo ==================================================
echo.
exit /b 1
goto :end
:no_openssl
echo.
echo ==================================================
echo OpenSSL could not be built, and is required!
echo ==================================================
echo.
exit /b 1
goto :end
:no_libgpgerror
echo.
echo ==================================================
echo libgpg-error could not be built, and is required!
echo ==================================================
echo.
exit /b 1
goto :end
:no_libgcrypt
echo.
echo ==================================================
echo libgcrypt could not be built, and is required!
echo ==================================================
echo.
exit /b 1
goto :end
:no_dokany
echo.
echo ==================================================
echo Dokany could not be built, and is required!
echo ==================================================
echo.
exit /b 1
goto :end
:no_boost
echo.
echo ==================================================
echo BOOST_ROOT not found - Boost libraries required!
echo ==================================================
echo.
exit /b 1
goto :end
:end
exit /b 0