From dfde28f76f9ce7a5d11229a2a4130085cb9d01d7 Mon Sep 17 00:00:00 2001 From: Egor00f Date: Thu, 14 Nov 2024 21:26:34 +0500 Subject: [PATCH] add chocolatey & add test for chocolatey package --- .github/workflows/test.yml | 21 ++- CMakeLists.txt | 12 +- chocolatey/kos32-gcc.nuspec | 28 ++++ chocolatey/tools/chocolateyInstall.ps1 | 12 ++ chocolatey/tools/chocolateyUninstall.ps1 | 0 chocolatey/tools/install.bat | 82 +++++++++ install.ps1 | 202 +++++++++++++++++++++++ installator.iss | 2 +- package/DEBIAN/control | 2 +- 9 files changed, 356 insertions(+), 5 deletions(-) create mode 100644 chocolatey/kos32-gcc.nuspec create mode 100644 chocolatey/tools/chocolateyInstall.ps1 create mode 100644 chocolatey/tools/chocolateyUninstall.ps1 create mode 100644 chocolatey/tools/install.bat create mode 100644 install.ps1 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4f7c40..5a8bff7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -59,7 +59,7 @@ jobs: path: './build/installer.exe' # Test Package - package: + deb-package: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -72,7 +72,7 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: package + name: deb-package # Upload entire repository path: './build/package.deb' @@ -94,3 +94,20 @@ jobs: - name: Remove package run: sudo apt remove kos32-gcc + #Test chocolatey package + chocolatey-package: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + cmake -B ${{ github.workspace }}/build + cmake --build ${{ github.workspace }}/build --target + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: choco-package + # Upload entire repository + path: './build/' diff --git a/CMakeLists.txt b/CMakeLists.txt index 1277121..62faa24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ project( add_custom_target( - Package + deb COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/install.sh ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/postinst COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/copyright COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN @@ -18,9 +18,19 @@ add_custom_target( COMMAND chmod 775 ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/copyright COMMAND dpkg-deb --build ${CMAKE_CURRENT_SOURCE_DIR}/package ${CMAKE_CURRENT_BINARY_DIR}/package.deb WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Build deb package" ) add_custom_target( Installer COMMAND iscc /O"${CMAKE_CURRENT_BINARY_DIR}" ${CMAKE_CURRENT_SOURCE_DIR}/installator.iss + COMMENT "Build windows installer" +) + +add_custom_target( + choco + COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/install.ps1 ${CMAKE_CURRENT_SOURCE_DIR}/chocolatey/tools + COMMAND choco pack + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/chocolatey + COMMENT "Build chocolatey package" ) diff --git a/chocolatey/kos32-gcc.nuspec b/chocolatey/kos32-gcc.nuspec new file mode 100644 index 0000000..3585e34 --- /dev/null +++ b/chocolatey/kos32-gcc.nuspec @@ -0,0 +1,28 @@ + + + + + + kos32-gcc + KolibriOS gcc toolchain installer + 0.1.5 + Egor00f + Egor00f + __REPLACE__ + _KolibriOS gcc toolchain installer. This package installing KolibriOS gcc toolchain by Serge. + https://github.com/Egor00f/kolibrios-gcc-toolchain/ + kolibrios toolchain compiler c/C++ + + https://github.com/Egor00f/kolibrios-gcc-toolchain/blob/main/LICENSE + false + + + + + + + + + \ No newline at end of file diff --git a/chocolatey/tools/chocolateyInstall.ps1 b/chocolatey/tools/chocolateyInstall.ps1 new file mode 100644 index 0000000..219bc25 --- /dev/null +++ b/chocolatey/tools/chocolateyInstall.ps1 @@ -0,0 +1,12 @@ +#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.ps1 \ No newline at end of file diff --git a/chocolatey/tools/chocolateyUninstall.ps1 b/chocolatey/tools/chocolateyUninstall.ps1 new file mode 100644 index 0000000..e69de29 diff --git a/chocolatey/tools/install.bat b/chocolatey/tools/install.bat new file mode 100644 index 0000000..c5568e9 --- /dev/null +++ b/chocolatey/tools/install.bat @@ -0,0 +1,82 @@ +@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 new file mode 100644 index 0000000..ec24beb --- /dev/null +++ b/install.ps1 @@ -0,0 +1,202 @@ +@echo off + +$DEFAULT_TOOLCHAIN_DIR="C:\MinGW\msys\1.0\home\autobuild\tools" +PSStyle.Progress.View = 'Classic' + +if () +{ + $TOOLCHAIN_DIR=$DEFAULT_TOOLCHAIN_DIR +} +else +{ + $TOOLCHAIN_DIR=%1 +} + + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "toolchain", + PercentComplete = 0, + CurrentOperation = "Create the $TOOLCHAIN_DIR folder" +} +Write-Progress @OuterLoopProgressParameters + +mkdir $TOOLCHAIN_DIR + + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "toolchain", + PercentComplete = 1, + CurrentOperation = "Download the kos32-gcc toolchain" +} +Write-Progress @OuterLoopProgressParameters + +wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/msys-kos32-5.4.0.7z -O $TOOLCHAIN_DIR\kos32-toolchain.7z + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "toolchain", + PercentComplete = 20, + CurrentOperation = "Unpacking kos32-gcc toolchain" +} +Write-Progress @OuterLoopProgressParameters + +7z x -y $TOOLCHAIN_DIR\kos32-toolchain.7z -o$TOOLCHAIN_DIR + + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Installing libraries", + PercentComplete = 40, + CurrentOperation = "Downloading libraries" +} +Write-Progress @OuterLoopProgressParameters + + +wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z -O $TOOLCHAIN_DIR\win32\mingw32\sdk-28-10-16.7z + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Installing libraries", + PercentComplete = 50, + CurrentOperation = "Downloading libraries" +} +Write-Progress @OuterLoopProgressParameters + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Installing libraries", + PercentComplete = 60, + CurrentOperation = "unpacking libraries" +} +Write-Progress @OuterLoopProgressParameters + +7z x -y $TOOLCHAIN_DIR\win32\mingw32\sdk-28-10-16.7z + + + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 65, + CurrentOperation = "download libdll.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libdll.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libdll.a + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 67, + CurrentOperation = "download libfreetype.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libfreetype.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libfreetype.a + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 70, + CurrentOperation = "download libc.dll.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libc.dll.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libc.dll.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 75, + CurrentOperation = "download libSDLn.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libSDLn.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libSDLn.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 78, + CurrentOperation = "download libcurses.a " +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libcurses.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libcurses.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 82, + CurrentOperation = "download libz.dll.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libz.dll.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libz.dll.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 85, + CurrentOperation = "download libogg.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libogg.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libogg.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 88, + CurrentOperation = "download libvorbis.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libvorbis.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libvorbis.a + + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Updating libraries", + PercentComplete = 95, + CurrentOperation = "download libopenjpeg.a" +} +Write-Progress @OuterLoopProgressParameters + +wget http://builds.kolibrios.org/en_US/data/contrib/sdk/lib/libopenjpeg.a -O $TOOLCHAIN_DIR\win32\mingw32\lib\libopenjpeg.a + + + +$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 + +set PATH=%PATH%;$TOOLCHAIN_DIR%\win32\bin + +$OuterLoopProgressParameters = @{ + Activity = "Installing toolchain" + Status = "Done!", + PercentComplete = 100, + CurrentOperation = "download libdll.a" +} +Write-Progress @OuterLoopProgressParameters + + +Write-Information -MessageData "Installation was successful!" diff --git a/installator.iss b/installator.iss index f48e834..e416bc1 100644 --- a/installator.iss +++ b/installator.iss @@ -2,7 +2,7 @@ ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! #define MyAppName "KolibriOS gcc toolchain" -#define MyAppVersion "0.1.4" +#define MyAppVersion "0.1.5" #define MyAppPublisher "Egor00f" #define MyAppURL "https://github.com/Egor00f/kolibrios-gcc-toolchain" diff --git a/package/DEBIAN/control b/package/DEBIAN/control index 31fdda7..b2acc75 100755 --- a/package/DEBIAN/control +++ b/package/DEBIAN/control @@ -1,5 +1,5 @@ Package: kos32-gcc -Version: 0.1.4 +Version: 0.1.5 Architecture: all Section: devel Depends: libc6-i386:amd64, libmpc3:amd64