| 1 |
@echo on |
| 2 |
:: vcvarsall.bat sets various env vars like PATH, INCLUDE, LIB, LIBPATH for the |
| 3 |
:: specified build architecture |
| 4 |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64 |
| 5 |
@echo on |
| 6 |
|
| 7 |
:: set PATH, LIB and INCLUDE to first include our install directory, as well as to where |
| 8 |
:: `tar`, `bzip2` and `gzip` are. |
| 9 |
@set INST=%CD%\rsvg.ci.bin |
| 10 |
@set INST_PSX=%INST:\=/% |
| 11 |
@set MSYS2_BINDIR=c:\msys64\usr\bin |
| 12 |
@set BASEPATH=%INST%\bin;%PATH% |
| 13 |
@set PATH=%BASEPATH% |
| 14 |
@set LIB=%INST%\lib;%LIB% |
| 15 |
@set INCLUDE=%INST%\include\glib-2.0;%INST%\lib\glib-2.0\include;%INST%\include;%INCLUDE% |
| 16 |
@set RUST_HOST=x86_64-pc-windows-msvc |
| 17 |
|
| 18 |
:: Packaged dep versions |
| 19 |
@set LIBXML2_VER=2.12.6 |
| 20 |
@set FREETYPE2_VER=2.13.0 |
| 21 |
@set PKG_CONFIG_VER=0.29.2 |
| 22 |
|
| 23 |
@set CURRDIR=%CD% |
| 24 |
pip3 install --upgrade --user -r ci/msvc-requirements.txt || goto :error |
| 25 |
git clone --depth 1 --no-tags https://gitlab.gnome.org/GNOME/gdk-pixbuf.git |
| 26 |
git clone --depth 1 --no-tags https://gitlab.gnome.org/GNOME/pango.git |
| 27 |
|
| 28 |
:: build and install GDK-Pixbuf (includes glib, libpng, libjpeg-turbo and their deps) |
| 29 |
md _build_gdk_pixbuf |
| 30 |
cd _build_gdk_pixbuf |
| 31 |
meson setup ../gdk-pixbuf --buildtype=release --prefix=%INST_PSX% -Dman=false -Ddocumentation=false |
| 32 |
ninja install || goto :error |
| 33 |
cd .. |
| 34 |
rmdir /s/q _build_gdk_pixbuf |
| 35 |
copy /b %INST%\lib\z.lib %INST%\lib\zlib.lib |
| 36 |
|
| 37 |
:: Download rustup-init, pkg-config, FreeType and libxml2 |
| 38 |
:: (sadly there is no CUrl, but wget, so MSYS2 is needed temporarily) |
| 39 |
:: %MSYS2_BINDIR% must be in PATH to find gzip/xz. |
| 40 |
set PATH=%PATH%;%MSYS2_BINDIR% |
| 41 |
if not exist %HOMEPATH%\.cargo\bin\rustup.exe %MSYS2_BINDIR%\wget https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe |
| 42 |
%MSYS2_BINDIR%\wget https://pkgconfig.freedesktop.org/releases/pkg-config-%PKG_CONFIG_VER%.tar.gz |
| 43 |
%MSYS2_BINDIR%\wget https://downloads.sourceforge.net/freetype/freetype-%FREETYPE2_VER%.tar.xz |
| 44 |
%MSYS2_BINDIR%\wget https://download.gnome.org/sources/libxml2/2.12/libxml2-%LIBXML2_VER%.tar.xz |
| 45 |
:: Ensure it sets the filename correctly |
| 46 |
%MSYS2_BINDIR%\wget --content-disposition https://wrapdb.mesonbuild.com/v2/libxml2_%LIBXML2_VER%-1/get_patch |
| 47 |
|
| 48 |
%MSYS2_BINDIR%\tar -xf pkg-config-%PKG_CONFIG_VER%.tar.gz |
| 49 |
%MSYS2_BINDIR%\tar -Jxf freetype-%FREETYPE2_VER%.tar.xz |
| 50 |
%MSYS2_BINDIR%\tar -Jxf libxml2-%LIBXML2_VER%.tar.xz |
| 51 |
:: Sorry for this hack! Please remove when the runner gets unzip through Pacman |
| 52 |
python -c "import zipfile; zipfile.ZipFile('libxml2_%LIBXML2_VER%-1_patch.zip', 'r').extractall()" |
| 53 |
:: Having the gnutools/msys64 in the %PATH% during the MSVC builds |
| 54 |
:: can cause trouble... |
| 55 |
del /f/q pkg-config-%PKG_CONFIG_VER%.tar.gz freetype-%FREETYPE2_VER%.tar.xz libxml2-%LIBXML2_VER%.tar.xz libxml2_%LIBXML2_VER%-1_patch.zip |
| 56 |
|
| 57 |
:: build and install pkg-config |
| 58 |
cd pkg-config-%PKG_CONFIG_VER% |
| 59 |
|
| 60 |
:: patch pkg-config's NMake Makefile so that GNU's mkdir won'y be used by accident |
| 61 |
%MSYS2_BINDIR%\patch -p1 < %CURRDIR:\=/%/ci/pkgconfig.nmake.patch |
| 62 |
set PATH=%BASEPATH% |
| 63 |
nmake /f Makefile.vc CFG=release || goto :error |
| 64 |
copy /b release\x64\pkg-config.exe %INST%\bin |
| 65 |
nmake /f Makefile.vc CFG=release clean |
| 66 |
cd .. |
| 67 |
|
| 68 |
:: build and install FreeType |
| 69 |
md _build_ft |
| 70 |
cd _build_ft |
| 71 |
meson setup ../freetype-%FREETYPE2_VER% --buildtype=release --prefix=%INST_PSX% --pkg-config-path=%INST%\lib\pkgconfig --cmake-prefix-path=%INST% |
| 72 |
ninja install || goto :error |
| 73 |
cd .. |
| 74 |
rmdir /s/q _build_ft |
| 75 |
|
| 76 |
:: build and install libxml2 (use the Meson wrap overlaid before) |
| 77 |
md _build_libxml |
| 78 |
cd _build_libxml |
| 79 |
meson setup ../libxml2-%LIBXML2_VER% --buildtype=release --prefix=%INST_PSX% -Diconv=disabled --pkg-config-path=%INST%\lib\pkgconfig --cmake-prefix-path=%INST% |
| 80 |
ninja install || goto :error |
| 81 |
cd .. |
| 82 |
rmdir /s/q _build_libxml |
| 83 |
|
| 84 |
:: build and install Pango (with HarfBuzz and Cairo) |
| 85 |
md _build_pango |
| 86 |
cd _build_pango |
| 87 |
meson setup ../pango --buildtype=release --prefix=%INST_PSX% -Dfontconfig=disabled --pkg-config-path=%INST%\lib\pkgconfig |
| 88 |
ninja install || goto :error |
| 89 |
cd .. |
| 90 |
rmdir /s/q _build_pango |
| 91 |
|
| 92 |
:: Install Rust |
| 93 |
if exist %HOMEPATH%\.cargo\bin\rustup.exe %HOMEPATH%\.cargo\bin\rustup update |
| 94 |
if not exist %HOMEPATH%\.cargo\bin\rustup.exe rustup-init -y --default-toolchain=stable-%RUST_HOST% --default-host=%RUST_HOST% |
| 95 |
%HOMEPATH%\.cargo\bin\cargo install cargo-c || goto :error |
| 96 |
|
| 97 |
:: Enable workaround if latest stable Rust caused issues like #968. |
| 98 |
:: Update RUST_DOWNGRADE_VER below as well as required. |
| 99 |
@set DOWNGRADE_RUST_VERSION=0 |
| 100 |
|
| 101 |
:: now build librsvg |
| 102 |
set PATH=%PATH%;%HOMEPATH%\.cargo\bin |
| 103 |
set PKG_CONFIG=%INST%\bin\pkg-config.exe |
| 104 |
md msvc-build |
| 105 |
cd msvc-build |
| 106 |
|
| 107 |
:: Fix linking to PCRE for CI's sake |
| 108 |
if exist %INST%\lib\libpcre2-8.a copy /b %INST%\lib\libpcre2-8.a %INST%\lib\pcre2-8.lib |
| 109 |
|
| 110 |
if not "%DOWNGRADE_RUST_VERSION%" == "1" goto :normal_rust_build |
| 111 |
@set RUST_DOWNGRADE_VER=1.82.0 |
| 112 |
%HOMEPATH%\.cargo\bin\rustup install %RUST_DOWNGRADE_VER%-%RUST_HOST% |
| 113 |
meson setup .. --buildtype=release --prefix=%INST_PSX% --pkg-config-path=%INST%\lib\pkgconfig --cmake-prefix-path=%INST% -Dtriplet=%RUST_HOST% -Drustc-version=%RUST_DOWNGRADE_VER% || goto :error |
| 114 |
goto :continue_build |
| 115 |
|
| 116 |
:normal_rust_build |
| 117 |
meson setup .. --buildtype=release --prefix=%INST_PSX% --pkg-config-path=%INST%\lib\pkgconfig --cmake-prefix-path=%INST% || goto :error |
| 118 |
|
| 119 |
:continue_build |
| 120 |
ninja || goto :error |
| 121 |
ninja test |
| 122 |
ninja install || goto :error |
| 123 |
|
| 124 |
goto :EOF |
| 125 |
:error |
| 126 |
exit /b 1 |