2017-03-21 15:03:31 +03:00
|
|
|
@echo off
|
|
|
|
setlocal enableextensions enabledelayedexpansion
|
|
|
|
title Building i2pd
|
|
|
|
|
2020-11-23 01:44:21 +03:00
|
|
|
REM Copyright (c) 2013-2020, The PurpleI2P Project
|
2017-03-21 15:03:31 +03:00
|
|
|
REM This file is part of Purple i2pd project and licensed under BSD3
|
|
|
|
REM See full license text in LICENSE file at top of project tree
|
|
|
|
|
2017-12-07 16:26:28 +03:00
|
|
|
REM To use that script, you must have installed in your MSYS installation these packages:
|
2017-03-21 15:03:31 +03:00
|
|
|
REM Base: git make zip
|
2022-02-20 12:53:31 +03:00
|
|
|
REM UCRT64: mingw-w64-ucrt-x86_64-boost mingw-w64-ucrt-x86_64-openssl mingw-w64-ucrt-x86_64-gcc
|
|
|
|
REM MINGW32: mingw-w64-i686-boost mingw-w64-i686-openssl mingw-w64-i686-gcc
|
2017-03-21 15:03:31 +03:00
|
|
|
|
|
|
|
REM setting up variables for MSYS
|
|
|
|
REM Note: if you installed MSYS64 to different path, edit WD variable (only C:\msys64 needed to edit)!
|
|
|
|
set "WD=C:\msys64\usr\bin\"
|
|
|
|
set MSYS2_PATH_TYPE=inherit
|
|
|
|
set CHERE_INVOKING=enabled_from_arguments
|
2018-06-16 10:53:25 +03:00
|
|
|
REM set MSYSTEM=MSYS
|
|
|
|
set MSYSTEM=MINGW32
|
2017-03-21 15:03:31 +03:00
|
|
|
|
2017-11-13 03:25:39 +03:00
|
|
|
set "xSH=%WD%bash -lc"
|
|
|
|
|
2021-11-28 03:50:05 +03:00
|
|
|
set "FILELIST=i2pd.exe README.txt contrib/i2pd.conf contrib/tunnels.conf contrib/certificates contrib/tunnels.d contrib/webconsole"
|
2018-11-06 20:04:26 +03:00
|
|
|
|
2020-11-17 17:59:40 +03:00
|
|
|
REM detecting number of processors
|
|
|
|
set /a threads=%NUMBER_OF_PROCESSORS%
|
2017-03-21 15:03:31 +03:00
|
|
|
|
|
|
|
REM we must work in root of repo
|
|
|
|
cd ..
|
|
|
|
|
2017-11-13 03:25:39 +03:00
|
|
|
REM deleting old log files
|
2020-11-15 01:31:20 +03:00
|
|
|
del /S build_*.log >> nul 2>&1
|
2017-11-13 03:25:39 +03:00
|
|
|
|
2017-03-21 15:03:31 +03:00
|
|
|
echo Receiving latest commit and cleaning up...
|
2020-11-17 17:59:40 +03:00
|
|
|
%xSH% "git checkout contrib/* && git pull && make clean" > build\build.log 2>&1
|
2017-03-21 15:03:31 +03:00
|
|
|
|
|
|
|
REM set to variable current commit hash
|
2022-02-20 12:53:31 +03:00
|
|
|
for /F "usebackq" %%a in (`%xSH% "git describe --tags"`) DO (
|
2017-03-21 15:03:31 +03:00
|
|
|
set tag=%%a
|
|
|
|
)
|
|
|
|
|
2021-10-06 21:35:23 +03:00
|
|
|
REM set to variable latest released tag
|
2022-02-20 12:53:31 +03:00
|
|
|
for /F "usebackq" %%b in (`%xSH% "git describe --abbrev=0"`) DO (
|
2021-10-06 21:35:23 +03:00
|
|
|
set reltag=%%b
|
|
|
|
)
|
|
|
|
|
|
|
|
echo Preparing configuration files and README for packaging...
|
|
|
|
|
2017-11-13 03:25:39 +03:00
|
|
|
%xSH% "echo To use configs and certificates, move all files and certificates folder from contrib directory here. > README.txt" >> nul
|
2017-06-22 15:37:02 +03:00
|
|
|
|
2022-02-20 12:53:31 +03:00
|
|
|
REM converting configuration files to DOS format (make usable in Windows Notepad)
|
2021-11-28 04:26:44 +03:00
|
|
|
%xSH% "unix2dos contrib/i2pd.conf contrib/tunnels.conf contrib/tunnels.d/* contrib/webconsole/style.css" >> build\build.log 2>&1
|
2020-11-15 01:31:20 +03:00
|
|
|
|
2022-02-20 12:53:31 +03:00
|
|
|
REM Prepare binary signing command if signing key and password provided
|
|
|
|
if defined SIGNKEY (
|
|
|
|
if defined SIGNPASS (
|
|
|
|
echo Signing options found^^!
|
|
|
|
|
|
|
|
for %%X in (signtool.exe) do (set xSIGNTOOL=%%~$PATH:X)
|
|
|
|
if not defined xSIGNTOOL (
|
|
|
|
if not defined SIGNTOOL (
|
|
|
|
echo Error: Can't find signtool^^! Please provide path to binary using SIGNTOOL variable^^!
|
|
|
|
exit /b 1
|
|
|
|
) else (
|
|
|
|
set "xSIGNTOOL=%SIGNTOOL%"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
set "xSIGNOPTS=sign /tr http://timestamp.digicert.com /td sha256 /fd sha256 /f ^"%SIGNKEY%^" /p ^"%SIGNPASS%^""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2017-03-21 15:03:31 +03:00
|
|
|
REM starting building
|
|
|
|
set MSYSTEM=MINGW32
|
|
|
|
set bitness=32
|
|
|
|
call :BUILDING
|
|
|
|
|
2022-02-20 12:53:31 +03:00
|
|
|
set MSYSTEM=UCRT64
|
2017-03-21 15:03:31 +03:00
|
|
|
set bitness=64
|
|
|
|
call :BUILDING
|
|
|
|
|
2022-02-20 12:53:31 +03:00
|
|
|
if exist C:\msys64-xp\ (
|
2021-11-28 04:26:44 +03:00
|
|
|
REM building for WinXP
|
|
|
|
set "WD=C:\msys64-xp\usr\bin\"
|
|
|
|
set MSYSTEM=MINGW32
|
|
|
|
set bitness=32
|
|
|
|
set "xSH=%WD%bash -lc"
|
|
|
|
call :BUILDING_XP
|
|
|
|
echo.
|
|
|
|
)
|
2019-11-19 14:29:55 +03:00
|
|
|
|
2020-11-15 01:31:20 +03:00
|
|
|
REM compile installer
|
2022-02-20 12:53:31 +03:00
|
|
|
echo Building installer...
|
2021-10-06 21:35:23 +03:00
|
|
|
C:\PROGRA~2\INNOSE~1\ISCC.exe /dI2Pd_TextVer="%tag%" /dI2Pd_Ver="%reltag%.0" build\win_installer.iss >> build\build.log 2>&1
|
2020-11-15 01:31:20 +03:00
|
|
|
|
2022-02-20 12:53:31 +03:00
|
|
|
REM Sign binary
|
|
|
|
if defined xSIGNOPTS (
|
|
|
|
"%xSIGNTOOL%" %xSIGNOPTS% build\setup_i2pd_v%tag%.exe
|
|
|
|
)
|
|
|
|
|
2021-10-06 21:35:23 +03:00
|
|
|
%xSH% "git checkout contrib/*" >> build\build.log 2>&1
|
2020-11-15 01:31:20 +03:00
|
|
|
del README.txt i2pd_x32.exe i2pd_x64.exe i2pd_xp.exe >> nul
|
2017-06-22 15:37:02 +03:00
|
|
|
|
2017-03-21 15:03:31 +03:00
|
|
|
echo Build complete...
|
|
|
|
pause
|
|
|
|
exit /b 0
|
|
|
|
|
|
|
|
:BUILDING
|
2018-01-30 18:09:26 +03:00
|
|
|
%xSH% "make clean" >> nul
|
2021-10-06 21:35:23 +03:00
|
|
|
echo Building i2pd %tag% for win%bitness%...
|
2022-02-20 12:53:31 +03:00
|
|
|
REM Build i2pd
|
|
|
|
%xSH% "make DEBUG=no USE_UPNP=yes -j%threads%" > build\build_win%bitness%_%tag%.log 2>&1
|
|
|
|
|
|
|
|
REM Sign binary
|
|
|
|
if defined xSIGNOPTS (
|
|
|
|
"%xSIGNTOOL%" %xSIGNOPTS% i2pd.exe
|
|
|
|
)
|
|
|
|
|
|
|
|
REM Copy binary for installer and create distribution archive
|
|
|
|
%xSH% "cp i2pd.exe i2pd_x%bitness%.exe && zip -r9 build/i2pd_%tag%_win%bitness%_mingw.zip %FILELIST%" >> build\build_win%bitness%_%tag%.log 2>&1
|
|
|
|
|
|
|
|
REM Clean work directory
|
|
|
|
%xSH% "make clean" >> build\build_win%bitness%_%tag%.log 2>&1
|
2019-11-19 14:29:55 +03:00
|
|
|
goto EOF
|
|
|
|
|
|
|
|
:BUILDING_XP
|
|
|
|
%xSH% "make clean" >> nul
|
2021-10-06 21:35:23 +03:00
|
|
|
echo Building i2pd %tag% for winxp...
|
2022-02-20 12:53:31 +03:00
|
|
|
%xSH% "make DEBUG=no USE_UPNP=yes USE_WINXP_FLAGS=yes -j%threads%" > build\build_winxp_%tag%.log 2>&1
|
|
|
|
|
|
|
|
REM Sign binary
|
|
|
|
if defined xSIGNOPTS (
|
|
|
|
"%xSIGNTOOL%" %xSIGNOPTS% i2pd.exe
|
|
|
|
)
|
|
|
|
|
|
|
|
REM Copy binary for installer and create distribution archive
|
|
|
|
%xSH% "cp i2pd.exe i2pd_xp.exe && zip -r9 build/i2pd_%tag%_winxp_mingw.zip %FILELIST%" >> build\build_winxp_%tag%.log 2>&1
|
|
|
|
|
|
|
|
REM Clean work directory
|
|
|
|
%xSH% "make clean" >> build\build_winxp_%tag%.log 2>&1
|
2017-03-21 15:03:31 +03:00
|
|
|
|
|
|
|
:EOF
|