Skip to content

Commit

Permalink
Switch to using 7zip of MSYS2, and other build polishing.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersasi committed Aug 10, 2020
1 parent a9b6053 commit 270325a
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 55 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Your maintainer mostly uses the latest, non-portable dev version with thin clien
To build Deluge2 for windows use the scripts in the below order.

### Install the prerequisites
The main goal is to have as little of these as possible not to pollute the building computer. At the same time if something really is needed, I would rather use the original installers (e.g. 7zip vs. 7zip.NET - ended up using the one in MSYS2).
```install_components.cmd```
1. 7zip
2. MSYS2
Expand Down Expand Up @@ -42,7 +43,8 @@ are welcome! ;)
3. Unified Copyright notices in all CMD files
4. Start using color to make build messages pop more out of the build output
5. Create a single installer build script with paramteres
6. Made sure the curl we use is from the MSYS2 we installed, not the windows one
6. Made sure the curl we use is from the MSYS2 we installed, not the windows one.
7. Reverted installing 7zip for windows and instead added it to the packages installed in MSYS2.

### 3-Aug-2020 - fix missing files for Test connection

Expand Down
4 changes: 2 additions & 2 deletions build-menu.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ goto %last%
cmd /c deluge-build\deluge-dev.cmd
goto %last%
:8
cmd /c installer-build\installer-stable.cmd
cmd /c installer-build\installer-build.cmd stable
goto %last%
:9
cmd /c installer-build\installer-dev.cmd
cmd /c installer-build\installer-build.cmd dev
goto %last%
7 changes: 2 additions & 5 deletions deluge-build/deluge-dev.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
@cd "%~dp0"
call lib\printc "INFO: Changed to the directory of this script"

@echo Save the original PATH so that it does not keep growing on many runs, add MSYS2 /usr/bin to PATH
@set OLDPATH=%PATH%
@set PATH=C:\msys64\usr\bin;%PATH%
call lib\initpath

@echo Find out what is the latest python version Released
@for /f %%i in ('curl -s https://www.python.org/ ^| grep "Latest: " ^| cut -d/ -f5 ^| cut -d" " -f2 ^| tr -d "<"') do @set pythonVersion=%%i
Expand Down Expand Up @@ -148,5 +146,4 @@ if exist "%programfiles%\deluge" rd /s /q "%programfiles%\deluge"
@rem let'a not remove so that download can be resumed / skipped on next run
@rem del python*.exe

@rem Restore the original PATH so that it does not keep growing on many runs
set PATH=%OLDPATH%
call lib\restorepath
8 changes: 2 additions & 6 deletions deluge-build/deluge-stable.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
@rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/

cd "%~dp0"

@rem Save the original PATH so that it does not keep growing on many runs
set OLDPATH=%PATH%
set PATH=C:\msys64\usr\bin;%PATH%
lib\initpath

@rem Find out what is the latest python version Released
for /f %%i in ('curl -s https://www.python.org/ ^| grep "Latest: " ^| cut -d/ -f5 ^| cut -d" " -f2 ^| tr -d "<"') do set pythonVersion=%%i
Expand Down Expand Up @@ -150,5 +147,4 @@ if exist "%programfiles%\deluge" rd /s /q "%programfiles%\deluge"
@rem let'a not remove so that download can be resumed / skipped on next run
@rem del python*.exe

@rem Restore the original PATH so that it does not keep growing on many runs
set PATH=%OLDPATH%
lib\restorepath
9 changes: 3 additions & 6 deletions install_components.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@ rem added -C - so that it is resumed / not redownloaded
rem curl -C - -O https://slproweb.com/download/Win64OpenSSL-1_1_1g.exe
rem Win64OpenSSL-1_1_1g.exe /dir="C:\OpenSSL-Win64" /verysilent

@echo Download 7zip which will be used for the later installs
@curl -C - -O https://www.7-zip.org/a/7z1900-x64.exe || echo ERROR: Unable to download 7Zip using cURL!
@7z1900-x64.exe /S /D="%programfiles%\7-Zip" || echo ERROR: 7Zip silent install problem!

rem added -C - so that it is resumed / not redownloaded
curl -C - -O http://repo.msys2.org/distrib/msys2-x86_64-latest.tar.xz
rem cannot yet use the MSYS2 7zip
"%programfiles%\7-Zip\7z.exe" x msys2-x86_64-latest.tar.xz
"%programfiles%\7-Zip\7z.exe" x msys2-x86_64-latest.tar -oC:
C:\msys64\usr\bin\bash -lic "pacman -Syu --noconfirm"
C:\msys64\usr\bin\bash -lic "pacman -Syu --noconfirm"
C:\msys64\usr\bin\bash -lic "pacman -S diffutils patch git --noconfirm"
C:\msys64\usr\bin\bash -lic "pacman -S diffutils patch git p7zip --noconfirm"

rem added -C - so that it is resumed / not redownloaded
curl.exe -C - -LO http://prdownloads.sourceforge.net/nsis/nsis-3.05-setup.exe
curl -C - -LO http://prdownloads.sourceforge.net/nsis/nsis-3.05-setup.exe
nsis-3.05-setup.exe /S

rem added -C - so that it is resumed / not redownloaded
Expand Down
17 changes: 11 additions & 6 deletions installer-build/installer-build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@cd %~dp0

@goto %~1 2>NUL || (
@echo Invalid argument: "%1"
@call lib\printc error "Invalid argument: '%~n0 %1'"
@echo.
@echo To build both installers, use:
@call lib\printc green "%~n0 all"
Expand All @@ -16,25 +16,30 @@
)

:all
@call lib\printc "Calling stable build script..."
@call lib\printc info "Calling stable build script..."
@call %~f0 stable
@call lib\printc "Calling dev build script..."
@call lib\printc info "Calling dev build script..."
@call %~f0 dev
@goto :EOF

:dev
@call lib\printc "Building latest development version instaler:"
@call lib\printc info "Building latest development version instaler:"
@for /f %%i in ('dir /b C:\deluge2\deluge-2* ^| findstr dev') do set sourceFolder=%%i
@goto common

:stable
@call lib\printc "Building latest stable version instaler:"
@call lib\printc info "Building latest stable version instaler:"
@for /f %%i in ('dir /b C:\deluge2\deluge-2* ^| findstr /v dev') do set sourceFolder=%%i
@goto common

:common
@call lib\initpath
@curl https://dl.miyuru.lk/geoip/maxmind/country/maxmind4.dat.gz | "%programfiles%\7-Zip\7z" x -si -tgzip -so > C:\deluge2\%sourceFolder%\GeoIP.dat

@call lib\printc info "Downloading and unzipping latest GeoIP.dat into the source folder."
@curl https://dl.miyuru.lk/geoip/maxmind/country/maxmind4.dat.gz | 7z x -si -tgzip -so > C:\deluge2\%sourceFolder%\GeoIP.dat

@call lib\printc info "Starting NSIS build."
@"C:\Program Files (x86)\NSIS\makensis" /DPROGRAM_VERSION=%sourceFolder:~7% /Dsrcdir=C:\deluge2\%sourceFolder% C:\deluge2\nsis\packaging\win32\deluge-installer.nsi

@call lib\restorepath
@goto :EOF
2 changes: 1 addition & 1 deletion lib/createlinks.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/
@echo off

cd %~dp0
call printc "INFO: Entering parent of the lib folder, where this script is supposed to be."
call printc info "Entering parent of this script's folder [lib]."
cd ..

for /D %%d in (*-build) ^
Expand Down
4 changes: 2 additions & 2 deletions lib/initpath.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@call %~dp0\printc "Save the original PATH (to keep from growing on many runs) add MSYS2 /usr/bin to the front of the PATH"
@call %~dp0\printc info "Save the original PATH (to keep from growing on many runs) add MSYS2 /usr/bin to the front of the PATH"
@set OLDPATH=%PATH%
@set PATH=C:\msys64\usr\bin;%PATH%
@set PATH=C:\msys64\usr\bin;C:\msys64\usr\lib\p7zip;%PATH%
34 changes: 26 additions & 8 deletions lib/printc.cmd
Original file line number Diff line number Diff line change
@@ -1,20 +1,38 @@
@rem This script is Copyright
@rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/

@setlocal

@for /F "tokens=1,2 delims=#" %%a ^
in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') ^
do @set ESC=%%b

@goto %~1 2>NUL || @echo %ESC%[7m%~1%ESC%[0m

:success
@call :initprefix SUCCESS
:green
@shift
@echo %ESC%[92m%ESC%[7m%~1%ESC%[0m
@exit /B 0
@shift /1
@echo %ESC%[92m%ESC%[7m%prefixStr%%~1%ESC%[0m
@goto common

:error
@call :initprefix ERROR
:red
@shift
@echo %ESC%[41m%~1%ESC%[0m
@exit /B 0
@shift /1
@echo %ESC%[41m%prefixStr%%~1%ESC%[0m
@goto common

:info
@call :initprefix INFO
:blue
@shift /1
@echo %ESC%[34m%prefixStr%%~1%ESC%[0m
@goto common

:common
@set prefixStr=
@goto :EOF

:initprefix
@set /A msgCounter+=1
@set prefixStr=#%msgCounter%[%~1]:
@goto :EOF
3 changes: 2 additions & 1 deletion lib/restorepath.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@call %~dp0\printc "Restoring the original PATH so that it does not keep growing on many runs."
@call %~dp0\printc info "Restoring the original PATH so that it does not keep growing on many runs."
@set PATH=%OLDPATH%
@set msgCounter=""
8 changes: 6 additions & 2 deletions libtorrent-build/lt-1.2.3.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
@rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/

cd "%~dp0"
call lib\initpath

curl -LO https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.7z
"%programfiles%\7-Zip\7z.exe" x boost_*.7z -oC:
7z x boost_*.7z -oC:
move C:\boost_* C:\boost
set BOOST_ROOT=c:\boost
set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86;%BOOST_ROOT%;C:\python;C:\msys64\usr\bin
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86;%BOOST_ROOT%;C:\python
git clone https://github.com/arvidn/libtorrent -b libtorrent-1_2_3 C:/libtorrent
for /f %%i in ('curl -s https://www.python.org/ ^| grep "Latest: " ^| cut -d/ -f5 ^| cut -d" " -f2 ^| tr -d "<"') do set var2=%%i
curl.exe -O https://www.python.org/ftp/python/%var2%/python-%var2%-amd64.exe
Expand All @@ -31,3 +33,5 @@ rd /s /q C:\python 2>nul
rd /s /q C:\python 2>nul
del python*.exe boost_*.7z
pause

call lib\restorepath
13 changes: 5 additions & 8 deletions libtorrent-build/lt-RC_1_1.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
@rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/

cd "%~dp0"
call lib\initpath

@rem Prepare variables for boost building (ROOT and BUILD_PATH)
set BOOST_ROOT=c:\boost
set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build

@rem Save the original PATH so that it does not keep growing on many runs
set OLDPATH=%PATH%
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86_64;%BOOST_ROOT%;C:\python;C:\msys64\usr\bin
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine\bin.ntx86_64;%BOOST_ROOT%;C:\python

@rem Scrape the latest python version from the main web page
for /f %%i in ('curl -s https://www.python.org/ ^| grep "Latest: " ^| cut -d/ -f5 ^| cut -d" " -f2 ^| tr -d "<"') do set var2=%%i
@rem add -C - so that download is resumed / skipped
curl.exe -C - -O https://www.python.org/ftp/python/%var2%/python-%var2%-amd64.exe
curl -C - -O https://www.python.org/ftp/python/%var2%/python-%var2%-amd64.exe
@rem Install the downloaded python version
python-%var2%-amd64.exe /quiet InstallAllUsers=1 Include_test=0 InstallLauncherAllUsers=0 Include_launcher=0 TargetDir=C:\python

Expand All @@ -28,7 +26,7 @@ for /f %%i in ('echo %BOOST_FOLDER% ^| sed "s/boost_//" ^| tr "_" "."') do set B
curl -C - -LO https://dl.bintray.com/boostorg/release/%BOOST_VERSION%/source/%BOOST_ARCHIVE%

@rem Decompress only one specific boost archive in the folder of this script, -aos for skip extraction if file is already there
"%programfiles%\7-Zip\7z.exe" x %BOOST_ARCHIVE% -o"%~dp0" -aos
7z x %BOOST_ARCHIVE% -o"%~dp0" -aos

@rem try to link the specific boost version's folder in this script's folder to C:\
mklink /d C:\boost "%~dp0\%BOOST_FOLDER%"
Expand Down Expand Up @@ -90,5 +88,4 @@ rd /s /q C:\python
@rem let'a not remove so that download can be resumed / skipped on next run
@rem del python*.exe boost_*.7z

@rem Restore the original PATH so that it does not keep growing on many runs
set PATH=%OLDPATH%
call lib\restorepath
11 changes: 4 additions & 7 deletions libtorrent-build/lt-RC_1_2.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
@rem 2020 Peter Sasi user of the Deluge Forum https://forum.deluge-torrent.org/

cd "%~dp0"
call lib\initpath

@rem Prepare variables for boost building (ROOT and BUILD_PATH)
set BOOST_ROOT=c:\boost
set BOOST_BUILD_PATH=%BOOST_ROOT%\tools\build

@rem Save the original PATH so that it does not keep growing on many runs
set OLDPATH=%PATH%
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine;%BOOST_ROOT%;C:\python;C:\msys64\usr\bin
set PATH=%PATH%;%BOOST_BUILD_PATH%\src\engine;%BOOST_ROOT%;C:\python

@rem Scrape the latest python version from the main web page
for /f %%i in ('curl -s https://www.python.org/ ^| grep "Latest: " ^| cut -d/ -f5 ^| cut -d" " -f2 ^| tr -d "<"') do set var2=%%i
Expand All @@ -28,7 +26,7 @@ for /f %%i in ('echo %BOOST_FOLDER% ^| sed "s/boost_//" ^| tr "_" "."') do set B
curl -C - -LO https://dl.bintray.com/boostorg/release/%BOOST_VERSION%/source/%BOOST_ARCHIVE%

@rem Decompress only one specific boost archive in the folder of this script, -aos for skip extraction if file is already there
"%programfiles%\7-Zip\7z.exe" x %BOOST_ARCHIVE% -o"%~dp0" -aos
7z x %BOOST_ARCHIVE% -o"%~dp0" -aos

@rem try to link the specific boost version's folder in this script's folder to C:\
mklink /d C:\boost "%~dp0\%BOOST_FOLDER%"
Expand Down Expand Up @@ -93,5 +91,4 @@ rd /s /q C:\python
@rem let'a not remove so that download can be resumed / skipped on next run
@rem del python*.exe boost_*.7z

@rem Restore the original PATH so that it does not keep growing on many runs
set PATH=%OLDPATH%
call lib\restorepath

0 comments on commit 270325a

Please sign in to comment.