From 83b9582c31478ffcd682e06a844110ef54eff0b7 Mon Sep 17 00:00:00 2001 From: Egor00f Date: Fri, 8 Nov 2024 15:33:38 +0000 Subject: [PATCH] use cmake for build package --- .github/workflows/test.yml | 31 ++++++++++++++++++------------- .gitignore | 1 + CMakeLists.txt | 19 +++++++++++++++++++ build-package.sh | 4 ---- install.sh | 22 +++++++++++++--------- package/DEBIAN/control | 5 +++-- package/DEBIAN/postrm | 1 + 7 files changed, 55 insertions(+), 28 deletions(-) create mode 100644 CMakeLists.txt delete mode 100755 build-package.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a5900be..9c6cab7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,24 +47,29 @@ jobs: kos32-gcc -v shell: cmd + build-Installer: + runs-on: windowd-latest + steps: + - uses: actions/checkout@v4 + + - name: Build + run: | + cmake -B ${{ github.workspace }}/build + cmake --build ${{ github.workspace }}/build --target Installer + build-package: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - - name: build - run: ${{ github.workspace }}/./build-package.sh - + + - name: Build + run: | + cmake -B ${{ github.workspace }}/build + cmake --build ${{ github.workspace }}/build --target Package + - name: Install package run: sudo apt install ${{ github.workspace }}/package.deb - + - name: Add toolchain to path run: echo "/home/autobuild/tools/win32/bin" >> $GITHUB_PATH - - - - name: Test run - run: | - kos32-g++ -v - kos32-gcc -v - - + diff --git a/.gitignore b/.gitignore index 50b5b4c..5317c62 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ Output/ package/DEBIAN/postinst package.deb +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c60ca3c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,19 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 3.10) + +project( + KolibriOS-gcc-Toolchain-installer + DESCRIPTION "Installer of gcc toolchain for KolibriOS" +) + + +add_custom_target( + Package + COMMAND cp -f ${CMAKE_CURRENT_SOURCE_DIR}/install.sh ${CMAKE_CURRENT_SOURCE_DIR}/package/DEBIAN/postinst + COMMAND dpkg-deb --build ${CMAKE_CURRENT_SOURCE_DIR}/package ${CMAKE_CURRENT_BINARY_DIR}/package.deb + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +) + +add_custom_target( + Installer + COMMAND iscc /O"${CMAKE_CURRENT_BINARY_DIR}" ${CMAKE_CURRENT_SOURCE_DIR}/installator.iss +) diff --git a/build-package.sh b/build-package.sh deleted file mode 100755 index b95806a..0000000 --- a/build-package.sh +++ /dev/null @@ -1,4 +0,0 @@ - -cp -f install.sh package/DEBIAN/postinst - -dpkg-deb --build ./package diff --git a/install.sh b/install.sh index b9b40a6..3b11007 100755 --- a/install.sh +++ b/install.sh @@ -28,6 +28,10 @@ check_utils(){ fi } +pwd + +TOOLCHAIN_DIR="/home/autobuild/tools" + print_msg "Checking utilities..." @@ -40,9 +44,7 @@ check_utils 7z print_msg "Create the /home/autobuild folder..." -sudo rm -rf ~/autobuild /home/autobuild -mkdir -p ~/autobuild/tools -sudo ln -sf ~/autobuild /home/autobuild +mkdir -fp $TOOLCHAIN_DIR print_ok "Successfully!" @@ -50,7 +52,7 @@ print_ok "Successfully!" print_msg "Download the kos32-gcc toolchain..." -wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z -q -O ~/autobuild/tools/kos32-toolchain.7z +wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/x86_64-linux-kos32-5.4.0.7z -q -O $TOOLCHAIN_DIR/kos32-toolchain.7z print_ok "Successfully!" @@ -58,7 +60,7 @@ print_ok "Successfully!" print_msg "Extracting files ..." -cd ~/autobuild/tools/ +cd $TOOLCHAIN_DIR 7z x -y kos32-toolchain.7z rm -rf kos32-toolchain.7z @@ -68,7 +70,7 @@ print_ok "Successfully!" print_msg "Downloading libraries..." -cd ~/autobuild/tools/win32/mingw32 +cd $TOOLCHAIN_DIR/win32/mingw32 wget http://ftp.kolibrios.org/users/Serge/new/Toolchain/sdk-28-10-16.7z -q -O sdk-28-10-16.7z 7z x -y sdk-28-10-16.7z rm -rf sdk-28-10-16.7z @@ -121,10 +123,12 @@ sudo ln -sf /usr/lib/libmpfr.so.6 /usr/lib/libmpfr.so.4 print_ok "Successfully!" -if ! grep -q 'export PATH=$PATH:/home/autobuild/tools/win32/bin' ~/.bashrc; then +if ! grep -q 'export PATH=$PATH:$TOOLCHAIN_DIR/win32/bin' ~/.bashrc; then export PATH=$PATH:/home/autobuild/tools/win32/bin - print_msg "Adding '/home/autobuild/tools/win32/bin' to '~/.bashrc'" - echo 'export PATH=$PATH:/home/autobuild/tools/win32/bin' >> ~/.bashrc + print_msg "Adding '$TOOLCHAIN_DIR/win32/bin' to '~/.bashrc'" + echo 'export PATH=$PATH:$TOOLCHAIN_DIR/win32/bin' >> ~/.bashrc fi +cd "$OLDPWD" + print_ok "Installation was successful!" diff --git a/package/DEBIAN/control b/package/DEBIAN/control index d6cc1d2..7fe8bba 100644 --- a/package/DEBIAN/control +++ b/package/DEBIAN/control @@ -7,5 +7,6 @@ Depends: libc6-i386:amd64, libmpc3:amd64 Pre-Depends: p7zip, wget Recommends: fasm Priority: optional -Origin: https://github.com/Egor00f/kolibrios-gcc-toolchain, -Maintainer: Egor00f +Origin: https://github.com/Egor00f/kolibrios-gcc-toolchain +Maintainer: Egor00f +Installed-Size: 131708 diff --git a/package/DEBIAN/postrm b/package/DEBIAN/postrm index b340d69..6e9c374 100755 --- a/package/DEBIAN/postrm +++ b/package/DEBIAN/postrm @@ -1,2 +1,3 @@ +#!/bin/bash rm -R /home/autobuild/tools/win32