From 743ad5a0cd4cb10ec180d5279b85b63466bcf306 Mon Sep 17 00:00:00 2001 From: Egor00f Date: Sun, 17 Nov 2024 16:28:13 +0500 Subject: [PATCH] fix downloading libraries && add remove package && fix powershell script depends in tests --- .github/workflows/test.yml | 5 +++++ chocolatey/tools/chocolateyInstall.ps1 | 2 ++ chocolatey/tools/chocolateyUninstall.ps1 | 2 ++ install.ps1 | 27 ++++++++++++++---------- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e42031..a38e08f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -46,6 +46,11 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install modules + run: | + Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module -Name 7Zip4PowerShell + - name: Run script run: ${{ github.workspace }}\install.ps1 diff --git a/chocolatey/tools/chocolateyInstall.ps1 b/chocolatey/tools/chocolateyInstall.ps1 index a2ef121..43ccc21 100644 --- a/chocolatey/tools/chocolateyInstall.ps1 +++ b/chocolatey/tools/chocolateyInstall.ps1 @@ -11,3 +11,5 @@ Install-ChocolateyPackage "$packageName" -validExitCodes $validExitCodes $INSTALL_PATH = Read-Host 'Path to install toolchain(Enter - default)' .\install.ps1 -InstallPath $INSTALL_PATH + +$env:KOS32GCCPATH = $INSTALL_PATH \ No newline at end of file diff --git a/chocolatey/tools/chocolateyUninstall.ps1 b/chocolatey/tools/chocolateyUninstall.ps1 index e69de29..1a0e319 100644 --- a/chocolatey/tools/chocolateyUninstall.ps1 +++ b/chocolatey/tools/chocolateyUninstall.ps1 @@ -0,0 +1,2 @@ + +rm $env:KOS32GCCPATH -r -f diff --git a/install.ps1 b/install.ps1 index 66fcdf6..120f5ed 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,4 +1,4 @@ - #Requires -RunAsAdministrator +#Requires -RunAsAdministrator param( [string]$InstallPath='C:\MinGW\msys\1.0\home\autobuild\tools' @@ -11,15 +11,13 @@ else Install-Module -Name 7Zip4PowerShell } -$URL_TO_LIBS = "http://builds.kolibrios.org/en_US/data/contrib/sdk/lib" - -$LIST_OF_LIBS = 'libdll.a', 'libfreetype.a', 'libc.dll.a', 'libSDLn.a', 'libSDL_mixer.a', 'libcurses.a', 'libz.dll.a', 'libogg.a', 'libvorbis.a', 'libopenjpeg.a', 'libopenjpeg.a', 'libsqlite3.dll.a', 'libjbig2dec.a' - +$LIBS_PATH = '$InstallPath\win32\mingw32\lib\' +$LIBS_URL = 'http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/' Write-Progress -Activity 'Installing toolchain' -Status 'toolchain' -PercentComplete 0 -CurrentOperation 'Create the $InstallPath folder' -mkdir $InstallPath +mkdir $InstallPath -Force Write-Progress -Activity 'Installing toolchain' -Status 'toolchain' -PercentComplete 1 -CurrentOperation 'Download the kos32-gcc toolchain' @@ -43,11 +41,18 @@ Expand-7Zip -ArchiveFileName $InstallPath\win32\mingw32\sdk-28-10-16.7z -TargetP -for (($i = 0); $i -lt $LIST_OF_LIBS.count; $i++) -{ - Write-Progress -Activity 'Installing toolchain' -Status 'Installing libraries' -PercentComplete 50+(50 * ($i / $LIST_OF_LIBS.count) ) -CurrentOperation = 'download $($LIST_OF_LIBS[$i])' +Write-Progress -Activity 'Installing toolchain' -Status 'Installing libraries' -PercentComplete 60 -CurrentOperation "Download libraries" - $LINK = "$URL_TO_LIBS/$LIST_OF_LIBS[$i]" - Invoke-WebRequest $LINK -OutFile $InstallPath\win32\mingw32\lib\$LIST_OF_LIBS[$i] +$response = Invoke-WebRequest -Uri $LIBS_URL -Method GET + +$files = @( $response.Content -split [environment]::NewLine | ? { $_ -like '*tageswerte*.zip*' } | % { $_ -replace '^(.*>)(tages.*\.zip)<.*', '$2' } ) + +foreach( $file in $files ) { + + Invoke-WebRequest -Uri ($LIBS_URL + $file) -Method GET -OutFile ($LIBS_PATH + $file) } + +Write-Progress -Activity 'Installing toolchain' -Status 'Done!' -PercentComplete 99 -CurrentOperation "end" + +$env:Path += ';$InstallPath\win32\bin'