Added build scripts for external libraries with MSYS

This commit is contained in:
thunder2 2016-08-28 22:28:51 +02:00
parent 3b37fcc4a8
commit 7ffe59cb2d
10 changed files with 894 additions and 71 deletions

6
win_build_libs/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/download
/msys
/libs
/tools/7z.dll
/tools/7z.exe
/tools/curl.exe

View File

@ -0,0 +1,43 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set SevenZipUrl=http://7-zip.org/a/7z1602.msi
set SevenZipInstall=7z1602.msi
set CurlUrl=https://bintray.com/artifact/download/vszakats/generic/curl-7.50.1-win32-mingw.7z
set CurlInstall=curl-7.50.1-win32-mingw.7z
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
call :remove_dir "%TempPath%"
echo Download installation files
if not exist "%DownloadPath%\%SevenZipInstall%" call "%ToolsPath%\winhttpjs.bat" %SevenZipUrl% -saveTo "%DownloadPath%\%SevenZipInstall%"
if not exist "%DownloadPath%\%SevenZipInstall%" echo Cannot download 7z& goto :exit
if not exist "%DownloadPath%\%CurlInstall%" call "%ToolsPath%\winhttpjs.bat" %CurlUrl% -saveTo "%DownloadPath%\%CurlInstall%"
if not exist "%DownloadPath%\%CurlInstall%" echo Cannot download Curl& goto :exit
echo Unpack 7z
msiexec /a "%DownloadPath%\%SevenZipInstall%" /qb TARGETDIR="%TempPath%"
copy "%TempPath%\Files\7-Zip\7z.dll" "%ToolsPath%"
copy "%TempPath%\Files\7-Zip\7z.exe" "%ToolsPath%"
call :remove_dir "%TempPath%"
echo Unpack Curl
"%SevenZipExe%" x -o"%TempPath%" "%DownloadPath%\%CurlInstall%"
copy "%TempPath%\curl-7.50.1-win32-mingw\bin\curl.exe" "%ToolsPath%"
call :remove_dir "%TempPath%"
:exit
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF

View File

@ -0,0 +1,70 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set MSYSInstall=mingw-get-0.6.2-mingw32-beta-20131004-1-bin.zip
set CMakeInstall=cmake-3.1.0-win32-x86.zip
set CMakeUnpackPath=%MSYSPath%\msys\1.0
if not exist "%DownloadPath%" mkdir "%DownloadPath%"
echo Check existing installation
if not exist "%MSYSPath%\bin\mingw-get.exe" goto proceed
choice /M "Found existing MSYS version. Do you want to proceed?"
if %ERRORLEVEL%==2 goto exit
:proceed
echo Remove previous MSYS version
call :remove_dir "%MSYSPath%"
echo Download installation files
if not exist "%DownloadPath%\%MSYSInstall%" "%CurlExe%" -L -k http://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/%MSYSInstall%/download -o "%DownloadPath%\%MSYSInstall%"
if not exist "%DownloadPath%%\MSYSInstall%" echo Cannot download MSYS& goto :exit
if not exist "%DownloadPath%\%CMakeInstall%" "%CurlExe%" -L -k http://www.cmake.org/files/v3.1/cmake-3.1.0-win32-x86.zip -o "%DownloadPath%\%CMakeInstall%"
if not exist "%DownloadPath%\%CMakeInstall%" echo Cannot download CMake& goto :exit
echo Unpack MSYS
"%SevenZipExe%" x -o"%MSYSPath%" "%DownloadPath%\%MSYSInstall%"
echo Install MSYS
if not exist "%MSYSPath%\var\lib\mingw-get\data\profile.xml" copy "%MSYSPath%\var\lib\mingw-get\data\defaults.xml" "%MSYSPath%\var\lib\mingw-get\data\profile.xml"
pushd "%MSYSPath%\bin"
mingw-get.exe install mingw32-mingw-get
mingw-get.exe install msys-coreutils
mingw-get.exe install msys-base
mingw-get.exe install msys-autoconf
mingw-get.exe install msys-automake
mingw-get.exe install msys-autogen
mingw-get.exe install msys-mktemp
mingw-get.exe install msys-wget
popd
echo Unpack CMake
"%SevenZipExe%" x -o"%CMakeUnpackPath%" "%DownloadPath%\%CMakeInstall%"
echo Install CMake
set CMakeVersion=
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" echo CMake version not found.& goto :exit
echo Found CMake version %CMakeVersion%
set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%MSYSPath%\msys\1.0\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%MSYSPath%\msys\1.0\etc\profile"
)
:exit
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF

View File

@ -0,0 +1,29 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
set MSYSSH=%MSYSPath%\msys\1.0\bin\sh.exe
set MSYSCurPath=/%CurPath:~0,1%/%CurPath:~3%
set MSYSCurPath=%MSYSCurPath:\=/%
if not exist "%MSYSSH%" echo Please install MSYS first.&& exit /B 1
set GCCPath=
call :FIND_IN_PATH g++.exe GCCPath
if "%GCCPath%"=="" echo Please run %~nx0 in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable.&& exit /B 1
"%MSYSSH%" --login -i -c "cd "%MSYSCurPath%" && make -f makefile %*"
exit /B %ERRORLEVEL%
:FIND_IN_PATH
SET PathTemp="%Path:;=";"%"
FOR %%P IN (%PathTemp%) DO (
IF EXIST "%%~P.\%~1" (
set %2=%%~P
goto :EOF
)
)

View File

@ -1,4 +1,3 @@
CURL=curl.exe
ZLIB_VERSION=1.2.3 ZLIB_VERSION=1.2.3
BZIP2_VERSION=1.0.6 BZIP2_VERSION=1.0.6
MINIUPNPC_VERSION=2.0 MINIUPNPC_VERSION=2.0
@ -17,31 +16,32 @@ FFMPEG_VERSION=3.1.2
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg copylibs
download: \ download: \
zlib-$(ZLIB_VERSION).tar.gz \ download/zlib-$(ZLIB_VERSION).tar.gz \
bzip2-$(BZIP2_VERSION).tar.gz \ download/bzip2-$(BZIP2_VERSION).tar.gz \
miniupnpc-$(MINIUPNPC_VERSION).tar.gz \ download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz \
openssl-$(OPENSSL_VERSION).tar.gz \ download/openssl-$(OPENSSL_VERSION).tar.gz \
speex-$(SPEEX_VERSION).tar.gz \ download/speex-$(SPEEX_VERSION).tar.gz \
speexdsp-$(SPEEXDSP_VERSION).tar.gz \ download/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
opencv-$(OPENCV_VERSION).tar.gz \ download/opencv-$(OPENCV_VERSION).tar.gz \
libxml2-$(LIBXML2_VERSION).tar.gz \ download/libxml2-$(LIBXML2_VERSION).tar.gz \
libxslt-$(LIBXSLT_VERSION).tar.gz \ download/libxslt-$(LIBXSLT_VERSION).tar.gz \
curl-$(CURL_VERSION).tar.gz \ download/curl-$(CURL_VERSION).tar.gz \
tcl$(TCL_VERSION)-src.tar.gz \ download/tcl$(TCL_VERSION)-src.tar.gz \
sqlcipher-$(SQLCIPHER_VERSION).tar.gz \ download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \ download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
ffmpeg-$(FFMPEG_VERSION).tar.gz download/ffmpeg-$(FFMPEG_VERSION).tar.gz
dirs: dirs:
mkdir -p download
mkdir -p libs/include mkdir -p libs/include
mkdir -p libs/lib mkdir -p libs/lib
mkdir -p libs/bin mkdir -p libs/bin
zlib-$(ZLIB_VERSION).tar.gz: download/zlib-$(ZLIB_VERSION).tar.gz:
$(CURL) -L -k http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -o zlib-$(ZLIB_VERSION).tar.gz wget --no-check-certificate http://sourceforge.net/projects/libpng/files/zlib/$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.gz/download -O download/zlib-$(ZLIB_VERSION).tar.gz
zlib: zlib-$(ZLIB_VERSION).tar.gz zlib: download/zlib-$(ZLIB_VERSION).tar.gz
tar xvf zlib-$(ZLIB_VERSION).tar.gz tar xvf download/zlib-$(ZLIB_VERSION).tar.gz
cd zlib-$(ZLIB_VERSION) && ./configure cd zlib-$(ZLIB_VERSION) && ./configure
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../libs" #cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../libs"
cd zlib-$(ZLIB_VERSION) && make cd zlib-$(ZLIB_VERSION) && make
@ -51,11 +51,11 @@ zlib: zlib-$(ZLIB_VERSION).tar.gz
rm -r -f zlib-$(ZLIB_VERSION) rm -r -f zlib-$(ZLIB_VERSION)
touch zlib touch zlib
bzip2-$(BZIP2_VERSION).tar.gz: download/bzip2-$(BZIP2_VERSION).tar.gz:
$(CURL) http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -o bzip2-$(BZIP2_VERSION).tar.gz wget http://bzip.org/$(BZIP2_VERSION)/bzip2-$(BZIP2_VERSION).tar.gz -O download/bzip2-$(BZIP2_VERSION).tar.gz
bzip2: bzip2-$(BZIP2_VERSION).tar.gz bzip2: download/bzip2-$(BZIP2_VERSION).tar.gz
tar xvf bzip2-$(BZIP2_VERSION).tar.gz tar xvf download/bzip2-$(BZIP2_VERSION).tar.gz
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../libs" #cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../libs"
cd bzip2-$(BZIP2_VERSION) && make cd bzip2-$(BZIP2_VERSION) && make
cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/include/ cp bzip2-$(BZIP2_VERSION)/bzlib.h libs/include/
@ -63,11 +63,11 @@ bzip2: bzip2-$(BZIP2_VERSION).tar.gz
rm -r -f bzip2-$(BZIP2_VERSION) rm -r -f bzip2-$(BZIP2_VERSION)
touch bzip2 touch bzip2
miniupnpc-$(MINIUPNPC_VERSION).tar.gz: download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
$(CURL) -L http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -o miniupnpc-$(MINIUPNPC_VERSION).tar.gz wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
miniupnpc: miniupnpc-$(MINIUPNPC_VERSION).tar.gz miniupnpc: download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
tar xvf miniupnpc-$(MINIUPNPC_VERSION).tar.gz tar xvf download/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
cd miniupnpc-$(MINIUPNPC_VERSION) && CC=gcc && export CC && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll cd miniupnpc-$(MINIUPNPC_VERSION) && CC=gcc && export CC && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
mkdir -p libs/include/miniupnpc && cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/include/miniupnpc/ mkdir -p libs/include/miniupnpc && cp miniupnpc-$(MINIUPNPC_VERSION)/*.h libs/include/miniupnpc/
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/lib/ cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib libs/lib/
@ -75,11 +75,11 @@ miniupnpc: miniupnpc-$(MINIUPNPC_VERSION).tar.gz
rm -r -f miniupnpc-$(MINIUPNPC_VERSION) rm -r -f miniupnpc-$(MINIUPNPC_VERSION)
touch miniupnpc touch miniupnpc
openssl-$(OPENSSL_VERSION).tar.gz: download/openssl-$(OPENSSL_VERSION).tar.gz:
$(CURL) -k https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -o openssl-$(OPENSSL_VERSION).tar.gz wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O download/openssl-$(OPENSSL_VERSION).tar.gz
openssl: openssl-$(OPENSSL_VERSION).tar.gz openssl: download/openssl-$(OPENSSL_VERSION).tar.gz
tar xvf openssl-$(OPENSSL_VERSION).tar.gz tar xvf download/openssl-$(OPENSSL_VERSION).tar.gz
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs" #cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../libs"
#cd openssl-$(OPENSSL_VERSION) && make install #cd openssl-$(OPENSSL_VERSION) && make install
cd openssl-$(OPENSSL_VERSION) && ./config shared cd openssl-$(OPENSSL_VERSION) && ./config shared
@ -92,11 +92,11 @@ openssl: openssl-$(OPENSSL_VERSION).tar.gz
rm -r -f openssl-$(OPENSSL_VERSION) rm -r -f openssl-$(OPENSSL_VERSION)
touch openssl touch openssl
speex-$(SPEEX_VERSION).tar.gz: download/speex-$(SPEEX_VERSION).tar.gz:
$(CURL) http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -o speex-$(SPEEX_VERSION).tar.gz wget http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O download/speex-$(SPEEX_VERSION).tar.gz
speex: speex-$(SPEEX_VERSION).tar.gz speex: download/speex-$(SPEEX_VERSION).tar.gz
tar xvf speex-$(SPEEX_VERSION).tar.gz tar xvf download/speex-$(SPEEX_VERSION).tar.gz
cd speex-$(SPEEX_VERSION) && ./configure cd speex-$(SPEEX_VERSION) && ./configure
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../libs" #cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../libs"
cd speex-$(SPEEX_VERSION) && make cd speex-$(SPEEX_VERSION) && make
@ -105,11 +105,11 @@ speex: speex-$(SPEEX_VERSION).tar.gz
rm -r -f speex-$(SPEEX_VERSION) rm -r -f speex-$(SPEEX_VERSION)
touch speex touch speex
speexdsp-$(SPEEXDSP_VERSION).tar.gz: download/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
$(CURL) http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -o speexdsp-$(SPEEXDSP_VERSION).tar.gz wget http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
speexdsp: speexdsp-$(SPEEXDSP_VERSION).tar.gz speexdsp: download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
tar xvf speexdsp-$(SPEEXDSP_VERSION).tar.gz tar xvf download/speexdsp-$(SPEEXDSP_VERSION).tar.gz
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
cd speexdsp-$(SPEEXDSP_VERSION) && make cd speexdsp-$(SPEEXDSP_VERSION) && make
mkdir -p libs/include/speex && cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/include/speex/ mkdir -p libs/include/speex && cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h libs/include/speex/
@ -117,11 +117,11 @@ speexdsp: speexdsp-$(SPEEXDSP_VERSION).tar.gz
rm -r -f speexdsp-$(SPEEXDSP_VERSION) rm -r -f speexdsp-$(SPEEXDSP_VERSION)
touch speexdsp touch speexdsp
opencv-$(OPENCV_VERSION).tar.gz: download/opencv-$(OPENCV_VERSION).tar.gz:
$(CURL) -L -k https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -o opencv-$(OPENCV_VERSION).tar.gz wget --no-check-certificate https://github.com/Itseez/opencv/archive/$(OPENCV_VERSION).tar.gz -O download/opencv-$(OPENCV_VERSION).tar.gz
opencv: opencv-$(OPENCV_VERSION).tar.gz opencv: download/opencv-$(OPENCV_VERSION).tar.gz
tar xvf opencv-$(OPENCV_VERSION).tar.gz tar xvf download/opencv-$(OPENCV_VERSION).tar.gz
mkdir -p opencv-$(OPENCV_VERSION)/build mkdir -p opencv-$(OPENCV_VERSION)/build
#cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs" #cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/../../libs"
cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install" cd opencv-$(OPENCV_VERSION)/build && cmake .. -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_PERF_TESTS=OFF -DBUILD_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX="`pwd`/install"
@ -131,11 +131,11 @@ opencv: opencv-$(OPENCV_VERSION).tar.gz
rm -r -f opencv-$(OPENCV_VERSION) rm -r -f opencv-$(OPENCV_VERSION)
touch opencv touch opencv
libxml2-$(LIBXML2_VERSION).tar.gz: download/libxml2-$(LIBXML2_VERSION).tar.gz:
$(CURL) ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -o libxml2-$(LIBXML2_VERSION).tar.gz wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O download/libxml2-$(LIBXML2_VERSION).tar.gz
libxml2: libxml2-$(LIBXML2_VERSION).tar.gz libxml2: download/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf libxml2-$(LIBXML2_VERSION).tar.gz tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../libs" #cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../libs"
cd libxml2-$(LIBXML2_VERSION) && make cd libxml2-$(LIBXML2_VERSION) && make
@ -143,12 +143,12 @@ libxml2: libxml2-$(LIBXML2_VERSION).tar.gz
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/lib/ cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a libs/lib/
touch libxml2 touch libxml2
libxslt-$(LIBXSLT_VERSION).tar.gz: download/libxslt-$(LIBXSLT_VERSION).tar.gz:
$(CURL) ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -o libxslt-$(LIBXSLT_VERSION).tar.gz wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O download/libxslt-$(LIBXSLT_VERSION).tar.gz
libxslt: libxml2-$(LIBXML2_VERSION).tar.gz libxslt-$(LIBXSLT_VERSION).tar.gz libxslt: download/libxml2-$(LIBXML2_VERSION).tar.gz download/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf libxml2-$(LIBXML2_VERSION).tar.gz tar xvf download/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf libxslt-$(LIBXSLT_VERSION).tar.gz tar xvf download/libxslt-$(LIBXSLT_VERSION).tar.gz
tar xvf libxslt-$(LIBXSLT_VERSION)-fix.tar.gz tar xvf libxslt-$(LIBXSLT_VERSION)-fix.tar.gz
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make cd libxslt-$(LIBXSLT_VERSION) && make
@ -159,11 +159,11 @@ libxslt: libxml2-$(LIBXML2_VERSION).tar.gz libxslt-$(LIBXSLT_VERSION).tar.gz
rm -r -f libxslt-$(LIBXSLT_VERSION) rm -r -f libxslt-$(LIBXSLT_VERSION)
touch libxslt touch libxslt
curl-$(CURL_VERSION).tar.gz: download/curl-$(CURL_VERSION).tar.gz:
$(CURL) -L -k http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -o curl-$(CURL_VERSION).tar.gz wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O download/curl-$(CURL_VERSION).tar.gz
curl: curl-$(CURL_VERSION).tar.gz curl: download/curl-$(CURL_VERSION).tar.gz
tar xvf curl-$(CURL_VERSION).tar.gz tar xvf download/curl-$(CURL_VERSION).tar.gz
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs" cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../libs"
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../libs" #cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../libs"
cd curl-$(CURL_VERSION) && make cd curl-$(CURL_VERSION) && make
@ -172,20 +172,20 @@ curl: curl-$(CURL_VERSION).tar.gz
rm -r -f curl-$(CURL_VERSION) rm -r -f curl-$(CURL_VERSION)
touch curl touch curl
tcl$(TCL_VERSION)-src.tar.gz: download/tcl$(TCL_VERSION)-src.tar.gz:
$(CURL) -L http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -o tcl$(TCL_VERSION)-src.tar.gz wget http://prdownloads.sourceforge.net/tcl/tcl$(TCL_VERSION)-src.tar.gz -O download/tcl$(TCL_VERSION)-src.tar.gz
sqlcipher-$(SQLCIPHER_VERSION).tar.gz: download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
$(CURL) -L -k https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -o sqlcipher-$(SQLCIPHER_VERSION).tar.gz wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
sqlcipher: tcl$(TCL_VERSION)-src.tar.gz sqlcipher-$(SQLCIPHER_VERSION).tar.gz sqlcipher: download/tcl$(TCL_VERSION)-src.tar.gz download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
# tcl # tcl
tar xvf tcl$(TCL_VERSION)-src.tar.gz tar xvf download/tcl$(TCL_VERSION)-src.tar.gz
mkdir -p tcl$(TCL_VERSION)/build mkdir -p tcl$(TCL_VERSION)/build
cd tcl$(TCL_VERSION)/build && ../win/configure cd tcl$(TCL_VERSION)/build && ../win/configure
cd tcl$(TCL_VERSION)/build && make cd tcl$(TCL_VERSION)/build && make
#sqlcipher #sqlcipher
tar xvf sqlcipher-$(SQLCIPHER_VERSION).tar.gz tar xvf download/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh
mkdir -p tcl$(TCL_VERSION)/lib mkdir -p tcl$(TCL_VERSION)/lib
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6 ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
@ -197,21 +197,21 @@ sqlcipher: tcl$(TCL_VERSION)-src.tar.gz sqlcipher-$(SQLCIPHER_VERSION).tar.gz
rm -r -f tcl$(TCL_VERSION) rm -r -f tcl$(TCL_VERSION)
touch sqlcipher touch sqlcipher
libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz: download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
$(CURL) -L -k http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -o libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
libmicrohttpd: libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz libmicrohttpd: download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
tar xvf libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz tar xvf download/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs" cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../libs"
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION) rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
touch libmicrohttpd touch libmicrohttpd
ffmpeg-$(FFMPEG_VERSION).tar.gz: download/ffmpeg-$(FFMPEG_VERSION).tar.gz:
$(CURL) -L -k https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -o ffmpeg-$(FFMPEG_VERSION).tar.gz wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O download/ffmpeg-$(FFMPEG_VERSION).tar.gz
ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz ffmpeg: download/ffmpeg-$(FFMPEG_VERSION).tar.gz
tar xvf ffmpeg-$(FFMPEG_VERSION).tar.gz tar xvf download/ffmpeg-$(FFMPEG_VERSION).tar.gz
cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs" cd ffmpeg-$(FFMPEG_VERSION) && ./configure --disable-shared --enable-static --disable-programs --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-yasm --disable-everything --enable-encoder=mpeg4 --enable-decoder=mpeg4 --prefix="`pwd`/../libs"
cd ffmpeg-$(FFMPEG_VERSION) && make install cd ffmpeg-$(FFMPEG_VERSION) && make install
rm -r -f ffmpeg-$(FFMPEG_VERSION) rm -r -f ffmpeg-$(FFMPEG_VERSION)

View File

@ -0,0 +1,584 @@
@if (@X) == (@Y) @end /* JScript comment
@echo off
rem :: the first argument is the script name as it will be used for proper help message
cscript //E:JScript //nologo "%~f0" "%~nx0" %*
exit /b %errorlevel%
@if (@X)==(@Y) @end JScript comment */
// used resources
// update 12.10.15
// osvikvi(https://github.com/osvikvi) has nodited that the -password option is not set , so this is fixed
//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384058(v=vs.85).aspx
//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384055(v=vs.85).aspx
//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384059(v=vs.85).aspx
// global variables and constants
// ----------------------------------
// -- asynch requests not included --
// ----------------------------------
//todo - save responceStream instead of responceBody !!
//todo - set all winthttp options ->//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx
//todo - log all options
//todo - improve help message . eventual verbose option
var ARGS = WScript.Arguments;
var scriptName = ARGS.Item(0);
var url = "";
var saveTo = "";
var user = 0;
var pass = 0;
var proxy = 0;
var bypass = 0;
var proxy_user = 0;
var proxy_pass = 0;
var certificate = 0;
var force = true;
var body = "";
//ActiveX objects
var WinHTTPObj = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
var FileSystemObj = new ActiveXObject("Scripting.FileSystemObject");
var AdoDBObj = new ActiveXObject("ADODB.Stream");
// HttpRequest SetCredentials flags.
var proxy_settings = 0;
//
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0;
HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1;
//timeouts and their default values
var RESOLVE_TIMEOUT = 0;
var CONNECT_TIMEOUT = 90000;
var SEND_TIMEOUT = 90000;
var RECEIVE_TIMEOUT = 90000;
//HttpRequestMethod
var http_method = 'GET';
//header
var header_file = "";
//report
var reportfile = "";
//test-this:
var use_stream = false;
//autologon policy
var autologon_policy = 1; //0,1,2
//headers will be stored as multi-dimensional array
var headers = [];
//user-agent
var ua = "";
//escape URL
var escape = false;
function printHelp() {
WScript.Echo(scriptName + " - sends HTTP request and saves the request body as a file and/or a report of the sent request");
WScript.Echo(scriptName + " url [-force yes|no] [-user username -password password] [-proxy proxyserver:port] [-bypass bypass_list]");
WScript.Echo(" [-proxyuser proxy_username -proxypassword proxy_password] [-certificate certificateString]");
WScript.Echo(" [-method GET|POST|PATCH|DELETE|HEAD|OPTIONS|CONNECT]");
WScript.Echo(" [-saveTo file] - to print response to console use con");
WScript.Echo(" [-sendTimeout int(milliseconds)]");
WScript.Echo(" [-resolveTimeout int(milliseconds)]");
WScript.Echo(" [-connectTimeout int(milliseconds)]");
WScript.Echo(" [-receiveTimeout int(milliseconds)]");
WScript.Echo(" [-autologonPolicy 1|2|3]");
WScript.Echo(" [-proxySettings 1|2|3] (https://msdn.microsoft.com/en-us/library/windows/desktop/aa384059(v=vs.85).aspx)");
//header
WScript.Echo(" [-headers-file header_file]");
//reportfile
WScript.Echo(" [-reportfile reportfile]");
WScript.Echo(" [-ua user-agent]");
WScript.Echo(" [-ua-file user-agent-file]");
WScript.Echo(" [-escape yes|no]");
WScript.Echo(" [-body body-string]");
WScript.Echo(" [-body-file body-file]");
WScript.Echo("-force - decide to not or to overwrite if the local files exists");
WScript.Echo("proxyserver:port - the proxy server");
WScript.Echo("bypass- bypass list");
WScript.Echo("proxy_user , proxy_password - credentials for proxy server");
WScript.Echo("user , password - credentials for the server");
WScript.Echo("certificate - location of SSL certificate");
WScript.Echo("method - what HTTP method will be used.Default is GET");
WScript.Echo("saveTo - save the responce as binary file");
WScript.Echo(" ");
WScript.Echo("Header file should contain key:value pairs.Lines starting with \"#\" will be ignored.");
WScript.Echo("value should NOT be enclosed with quotes");
WScript.Echo(" ");
WScript.Echo("Examples:");
WScript.Echo(scriptName + " http://somelink.com/somefile.zip -saveTo c:\\somefile.zip -certificate \"LOCAL_MACHINE\\Personal\\My Middle-Tier Certificate\"");
WScript.Echo(scriptName + " http://somelink.com/something.html -method POST -certificate \"LOCAL_MACHINE\\Personal\\My Middle-Tier Certificate\" -header c:\\header_file -reportfile c:\\reportfile.txt");
WScript.Echo(scriptName + "\"http://somelink\" -method POST -header hdrs.txt -reportfile reportfile2.txt -saveTo responsefile2 -ua \"Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36\" -body-file some.json");
}
function parseArgs() {
//
if (ARGS.Length < 2) {
WScript.Echo("insufficient arguments");
printHelp();
WScript.Quit(43);
}
// !!!
url = ARGS.Item(1);
// !!!
if (ARGS.Length % 2 != 0) {
WScript.Echo("illegal arguments");
printHelp();
WScript.Quit(44);
}
for (var i = 2; i < ARGS.Length - 1; i = i + 2) {
var arg = ARGS.Item(i).toLowerCase();
var next = ARGS.Item(i + 1);
try {
switch (arg) { // the try-catch is set mainly because of the parseInts
case "-force":
if (next == "no") {
force = false;
}
break;
case "-escape":
if (next == "yes") {
escape = true;
}
break;
case "-saveto":
saveTo = next;
break;
case "-user":
case "-u":
user = next;
break;
case "-pass":
case "-password":
case "-p":
pass = next;
break;
case "-proxy":
proxy = next;
break;
case "-bypass":
bypass = next;
break;
case "-proxyuser":
case "-pu":
proxy_user = next;
break;
case "-proxypassword":
case "-pp":
proxy_pass = next;
break;
case "-ua":
ua = next;
break;
case "-ua-file":
ua = readFile(next);
break;
case "-body":
body = next;
break;
case "-usestream":
//WScript.Echo("~~");
if (next.toLowerCase() === "yes") {
use_stream = true
};
break;
case "-body-file":
body = readFile(next);
break;
case "-certificate":
certificate = next;
break;
case "-method":
switch (next.toLowerCase()) {
case "post":
http_method = 'POST';
break;
case "get":
http_method = 'GET';
break;
case "head":
http_method = 'HEAD';
break;
case "put":
http_method = 'PUT';
break;
case "options":
http_method = 'OPTIONS';
break;
case "connect":
http_method = 'CONNECT';
break;
case "patch":
http_method = 'PATCH';
break;
case "delete":
http_method = 'DELETE';
break;
default:
WScript.Echo("Invalid http method passed " + next);
WScript.Echo("possible values are GET,POST,DELETE,PUT,CONNECT,PATCH,HEAD,OPTIONS");
WScript.Quit(1326);
break;
}
break;
case "-headers-file":
case "-header":
headers = readPropFile(next);
break;
case "-reportfile":
reportfile = next;
break;
//timeouts
case "-sendtimeout":
SEND_TIMEOUT = parseInt(next);
break;
case "-connecttimeout":
CONNECT_TIMEOUT = parseint(next);
break;
case "-resolvetimeout":
RESOLVE_TIMEOUT = parseInt(next);
break;
case "-receivetimeout":
RECEIVE_TIMEOUT = parseInt(next);
break;
case "-autologonpolicy":
autologon_policy = parseInt(next);
if (autologon_policy > 2 || autologon_policy < 0) {
WScript.Echo("out of autologon policy range");
WScript.Quit(87);
};
break;
case "-proxysettings":
proxy_settings = parseInt(next);
if (proxy_settings > 2 || proxy_settings < 0) {
WScript.Echo("out of proxy settings range");
WScript.Quit(87);
};
break;
default:
WScript.Echo("Invalid command line switch: " + arg);
WScript.Quit(1405);
break;
}
} catch (err) {
WScript.Echo(err.message);
WScript.Quit(1348);
}
}
}
stripTrailingSlash = function(path) {
while (path.substr(path.length - 1, path.length) == '\\') {
path = path.substr(0, path.length - 1);
}
return path;
}
function existsItem(path) {
return FileSystemObj.FolderExists(path) || FileSystemObj.FileExists(path);
}
function deleteItem(path) {
if (FileSystemObj.FileExists(path)) {
FileSystemObj.DeleteFile(path);
return true;
} else if (FileSystemObj.FolderExists(path)) {
FileSystemObj.DeleteFolder(stripTrailingSlash(path));
return true;
} else {
return false;
}
}
//-------------------------------
//----------------------
//----------
//-----
//--
function request(url) {
try {
WinHTTPObj.Open(http_method, url, false);
if (proxy != 0 && bypass != 0) {
WinHTTPObj.SetProxy(proxy_settings, proxy, bypass);
}
if (proxy != 0) {
WinHTTPObj.SetProxy(proxy_settings, proxy);
}
if (user != 0 && pass != 0) {
WinHTTPObj.SetCredentials(user, pass, HTTPREQUEST_SETCREDENTIALS_FOR_SERVER);
}
if (proxy_user != 0 && proxy_pass != 0) {
WinHTTPObj.SetCredentials(proxy_user, proxy_pass, HTTPREQUEST_SETCREDENTIALS_FOR_PROXY);
}
if (certificate != 0) {
WinHTTPObj.SetClientCertificate(certificate);
}
//set autologin policy
WinHTTPObj.SetAutoLogonPolicy(autologon_policy);
//set timeouts
WinHTTPObj.SetTimeouts(RESOLVE_TIMEOUT, CONNECT_TIMEOUT, SEND_TIMEOUT, RECEIVE_TIMEOUT);
if (headers.length !== 0) {
WScript.Echo("Sending with headers:");
for (var i = 0; i < headers.length; i++) {
WinHTTPObj.SetRequestHeader(headers[i][0], headers[i][1]);
WScript.Echo(headers[i][0] + ":" + headers[i][1]);
}
WScript.Echo("");
}
if (ua !== "") {
//user-agent option from:
//WinHttpRequestOption enumeration
// other options can be added like bellow
//https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx
WinHTTPObj.Option(0) = ua;
}
if (escape) {
WinHTTPObj.Option(3) = true;
}
if (trim(body) === "") {
WinHTTPObj.Send();
} else {
WinHTTPObj.Send(body);
}
var status = WinHTTPObj.Status
} catch (err) {
WScript.Echo(err.message);
WScript.Quit(666);
}
////////////////////////
// report //
////////////////////////
if (reportfile != "") {
//var report_string="";
var n = "\r\n";
var report_string = "Status:" + n;
report_string = report_string + " " + WinHTTPObj.Status;
report_string = report_string + " " + WinHTTPObj.StatusText + n;
report_string = report_string + " " + n;
report_string = report_string + "Response:" + n;
report_string = report_string + WinHTTPObj.ResponseText + n;
report_string = report_string + " " + n;
report_string = report_string + "Headers:" + n;
report_string = report_string + WinHTTPObj.GetAllResponseHeaders() + n;
WinHttpRequestOption_UserAgentString = 0; // Name of the user agent
WinHttpRequestOption_URL = 1; // Current URL
WinHttpRequestOption_URLCodePage = 2; // Code page
WinHttpRequestOption_EscapePercentInURL = 3; // Convert percents
// in the URL
// rest of the options can be seen and eventually added using this as reference
// https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx
report_string = report_string + "URL:" + n;
report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_URL) + n;
report_string = report_string + "URL Code Page:" + n;
report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_URLCodePage) + n;
report_string = report_string + "User Agent:" + n;
report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_UserAgentString) + n;
report_string = report_string + "Escapped URL:" + n;
report_string = report_string + WinHTTPObj.Option(WinHttpRequestOption_EscapePercentInURL) + n;
prepareateFile(force, reportfile);
WScript.Echo("Writing report to " + reportfile);
writeFile(reportfile, report_string);
}
switch (status) {
case 200:
WScript.Echo("Status: 200 OK");
break;
default:
WScript.Echo("Status: " + status);
WScript.Echo("Status was not OK. More info -> https://en.wikipedia.org/wiki/List_of_HTTP_status_codes");
}
//if as binary
if (saveTo.toLowerCase() === "con") {
WScript.Echo(WinHTTPObj.ResponseText);
}
if (saveTo !== "" && saveTo.toLowerCase() !== "con") {
prepareateFile(force, saveTo);
try {
if (use_stream) {
writeBinFile(saveTo, WinHTTPObj.ResponseStream);
} else {
writeBinFile(saveTo, WinHTTPObj.ResponseBody);
}
} catch (err) {
WScript.Echo("Failed to save the file as binary.Attempt to save it as text");
AdoDBObj.Close();
prepareateFile(true, saveTo);
writeFile(saveTo, WinHTTPObj.ResponseText);
}
}
WScript.Quit(status);
}
//--
//-----
//----------
//----------------------
//-------------------------------
function prepareateFile(force, file) {
if (force && existsItem(file)) {
if (!deleteItem(file)) {
WScript.Echo("Unable to delete " + file);
WScript.Quit(8);
}
} else if (existsItem(file)) {
WScript.Echo("Item " + file + " already exist");
WScript.Quit(9);
}
}
function writeBinFile(fileName, data) {
AdoDBObj.Type = 1;
AdoDBObj.Open();
AdoDBObj.Position = 0;
AdoDBObj.Write(data);
AdoDBObj.SaveToFile(fileName, 2);
AdoDBObj.Close();
}
function writeFile(fileName, data) {
AdoDBObj.Type = 2;
AdoDBObj.CharSet = "iso-8859-1";
AdoDBObj.Open();
AdoDBObj.Position = 0;
AdoDBObj.WriteText(data);
AdoDBObj.SaveToFile(fileName, 2);
AdoDBObj.Close();
}
function readFile(fileName) {
//check existence
try {
if (!FileSystemObj.FileExists(fileName)) {
WScript.Echo("file " + fileName + " does not exist!");
WScript.Quit(13);
}
if (FileSystemObj.GetFile(fileName).Size === 0) {
return "";
}
var fileR = FileSystemObj.OpenTextFile(fileName, 1);
var content = fileR.ReadAll();
fileR.Close();
return content;
} catch (err) {
WScript.Echo("Error while reading file: " + fileName);
WScript.Echo(err.message);
WScript.Echo("Will return empty string");
return "";
}
}
function readPropFile(fileName) {
//check existence
resultArray = [];
if (!FileSystemObj.FileExists(fileName)) {
WScript.Echo("(headers)file " + fileName + " does not exist!");
WScript.Quit(15);
}
if (FileSystemObj.GetFile(fileName).Size === 0) {
return resultArray;
}
var fileR = FileSystemObj.OpenTextFile(fileName, 1);
var line = "";
var k = "";
var v = "";
var lineN = 0;
var index = 0;
try {
WScript.Echo("parsing headers form " + fileName + " property file ");
while (!fileR.AtEndOfStream) {
line = fileR.ReadLine();
lineN++;
index = line.indexOf(":");
if (line.indexOf("#") === 0 || trim(line) === "") {
continue;
}
if (index === -1 || index === line.length - 1 || index === 0) {
WScript.Echo("Invalid line " + lineN);
WScript.Quit(93);
}
k = trim(line.substring(0, index));
v = trim(line.substring(index + 1, line.length));
resultArray.push([k, v]);
}
fileR.Close();
return resultArray;
} catch (err) {
WScript.Echo("Error while reading headers file: " + fileName);
WScript.Echo(err.message);
WScript.Echo("Will return empty array");
return resultArray;
}
}
function trim(str) {
return str.replace(/^\s+/, '').replace(/\s+$/, '');
}
function main() {
parseArgs();
request(url);
}
main();

9
win_build_libs/_env.bat Normal file
View File

@ -0,0 +1,9 @@
set CurPath=%~dp0
set DownloadPath=%CurPath%download
set ToolsPath=%CurPath%tools
set TempPath=%CurPath%tmp
set MSYSPath=%CurPath%msys
set LibsPath=%CurPath%libs
set CurlExe=%ToolsPath%\curl.exe
set SevenZipExe=%ToolsPath%\7z.exe

View File

@ -0,0 +1,30 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
::call :remove_dir "%DownloadPath%"
call :remove_dir "%MSYSPath%"
call :remove_dir "%TempPath%"
call :remove_file "%ToolsPath%\7z.exe"
call :remove_file "%ToolsPath%\7z.dll"
call :remove_file "%ToolsPath%\curl.exe"
call "%~dp0clean.bat"
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF
:remove_file
if not exist %1 goto :EOF
del /q %1 >nul
goto :EOF

36
win_build_libs/clean.bat Normal file
View File

@ -0,0 +1,36 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
call :remove_dir "%LibsPath%"
call :remove_file "%CurPath%bzip2"
call :remove_file "%CurPath%curl"
call :remove_file "%CurPath%ffmpeg"
call :remove_file "%CurPath%libmicrohttpd"
call :remove_file "%CurPath%libxml2"
call :remove_file "%CurPath%libxslt"
call :remove_file "%CurPath%miniupnpc"
call :remove_file "%CurPath%opencv"
call :remove_file "%CurPath%openssl"
call :remove_file "%CurPath%speex"
call :remove_file "%CurPath%speexdsp"
call :remove_file "%CurPath%sqlcipher"
call :remove_file "%CurPath%zlib"
endlocal
exit /B 0
:remove_dir
if not exist %1 goto :EOF
del /s /f /q %1 >nul
rmdir /s /q %1
goto :EOF
:remove_file
if not exist %1 goto :EOF
del /q %1 >nul
goto :EOF

View File

@ -0,0 +1,16 @@
@setlocal
@echo off
:: Initialize environment
call "%~dp0_env.bat"
if not exist "%MSYSPath%\bin\mingw-get.exe" exit /B 0
echo Update MSYS
pushd "%MSYSPath%\bin"
mingw-get.exe update
mingw-get.exe upgrade
popd
exit /B %ERRORLEVEL%