Use MSYS2 to build external libraries for Windows compile

This commit is contained in:
thunder2 2017-02-27 08:16:48 +01:00
parent 096c996153
commit ef03b12956
10 changed files with 647 additions and 13 deletions

View File

@ -0,0 +1,396 @@
ZLIB_VERSION=1.2.3
BZIP2_VERSION=1.0.6
MINIUPNPC_VERSION=2.0
OPENSSL_VERSION=1.1.1g
SPEEX_VERSION=1.2.0
SPEEXDSP_VERSION=1.2rc3
OPENCV_VERSION=3.4.11
LIBXML2_VERSION=2.9.7
LIBXSLT_VERSION=1.1.32
CURL_VERSION=7.58.0
TCL_VERSION=8.6.10
SQLCIPHER_VERSION=4.4.0
LIBMICROHTTPD_VERSION=0.9.59
FFMPEG_VERSION=3.4
RAPIDJSON_VERSION=1.1.0
XAPIAN_VERSION=1.4.7
DOWNLOAD_PATH?=download
BUILD_PATH=build
LIBS_PATH?=libs
all: dirs zlib bzip2 miniupnpc openssl speex speexdsp opencv libxml2 libxslt curl sqlcipher libmicrohttpd ffmpeg rapidjson xapian copylibs
download: \
$(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz \
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz \
$(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz \
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz \
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz \
$(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz \
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz \
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz \
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz \
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz \
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz \
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz \
$(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
clean:
rm -r -f $(BUILD_PATH)
rm -r -f $(LIBS_PATH)
dirs:
mkdir -p $(DOWNLOAD_PATH)
mkdir -p $(BUILD_PATH)
gcc --version | head --lines 1 | tr ' ' '\n' | tail -1 >$(BUILD_PATH)/gcc-version
$(DOWNLOAD_PATH)/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_PATH)/zlib-$(ZLIB_VERSION).tar.gz
zlib: $(BUILD_PATH)/zlib-$(ZLIB_VERSION)
$(BUILD_PATH)/zlib-$(ZLIB_VERSION): $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/zlib-*
tar xvf $(DOWNLOAD_PATH)/zlib-$(ZLIB_VERSION).tar.gz
# build
cd zlib-$(ZLIB_VERSION) && ./configure
#cd zlib-$(ZLIB_VERSION) && make install prefix="`pwd`/../$(BUILD_PATH)"
cd zlib-$(ZLIB_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include
cp zlib-$(ZLIB_VERSION)/zlib.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/
cp zlib-$(ZLIB_VERSION)/zconf.h $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/include/
mkdir -p $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/lib
cp zlib-$(ZLIB_VERSION)/libz.a $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp/lib/
# cleanup
rm -r -f zlib-$(ZLIB_VERSION)
mv $(BUILD_PATH)/zlib-$(ZLIB_VERSION).tmp $(BUILD_PATH)/zlib-$(ZLIB_VERSION)
bzip2: $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
$(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz:
wget https://sourceforge.net/projects/bzip2/files/bzip2-$(BZIP2_VERSION).tar.gz/download -O $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
$(BUILD_PATH)/bzip2-$(BZIP2_VERSION): $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/bzip2-*
tar xvf $(DOWNLOAD_PATH)/bzip2-$(BZIP2_VERSION).tar.gz
# build
#cd bzip2-$(BZIP2_VERSION) && make install PREFIX="`pwd`/../$(BUILD_PATH)"
cd bzip2-$(BZIP2_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include
cp bzip2-$(BZIP2_VERSION)/bzlib.h $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/include/
mkdir -p $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/lib
cp bzip2-$(BZIP2_VERSION)/libbz2.a $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp/lib/
# cleanup
rm -r -f bzip2-$(BZIP2_VERSION)
mv $(BUILD_PATH)/bzip2-$(BZIP2_VERSION).tmp $(BUILD_PATH)/bzip2-$(BZIP2_VERSION)
miniupnpc: $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION)
$(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz:
wget http://miniupnp.free.fr/files/download.php?file=miniupnpc-$(MINIUPNPC_VERSION).tar.gz -O $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
$(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION): $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/miniupnpc-*
tar xvf $(DOWNLOAD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tar.gz
# build
cd miniupnpc-$(MINIUPNPC_VERSION) && export CC=gcc && export PATH=.:$$PATH && make -f Makefile.mingw init libminiupnpc.a miniupnpc.dll
# copy files
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc
cp miniupnpc-$(MINIUPNPC_VERSION)/*.h $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/include/miniupnpc/
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.lib $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/lib/
mkdir -p $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin
cp miniupnpc-$(MINIUPNPC_VERSION)/miniupnpc.dll $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp/bin/
# cleanup
rm -r -f miniupnpc-$(MINIUPNPC_VERSION)
mv $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION).tmp $(BUILD_PATH)/miniupnpc-$(MINIUPNPC_VERSION)
openssl: $(BUILD_PATH)/openssl-$(OPENSSL_VERSION)
$(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz:
wget --no-check-certificate https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
$(BUILD_PATH)/openssl-$(OPENSSL_VERSION): $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/openssl-*
tar xvf $(DOWNLOAD_PATH)/openssl-$(OPENSSL_VERSION).tar.gz
# build
#cd openssl-$(OPENSSL_VERSION) && ./config --prefix="`pwd`/../$(BUILD_PATH)"
#cd openssl-$(OPENSSL_VERSION) && make install
cd openssl-$(OPENSSL_VERSION) && ./config shared
cd openssl-$(OPENSSL_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl
cp openssl-$(OPENSSL_VERSION)/include/openssl/*.h $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/include/openssl/
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin
if [ $(MSYSTEM) = "MINGW32" ] ; then cp openssl-$(OPENSSL_VERSION)/libcrypto-1_1.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/ ; fi
if [ $(MSYSTEM) = "MINGW32" ] ; then cp openssl-$(OPENSSL_VERSION)/libcrypto-1_1.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/ ; fi
if [ $(MSYSTEM) = "MINGW32" ] ; then cp openssl-$(OPENSSL_VERSION)/libssl-1_1.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/ ; fi
if [ $(MSYSTEM) = "MINGW64" ] ; then cp openssl-$(OPENSSL_VERSION)/libcrypto-1_1-x64.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/ ; fi
if [ $(MSYSTEM) = "MINGW64" ] ; then cp openssl-$(OPENSSL_VERSION)/libssl-1_1-x64.dll $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/bin/ ; fi
mkdir -p $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib
cp openssl-$(OPENSSL_VERSION)/libcrypto.dll.a $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib/
cp openssl-$(OPENSSL_VERSION)/libssl.dll.a $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp/lib/
# cleanup
rm -r -f openssl-$(OPENSSL_VERSION)
mv $(BUILD_PATH)/openssl-$(OPENSSL_VERSION).tmp $(BUILD_PATH)/openssl-$(OPENSSL_VERSION)
speex: $(BUILD_PATH)/speex-$(SPEEX_VERSION)
$(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz:
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speex-$(SPEEX_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
$(BUILD_PATH)/speex-$(SPEEX_VERSION): $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/speex-*
tar xvf $(DOWNLOAD_PATH)/speex-$(SPEEX_VERSION).tar.gz
# build
cd speex-$(SPEEX_VERSION) && ./configure
#cd speex-$(SPEEX_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd speex-$(SPEEX_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex
cp speex-$(SPEEX_VERSION)/include/speex/*.h $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/include/speex/
mkdir -p $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/lib
cp speex-$(SPEEX_VERSION)/libspeex/.libs/libspeex.a $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp/lib
# cleanup
rm -r -f speex-$(SPEEX_VERSION)
mv $(BUILD_PATH)/speex-$(SPEEX_VERSION).tmp $(BUILD_PATH)/speex-$(SPEEX_VERSION)
speexdsp: $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
$(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz:
wget --no-check-certificate http://downloads.xiph.org/releases/speex/speexdsp-$(SPEEXDSP_VERSION).tar.gz -O $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
$(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION): $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/speexdsp-*
tar xvf $(DOWNLOAD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tar.gz
# build
cd speexdsp-$(SPEEXDSP_VERSION) && ./configure
cd speexdsp-$(SPEEXDSP_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex
cp speexdsp-$(SPEEXDSP_VERSION)/include/speex/*.h $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/include/speex/
mkdir -p $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
cp speexdsp-$(SPEEXDSP_VERSION)/libspeexdsp/.libs/libspeexdsp.a $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp/lib
# cleanup
rm -r -f speexdsp-$(SPEEXDSP_VERSION)
mv $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION).tmp $(BUILD_PATH)/speexdsp-$(SPEEXDSP_VERSION)
opencv: $(BUILD_PATH)/opencv-$(OPENCV_VERSION)
$(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz:
wget --no-check-certificate https://github.com/opencv/opencv/archive/$(OPENCV_VERSION).tar.gz -O $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
$(BUILD_PATH)/opencv-$(OPENCV_VERSION): $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/opencv-*
tar xvf $(DOWNLOAD_PATH)/opencv-$(OPENCV_VERSION).tar.gz
# 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`/../../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 -DENABLE_CXX11=ON -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -DSTRSAFE_NO_DEPRECATE" -DCMAKE_INSTALL_PREFIX="`pwd`/install"
cd opencv-$(OPENCV_VERSION)/build && make install
# copy files
mkdir -p $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/include
cp -r opencv-$(OPENCV_VERSION)/build/install/include/* $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/include/
mkdir -p $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/lib/opencv
cp -r opencv-$(OPENCV_VERSION)/build/install/x64/mingw/staticlib/* $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp/lib/opencv/
# cleanup
rm -r -f opencv-$(OPENCV_VERSION)
mv $(BUILD_PATH)/opencv-$(OPENCV_VERSION).tmp $(BUILD_PATH)/opencv-$(OPENCV_VERSION)
libxml2: $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
$(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxml2-$(LIBXML2_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
$(BUILD_PATH)/libxml2-$(LIBXML2_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libxml2-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
# build
cd libxml2-$(LIBXML2_VERSION) && ./configure --without-iconv -enable-shared=no
#cd libxml2-$(LIBXML2_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd libxml2-$(LIBXML2_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml
cp libxml2-$(LIBXML2_VERSION)/include/libxml/*.h $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/include/libxml/
mkdir -p $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib
cp libxml2-$(LIBXML2_VERSION)/.libs/libxml2.a $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp/lib/
# cleanup
#rm -r -f libxml2-$(LIBXML2_VERSION) # see libxslt
mv $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION).tmp $(BUILD_PATH)/libxml2-$(LIBXML2_VERSION)
libxslt: $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
$(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz:
wget ftp://xmlsoft.org/libxml2/libxslt-$(LIBXSLT_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
$(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION): $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libxslt-*
tar xvf $(DOWNLOAD_PATH)/libxml2-$(LIBXML2_VERSION).tar.gz
tar xvf $(DOWNLOAD_PATH)/libxslt-$(LIBXSLT_VERSION).tar.gz
# build
cd libxslt-$(LIBXSLT_VERSION) && ./configure --with-libxml-src=../libxml2-$(LIBXML2_VERSION) -enable-shared=no CFLAGS=-DLIBXML_STATIC
cd libxslt-$(LIBXSLT_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt
cp libxslt-$(LIBXSLT_VERSION)/libxslt/*.h $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/include/libxslt/
mkdir -p $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib
cp libxslt-$(LIBXSLT_VERSION)/libxslt/.libs/libxslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
cp libxslt-$(LIBXSLT_VERSION)/libexslt/.libs/libexslt.a $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp/lib/
# cleanup
rm -r -f libxml2-$(LIBXML2_VERSION)
rm -r -f libxslt-$(LIBXSLT_VERSION)
mv $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION).tmp $(BUILD_PATH)/libxslt-$(LIBXSLT_VERSION)
curl: $(BUILD_PATH)/curl-$(CURL_VERSION)
$(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz:
wget --no-check-certificate http://curl.haxx.se/download/curl-$(CURL_VERSION).tar.gz -O $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
$(BUILD_PATH)/curl-$(CURL_VERSION): $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/curl-*
tar xvf $(DOWNLOAD_PATH)/curl-$(CURL_VERSION).tar.gz
# build
cd curl-$(CURL_VERSION) && ./configure --disable-shared --with-ssl="`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)"
#cd curl-$(CURL_VERSION) && make install exec_prefix="`pwd`/../$(BUILD_PATH)"
cd curl-$(CURL_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl
cp curl-$(CURL_VERSION)/include/curl/*.h $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/include/curl/
mkdir -p $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/lib
cp curl-$(CURL_VERSION)/lib/.libs/libcurl.a $(BUILD_PATH)/curl-$(CURL_VERSION).tmp/lib/
# cleanup
rm -r -f curl-$(CURL_VERSION)
mv $(BUILD_PATH)/curl-$(CURL_VERSION).tmp $(BUILD_PATH)/curl-$(CURL_VERSION)
sqlcipher: $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION)
$(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz:
wget --no-check-certificate http://downloads.sourceforge.net/project/tcl/Tcl/$(TCL_VERSION)/tcl$(TCL_VERSION)-src.tar.gz -O $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
$(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz:
wget --no-check-certificate https://github.com/sqlcipher/sqlcipher/archive/v$(SQLCIPHER_VERSION).tar.gz -O $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
$(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION): $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/sqlcipher-*
# tcl
tar xvf $(DOWNLOAD_PATH)/tcl$(TCL_VERSION)-src.tar.gz
mkdir -p tcl$(TCL_VERSION)/build
cd tcl$(TCL_VERSION)/build && ../win/configure
cd tcl$(TCL_VERSION)/build && make
#sqlcipher
tar xvf $(DOWNLOAD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tar.gz
cd sqlcipher-$(SQLCIPHER_VERSION) && ln -s ../tcl$(TCL_VERSION)/build/tclsh86.exe tclsh
mkdir -p tcl$(TCL_VERSION)/lib
ln -s `pwd`/tcl$(TCL_VERSION)/library `pwd`/tcl$(TCL_VERSION)/lib/tcl8.6
# build
cd sqlcipher-$(SQLCIPHER_VERSION) && PATH=.:$$PATH:`pwd`/../tcl$(TCL_VERSION)/build && export LIBS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lgdi32 $$LIBS" && ./configure --disable-shared --enable-static --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -I`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/include -I`pwd`/../tcl$(TCL_VERSION)/generic" LDFLAGS="-L`pwd`/../$(BUILD_PATH)/openssl-$(OPENSSL_VERSION)/lib -lcrypto -lgdi32" --with-tcl="`pwd`/../tcl$(TCL_VERSION)/build" && make install prefix="`pwd`/install"
# copy files
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include
cp -r sqlcipher-$(SQLCIPHER_VERSION)/install/include/* $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/include/
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib
cp sqlcipher-$(SQLCIPHER_VERSION)/install/lib/libsqlcipher.a $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/lib/
mkdir -p $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin
cp sqlcipher-$(SQLCIPHER_VERSION)/install/bin/sqlcipher.exe $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp/bin/
# cleanup
rm -r -f sqlcipher-$(SQLCIPHER_VERSION)
rm -r -f tcl$(TCL_VERSION)
mv $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION).tmp $(BUILD_PATH)/sqlcipher-$(SQLCIPHER_VERSION)
libmicrohttpd: $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
$(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz:
wget --no-check-certificate http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz -O $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION): $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/libmicrohttpd-*
tar xvf $(DOWNLOAD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tar.gz
# build
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp"
cd libmicrohttpd-$(LIBMICROHTTPD_VERSION) && make install
# cleanup
rm -r -f libmicrohttpd-$(LIBMICROHTTPD_VERSION)
mv $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION).tmp $(BUILD_PATH)/libmicrohttpd-$(LIBMICROHTTPD_VERSION)
ffmpeg: $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
$(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz:
wget --no-check-certificate https://ffmpeg.org/releases/ffmpeg-$(FFMPEG_VERSION).tar.gz -O $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION): $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/ffmpeg-*
tar xvf $(DOWNLOAD_PATH)/ffmpeg-$(FFMPEG_VERSION).tar.gz
# build
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`/../$(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp"
cd ffmpeg-$(FFMPEG_VERSION) && make install
# cleanup
rm -r -f ffmpeg-$(FFMPEG_VERSION)
mv $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION).tmp $(BUILD_PATH)/ffmpeg-$(FFMPEG_VERSION)
rapidjson: $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION)
$(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz:
wget --no-check-certificate https://github.com/Tencent/rapidjson/archive/v$(RAPIDJSON_VERSION).tar.gz -O $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
$(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION): $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
# prepare
rm -r -f $(BUILD_PATH)/rapidjson-*
tar xvf $(DOWNLOAD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tar.gz
# build
#mkdir -p rapidjson-$(RAPIDJSON_VERSION)/build
#cd rapidjson-$(RAPIDJSON_VERSION)/build && cmake .. -G"MSYS Makefiles"
#cd rapidjson-$(RAPIDJSON_VERSION)/build && make
# copy files
mkdir -p $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp/include
cp -r rapidjson-$(RAPIDJSON_VERSION)/include/* $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp/include/
# cleanup
rm -r -f rapidjson-$(RAPIDJSON_VERSION)
mv $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION).tmp $(BUILD_PATH)/rapidjson-$(RAPIDJSON_VERSION)
xapian: $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION)
$(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz:
wget --no-check-certificate https://oligarchy.co.uk/xapian/$(XAPIAN_VERSION)/xapian-core-$(XAPIAN_VERSION).tar.xz -O $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION): $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
# prepare
rm -r -f $(BUILD_PATH)/xapian-core-*
tar xvf $(DOWNLOAD_PATH)/xapian-core-$(XAPIAN_VERSION).tar.xz
# build
#cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static --prefix="`pwd`/../$(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp"
#cd xapian-core-$(XAPIAN_VERSION) && make install
cd xapian-core-$(XAPIAN_VERSION) && ./configure --disable-shared --enable-static
cd xapian-core-$(XAPIAN_VERSION) && make
# copy files
mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include
cp -r xapian-core-$(XAPIAN_VERSION)/include/* $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/
rm $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/include/Makefile*
mkdir -p $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/lib
cp -r xapian-core-$(XAPIAN_VERSION)/.libs/libxapian.a $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp/lib/
# cleanup
rm -r -f xapian-core-$(XAPIAN_VERSION)
mv $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION).tmp $(BUILD_PATH)/xapian-core-$(XAPIAN_VERSION)
copylibs:
rm -r -f $(LIBS_PATH) ; \
mkdir -p $(LIBS_PATH) ; \
cp $(BUILD_PATH)/gcc-version $(LIBS_PATH) ; \
find $(BUILD_PATH) -mindepth 1 -maxdepth 1 -type d -not -name "*.tmp" -print -exec cp -r {}/. $(LIBS_PATH) \; ; \

View File

@ -0,0 +1,51 @@
:: Usage:
:: call build-libs.bat [make tasks]
@echo off
setlocal
:: Parameter
set MakeParam="DOWNLOAD_PATH=../../download"
set MakeTask=
:param_loop
if "%~1" NEQ "" (
set MakeTask=%MakeTask% %1
shift /1
goto param_loop
)
:: Initialize environment
call "%~dp0..\env.bat"
if errorlevel 1 goto error_env
call "%EnvPath%\env-msys2.bat"
if errorlevel 1 goto error_env
:: Check MSYS environment
if not exist "%EnvMSYS2SH%" %cecho% error "Please install MSYS2 first." & exit /B 1
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
call "%ToolsPath%\msys-path.bat" "%~dp0" MSYS2CurPath
call "%ToolsPath%\msys-path.bat" "%BuildLibsPath%" MSYS2BuildLibsPath
if not exist "%BuildLibsPath%" mkdir "%BuildLibsPath%"
set MSYSTEM=MINGW%MSYS2Base%
set MSYS2_PATH_TYPE=inherit
%EnvMSYS2Cmd% "pacman --needed --noconfirm -S diffutils perl tar make mingw-w64-%MSYS2Architecture%-make"
::mingw-w64-%MSYS2Architecture%-cmake
::%EnvMSYS2Cmd% "pacman --noconfirm -Rd --nodeps mingw-w64-%MSYS2Architecture%-zlib"
%EnvMSYS2Cmd% "cd "%MSYS2BuildLibsPath%" && make -f %MSYS2CurPath%/makefile %MakeParam% %MakeTask%"
exit /B %ERRORLEVEL%
:error_env
echo Failed to initialize environment.
endlocal
exit /B 1

View File

@ -4,9 +4,10 @@ call "%ToolsPath%\find-in-path.bat" MinGWPath gcc.exe
if "%MinGWPath%"=="" %cecho% error "Please run command in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable." & exit /B 1 if "%MinGWPath%"=="" %cecho% error "Please run command in the Qt Command Prompt or add the path to MinGW bin folder to PATH variable." & exit /B 1
:: Get gcc versions :: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion call "%ToolsPath%\get-gcc-version.bat" GCCVersion GCCArchitecture
if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1 if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1
if "%GCCArchitecture%"=="" %cecho% error "Cannot get gcc architecture." & exit /B 1
set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion% set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion%\%GCCArchitecture%
exit /B 0 exit /B 0

View File

@ -67,13 +67,14 @@ call "%ToolsPath%\get-qt-version.bat" QtVersion
if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1 if "%QtVersion%"=="" %cecho% error "Cannot get Qt version." & exit /B 1
:: Get gcc versions :: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion call "%ToolsPath%\get-gcc-version.bat" GCCVersion GCCArchitecture
if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1 if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1
if "%GCCArchitecture%"=="" %cecho% error "Cannot get gcc architecture." & exit /B 1
set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion% set BuildLibsPath=%EnvRootPath%\build-libs\gcc-%GCCVersion%\%GCCArchitecture%
set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%RsBuildConfig% set RsBuildPath=%BuildPath%\Qt-%QtVersion%-%GCCArchitecture%-%RsBuildConfig%
set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%RsBuildConfig% set RsDeployPath=%DeployPath%\Qt-%QtVersion%%RsType%-%GCCArchitecture%-%RsBuildConfig%
set RsPackPath=%DeployPath% set RsPackPath=%DeployPath%
set RsArchiveAdd= set RsArchiveAdd=

39
build_scripts/Windows/env/env-msys2.bat vendored Normal file
View File

@ -0,0 +1,39 @@
:: Usage:
:: call env-msys2.bat [reinstall|clean]
:: Initialize environment
call "%~dp0env.bat"
if errorlevel 1 goto error_env
rem openssl x86 doesn't compile with mingw64 x64
:: Get gcc versions
call "%ToolsPath%\get-gcc-version.bat" GCCVersion GCCArchitecture
if "%GCCVersion%"=="" %cecho% error "Cannot get gcc version." & exit /B 1
if "%GCCArchitecture%"=="" %cecho% error "Cannot get gcc architecture." & exit /B 1
rem IF DEFINED ProgramFiles(x86) (
if "%GCCArchitecture%"=="x64" (
:: x64
set MSYS2Architecture=x86_64
set MSYS2Base=64
) else (
:: x86
set MSYS2Architecture=i686
set MSYS2Base=32
)
set EnvMSYS2Path=%EnvRootPath%\msys2
call "%~dp0tools\prepare-msys2.bat" %1
if errorlevel 1 exit /B %ERRORLEVEL%
set EnvMSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh.exe
if not exist "%EnvMSYS2SH%" if errorlevel 1 goto error_env
set EnvMSYS2Cmd="%EnvMSYS2SH%" -lc
exit /B 0
:error_env
echo Failed to initialize environment.
exit /B 1

View File

@ -27,7 +27,7 @@ call "%~dp0tools\prepare-tools.bat"
if errorlevel 1 exit /B %ERRORLEVEL% if errorlevel 1 exit /B %ERRORLEVEL%
:: Add MinGit to PATH :: Add MinGit to PATH
set PATH=%EnvToolsPath%\MinGit\cmd;%PATH% set PATH=%EnvToolsPath%\MinGit\cmd;%EnvToolsPath%\cmake\bin;%PATH%
set HOME=%EnvToolsPath%\MinGit\home set HOME=%EnvToolsPath%\MinGit\home
exit /B 0 exit /B 0

View File

@ -0,0 +1,83 @@
:: Usage:
:: call prepare-msys2.bat [reinstall|clean]
setlocal enabledelayedexpansion
if "%EnvMSYS2Path%"=="" exit /B 1
if "%MSYS2Architecture%"=="" exit /B 1
if "%MSYS2Base%"=="" exit /B 1
if not exist "%EnvRootPath%"=="" exit /B 1
copy "%~dp0root\update-msys2.bat" "%EnvRootPath%" >nul
if "%~1"=="clean" (
%cecho% info "Clean MSYS2"
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%"
goto exit
)
if exist "%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\pacman.exe" (
if "%~1"=="reinstall" (
choice /M "Found existing MSYS2 version. Do you want to proceed?"
if !ERRORLEVEL!==2 goto exit
) else (
goto exit
)
)
set MSYS2Install=msys2-base-%MSYS2Architecture%-20190524.tar.xz
set MSYS2Url=http://sourceforge.net/projects/msys2/files/Base/%MSYS2Architecture%/%MSYS2Install%/download
set CMakeInstall=cmake-3.1.0-win32-x86.zip
set CMakeUrl=http://www.cmake.org/files/v3.1/%CMakeInstall%
set CMakeUnpackPath=%EnvMSYS2Path%\msys%MSYS2Base%
%cecho% info "Remove previous MSYS2 version"
call "%ToolsPath%\remove-dir.bat" "%EnvMSYS2Path%\msys%MSYS2Base%"
%cecho% info "Download installation files"
if not exist "%EnvDownloadPath%\%MSYS2Install%" call "%ToolsPath%\download-file.bat" "%MSYS2Url%" "%EnvDownloadPath%\%MSYS2Install%"
if not exist "%EnvDownloadPath%\%MSYS2Install%" %cecho% error "Cannot download MSYS" & goto error
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\download-file.bat" "%CMakeUrl%" "%EnvDownloadPath%\%CMakeInstall%"
if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake" & goto error
%cecho% info "Unpack MSYS2"
"%EnvSevenZipExe%" x -so "%EnvDownloadPath%\%MSYS2Install%" | "%EnvSevenZipExe%" x -y -si -ttar -o"%EnvMSYS2Path%"
%cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%CMakeUnpackPath%" "%EnvDownloadPath%\%CMakeInstall%"
%cecho% info "Install CMake"
set CMakeVersion=
for /D %%F in (%CMakeUnpackPath%\cmake*) do set CMakeVersion=%%~nxF
if "%CMakeVersion%"=="" %cecho% error "CMake version not found." & goto :exit
%cecho% info "Found CMake version %CMakeVersion%"
set FoundProfile=
for /f "tokens=3" %%F in ('find /c /i "%CMakeVersion%" "%EnvMSYS2Path%\msys%MSYS2Base%\etc\profile"') do set FoundProfile=%%F
if "%FoundProfile%"=="0" (
echo export PATH="${PATH}:/%CMakeVersion%/bin">>"%EnvMSYS2Path%\msys%MSYS2Base%\etc\profile"
)
set MSYS2SH=%EnvMSYS2Path%\msys%MSYS2Base%\usr\bin\sh
%cecho% info "Update keyring"
"%MSYS2SH%" -lc "curl -O http://repo.msys2.org/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
"%MSYS2SH%" -lc "pacman --noconfirm -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz"
%cecho% info "Initialize MSYS2"
"%MSYS2SH%" -lc "pacman -Sy"
"%MSYS2SH%" -lc "pacman --noconfirm --needed -S bash pacman pacman-mirrors msys2-runtime"
call "%EnvMSYS2Path%\msys%MSYS2Base%\autorebase.bat"
call "%EnvRootPath%\update-msys2.bat"
call "%EnvRootPath%\update-msys2.bat"
:exit
endlocal
exit /B 0
:error
endlocal
exit /B 1

View File

@ -24,6 +24,10 @@ set MinGitUrl=https://github.com/git-for-windows/git/releases/download/v2.28.0.w
set MinGitInstallPath=%EnvToolsPath%\MinGit set MinGitInstallPath=%EnvToolsPath%\MinGit
set SigcheckInstall=Sigcheck.zip set SigcheckInstall=Sigcheck.zip
set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall% set SigcheckUrl=https://download.sysinternals.com/files/%SigcheckInstall%
set CMakeVersion=cmake-3.1.0-win32-x86
set CMakeInstall=%CMakeVersion%.zip
set CMakeUrl=http://www.cmake.org/files/v3.1/%CMakeInstall%
set CMakeInstallPath=%EnvToolsPath%\cmake
if not exist "%EnvToolsPath%\wget.exe" ( if not exist "%EnvToolsPath%\wget.exe" (
echo Download Wget installation echo Download Wget installation
@ -185,6 +189,25 @@ if not exist "%EnvToolsPath%\sigcheck.exe" (
"%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe "%EnvSevenZipExe%" x -o"%EnvToolsPath%" "%EnvDownloadPath%\%SigcheckInstall%" sigcheck.exe
) )
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%"
if not exist "%CMakeInstallPath%\bin\cmake.exe" (
%cecho% info "Download CMake installation"
if exist "%CMakeInstallPath%" call "%ToolsPath%\remove-dir.bat" "%CMakeInstallPath%"
mkdir "%EnvTempPath%"
if not exist "%EnvDownloadPath%\%CMakeInstall%" call "%ToolsPath%\download-file.bat" "%CMakeUrl%" "%EnvDownloadPath%\%CMakeInstall%"
if not exist "%EnvDownloadPath%\%CMakeInstall%" %cecho% error "Cannot download CMake installation" & goto error
%cecho% info "Unpack CMake"
"%EnvSevenZipExe%" x -o"%EnvTempPath%" "%EnvDownloadPath%\%CMakeInstall%"
move "%EnvTempPath%\%CMakeVersion%" "%CMakeInstallPath%"
call "%ToolsPath%\remove-dir.bat" "%EnvTempPath%"
)
:exit :exit
endlocal endlocal
exit /B 0 exit /B 0

View File

@ -0,0 +1,19 @@
@echo off
setlocal
if exist "%~dp0msys2\msys32" call :update 32
if exist "%~dp0msys2\msys64" call :update 64
goto :EOF
:update
set MSYSSH=%~dp0msys2\msys%~1\usr\bin\sh
echo Update MSYS2 %~1
"%MSYSSH%" -lc "pacman -Sy"
"%MSYSSH%" -lc "pacman --noconfirm -Su"
:exit
endlocal
goto :EOF

View File

@ -1,16 +1,24 @@
:: Usage: :: Usage:
:: call get-gcc-version.bat variable :: call get-gcc-version.bat version architecture
setlocal setlocal
set Var=%~1 set VarVersion=%~1
if "%Var%"=="" ( if "%VarVersion%"=="" (
echo.
echo Parameter error.
exit /B 1
)
set VarArchitecture=%~2
if "%VarArchitecture%"=="" (
echo. echo.
echo Parameter error. echo Parameter error.
exit /B 1 exit /B 1
) )
set GCCVersion= set GCCVersion=
set GCCArchitecture=
call "%~dp0find-in-path.bat" GCCPath gcc.exe call "%~dp0find-in-path.bat" GCCPath gcc.exe
if "%GCCPath%"=="" ( if "%GCCPath%"=="" (
@ -23,6 +31,7 @@ gcc --version >"%~dp0gccversion.tmp"
for /F "tokens=1*" %%A in (%~sdp0gccversion.tmp) do ( for /F "tokens=1*" %%A in (%~sdp0gccversion.tmp) do (
if "%%A"=="gcc" ( if "%%A"=="gcc" (
call :find_version %%B call :find_version %%B
call :find_architecture %%B
goto exit goto exit
) )
) )
@ -30,13 +39,25 @@ for /F "tokens=1*" %%A in (%~sdp0gccversion.tmp) do (
:exit :exit
if exist "%~dp0gccversion.tmp" del /Q "%~dp0gccversion.tmp" if exist "%~dp0gccversion.tmp" del /Q "%~dp0gccversion.tmp"
endlocal & set %Var%=%GCCVersion% endlocal & set %VarVersion%=%GCCVersion%& set %VarArchitecture%=%GCCArchitecture%
goto :EOF goto :EOF
:find_version :find_version
:loop :loop_version
if "%2" NEQ "" ( if "%2" NEQ "" (
shift shift
goto loop goto loop_version
) )
set GCCVersion=%1 set GCCVersion=%1
goto :EOF
:find_architecture
:loop_architecture
if "%7" NEQ "" (
shift
goto loop_architecture
)
set _Architecture=%1
if "%_Architecture:~1,4%"=="i686" set GCCArchitecture=x86
if "%_Architecture:~1,6%"=="x86_64" set GCCArchitecture=x64
goto :EOF