From c8dfcc7e13c42e1e62e9b5a20f1eeb454f2ca140 Mon Sep 17 00:00:00 2001 From: Egor00f Date: Sat, 16 Nov 2024 16:21:10 +0500 Subject: [PATCH] try fix install.ps1 && other --- .gitignore | 1 + chocolatey/tools/chocolateyInstall.ps1 | 7 +- chocolatey/tools/install.bat | 82 -------------------- install.ps1 | 101 +++++-------------------- 4 files changed, 26 insertions(+), 165 deletions(-) delete mode 100644 chocolatey/tools/install.bat diff --git a/.gitignore b/.gitignore index bbf27a1..22894a1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ package/DEBIAN/copyright package.deb build/ chocolatey/kos32-gcc*.nupkg +chocolatey/install.ps1 \ No newline at end of file diff --git a/chocolatey/tools/chocolateyInstall.ps1 b/chocolatey/tools/chocolateyInstall.ps1 index 219bc25..a2ef121 100644 --- a/chocolatey/tools/chocolateyInstall.ps1 +++ b/chocolatey/tools/chocolateyInstall.ps1 @@ -1,12 +1,13 @@ #NOTE: Please remove any commented lines to tidy up prior to releasing the package, including this one $packageName = 'kos32-gcc' # arbitrary name for the package, used in messages -$url = 'http://ftp.kolibrios.org/users/Serge/new/Toolchain/msys-kos32-5.4.0.7z' # download url $validExitCodes = @(0) #please insert other valid exit codes here, exit codes for ms http://msdn.microsoft.com/en-us/library/aa368542(VS.85).aspx # main helpers - these have error handling tucked into them already # installer, will assert administrative rights -Install-ChocolateyPackage "$packageName" "$installerType" "$silentArgs" "$url" -validExitCodes $validExitCodes +Install-ChocolateyPackage "$packageName" -validExitCodes $validExitCodes -.\install.ps1 \ No newline at end of file +$INSTALL_PATH = Read-Host 'Path to install toolchain(Enter - default)' + +.\install.ps1 -InstallPath $INSTALL_PATH diff --git a/chocolatey/tools/install.bat b/chocolatey/tools/install.bat deleted file mode 100644 index c5568e9..0000000 --- a/chocolatey/tools/install.bat +++ /dev/null @@ -1,82 +0,0 @@ -@echo off - -for /f %%a in ('echo prompt $E^| cmd') do set "ESC=%%a" - - -set DEFAULT_TOOLCHAIN_DIR=C:\MinGW\msys\1.0\home\autobuild\tools - -if [%1] == [] ( - set TOOLCHAIN_DIR=%DEFAULT_TOOLCHAIN_DIR% -) -else ( - set TOOLCHAIN_DIR=%1 -) - - -Call :print_msg Create the %TOOLCHAIN_DIR% folder... - -mkdir %TOOLCHAIN_DIR% - -Call :print_ok Successfully! - - - -call :print_msg Download the kos32-gcc toolchain... - -cd %TOOLCHAIN_DIR% - -wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/msys-kos32-5.4.0.7z -O %TOOLCHAIN_DIR%\kos32-toolchain.7z - -7z x -y %TOOLCHAIN_DIR%\kos32-toolchain.7z -o%TOOLCHAIN_DIR% - -Call :print_ok Successfully! - - - -Call :print_msg Downloading libraries... - -cd %TOOLCHAIN_DIR%\win32\mingw32 - -wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z -O %TOOLCHAIN_DIR%\win32\mingw32\sdk-28-10-16.7z - -7z x -y %TOOLCHAIN_DIR%\win32\mingw32\sdk-28-10-16.7z - -Call :print_ok Successfully! - - - -Call :print_msg Updating libraries - -cd %TOOLCHAIN_DIR%\win32\mingw32\lib - -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libdll.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libdll.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libfreetype.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libfreetype.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libc.dll.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libc.dll.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libSDLn.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libSDLn.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libcurses.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libcurses.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libz.dll.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libz.dll.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libogg.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libogg.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libvorbis.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libvorbis.a -wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libopenjpeg.a -O %TOOLCHAIN_DIR%\win32\mingw32\lib\libopenjpeg.a - -Call :print_ok Successfully! - - - -Call :print_msg Adding C:\MinGW\msys\1.0\home\autobuild\tools\win32\bin to PATH - -set PATH=%PATH%;%TOOLCHAIN_DIR%%\win32\bin - - - -Call :print_ok Installation was successful! - - - -:print_msg - echo %ESC%[34m%*%ESC%[%m -exit /b - -:print_ok - echo %ESC%[32m%*%ESC%[%m -exit /b diff --git a/install.ps1 b/install.ps1 index e0f4a5d..0e343ec 100644 --- a/install.ps1 +++ b/install.ps1 @@ -1,84 +1,42 @@ -#Requires -RunAsAdministrator +#Requires -RunAsAdministrator -if (!Get-Module -ListAvailable -Name 7Zip4PowerShell) +if (Get-Module -ListAvailable -Name 7Zip4PowerShell) +{} +else { Install-Module -Name 7Zip4PowerShell -} - - - -$DEFAULT_InstallPath="C:\MinGW\msys\1.0\home\autobuild\tools" -PSStyle.Progress.View = 'Classic' -$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', - 'libcurses.a', - 'libz.dll.a', - 'libogg.a', - 'libvorbis.a', - 'libopenjpeg.a' } -param ( - [string] $InstallPath=$DEFAULT_InstallPath +$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' + +param( + [string]$InstallPath='C:\MinGW\msys\1.0\home\autobuild\tools' ) -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "toolchain", - PercentComplete = 0, - CurrentOperation = "Create the $InstallPath folder" -} -Write-Progress @OuterLoopProgressParameters +Write-Progress -Activity 'Installing toolchain' -Status 'toolchain' -PercentComplete 0 -CurrentOperation 'Create the $InstallPath folder' mkdir $InstallPath - -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "toolchain", - PercentComplete = 1, - CurrentOperation = "Download the kos32-gcc toolchain" -} -Write-Progress @OuterLoopProgressParameters +Write-Progress -Activity 'Installing toolchain' -Status 'toolchain' -PercentComplete 1 -CurrentOperation 'Download the kos32-gcc toolchain' Invoke-WebRequest http://ftp.kolibrios.org/users/Serge/new/Toolchain/msys-kos32-5.4.0.7z -OutFile $InstallPath\kos32-toolchain.7z -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "toolchain", - PercentComplete = 20, - CurrentOperation = "Unpacking kos32-gcc toolchain" -} -Write-Progress @OuterLoopProgressParameters + +Write-Progress -Activity 'Installing toolchain' -Status 'toolchain' -PercentComplete 20 -CurrentOperation 'Unpacking kos32-gcc toolchain' Expand-7Zip -ArchiveFileName $InstallPath\kos32-toolchain.7z -TargetPath $InstallPath -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "Installing libraries", - PercentComplete = 40, - CurrentOperation = "Downloading libraries" -} -Write-Progress @OuterLoopProgressParameters +Write-Progress -Activity 'Installing toolchain' -Status 'Installing libraries' -PercentComplete 40 -CurrentOperation 'Downloading libraries' Invoke-WebRequest http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z -OutFile $InstallPath\win32\mingw32\sdk-28-10-16.7z -# Unpack libs -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "Installing libraries", - PercentComplete = 50, - CurrentOperation = "Downloading libraries" -} -Write-Progress @OuterLoopProgressParameters + +Write-Progress -Activity 'Installing toolchain' -Status 'Installing libraries' -PercentComplete 50 -CurrentOperation 'Unpacking libraries' Expand-7Zip -ArchiveFileName $InstallPath\win32\mingw32\sdk-28-10-16.7z -TargetPath $InstallPath\win32\mingw32\ @@ -86,26 +44,9 @@ Expand-7Zip -ArchiveFileName $InstallPath\win32\mingw32\sdk-28-10-16.7z -TargetP for (($i = 0); $i -lt $LIST_OF_LIBS.count; $i++) { - $OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "Updating libraries", - PercentComplete = 50+(49 * ($i / $LIST_OF_LIBS.count) ), - CurrentOperation = "download $($LIST_OF_LIBS[$i])" - } - Write-Progress @OuterLoopProgressParameters + Write-Progress -Activity 'Installing toolchain' -Status 'Installing libraries' -PercentComplete 50+(50 * ($i / $LIST_OF_LIBS.count) ) -CurrentOperation = 'download $($LIST_OF_LIBS[$i])' - Invoke-WebRequest $URL_TO_LIBS$LIST_OF_LIBS[$i] -OutFile $InstallPath\win32\mingw32\lib\$LIST_OF_LIBS[$i] + $LINK = "$URL_TO_LIBS/$LIST_OF_LIBS[$i]" + + Invoke-WebRequest $LINK -OutFile $InstallPath\win32\mingw32\lib\$LIST_OF_LIBS[$i] } - - - -$OuterLoopProgressParameters = @{ - Activity = "Installing toolchain" - Status = "Done!", - PercentComplete = 99, - CurrentOperation = "Adding C:\MinGW\msys\1.0\home\autobuild\tools\win32\bin to PATH" -} -Write-Progress @OuterLoopProgressParameters - - -Write-Information -MessageData "Installation was successful!"