From d8644e5d70abeee9b4c215f7b3a7dc1847d11cbb Mon Sep 17 00:00:00 2001 From: blue Date: Tue, 10 Oct 2023 13:24:46 -0300 Subject: [PATCH] Packaging and CI attempt 1 --- .gitea/workflows/release.yml | 41 ++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 6 ++++++ CMakeLists.txt | 17 ++++++++++++++- mlc.kdev4 | 3 --- packaging/Archlinux/PKGBUILD | 24 +++++++++++++++++++++ src/CMakeLists.txt | 4 ++-- src/settings.cpp | 4 ++-- 7 files changed, 91 insertions(+), 8 deletions(-) create mode 100644 .gitea/workflows/release.yml delete mode 100644 mlc.kdev4 create mode 100644 packaging/Archlinux/PKGBUILD diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..5eb1b8c --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,41 @@ +name: MLC Release workflow +run-name: ${{ gitea.actor }} is running MLC Release workflow on release ${{ gitea.event.release.tag_name }} +on: + release: + types: [published] + +jobs: + Archlinux: + runs-on: archlinux + steps: + - name: Download the release tarball + uses: curl -sL "${{ gitea.server_url }}/${{ gitea.repository }}/archive/${{ gitea.event.release.tag_name }}.tar.gz" + + - name: Set tarball filename variable + run: echo "tbName=$(echo ${{ gitea.event.repository.name }}-${{ gitea.event.release.tag_name }}.tar.gz)" >> $GITHUB_ENV + + - name: Calculate SHA256 for the tarball + run: echo "tbSum=$(echo sha256sum ${{ env.tbName }} | cut -d " " -f 1" >> $GITHUB_ENV + + - name: Unarchive tarball + run: tar -xvzf ${{ env.tbName }} + + - name: Create a directory + run: mkdir aur + + - name: Copy PKGBUILD to the directory + run: cp mlc/packaging/Archlinux/PKGBUILD aur/ + + - name: Put SHA256 sum to PKGBUILD file + working-directory: aur + run: sed -i "/sha256sums=/c\sha256sums=('${{ env.tbSum }}')" PKGBUILD + + - name: create SRCINFO + working-directory: aur + run: makepkg --printsrcinfo > .SRCINFO + + - name: Debug print PKGBUILD + run: cat aur/PKGBUILD + + - name: Debug print .SRCINFO + run: cat aur/.SRCINFO diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f4c444..73323f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## MLC 1.3.1 (October 10, 2023) +- Release build with optimisations +- Removed unused files from build +- Suppressed warnings +- CI to release to AUR + ## MLC 1.3.0 (October 09, 2023) - Config file to control the process - First help page diff --git a/CMakeLists.txt b/CMakeLists.txt index 3114df2..6c02ded 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,27 @@ cmake_minimum_required(VERSION 3.5) project( mlc - VERSION 1.3.0 + VERSION 1.3.1 DESCRIPTION "Media Library Compiler: rips your media library to a lossy compilation" LANGUAGES CXX ) cmake_policy(SET CMP0076 NEW) cmake_policy(SET CMP0079 NEW) +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug) +endif () + +if (CMAKE_BUILD_TYPE STREQUAL "Release") + list(APPEND COMPILE_OPTIONS -O3) +elseif (CMAKE_BUILD_TYPE STREQUAL "Debug") + list(APPEND COMPILE_OPTIONS -g) + list(APPEND COMPILE_OPTIONS -Wall) + list(APPEND COMPILE_OPTIONS -Wextra) +endif() + +message("Compilation options: " ${COMPILE_OPTIONS}) + set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") @@ -20,6 +34,7 @@ pkg_check_modules(LAME REQUIRED IMPORTED_TARGET lame) pkg_check_modules(TAGLIB REQUIRED IMPORTED_TARGET taglib) add_executable(mlc) +target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) add_subdirectory(src) diff --git a/mlc.kdev4 b/mlc.kdev4 deleted file mode 100644 index 4680c1f..0000000 --- a/mlc.kdev4 +++ /dev/null @@ -1,3 +0,0 @@ -[Project] -Name=mlc -Manager=KDevCMakeManager diff --git a/packaging/Archlinux/PKGBUILD b/packaging/Archlinux/PKGBUILD new file mode 100644 index 0000000..d65afb0 --- /dev/null +++ b/packaging/Archlinux/PKGBUILD @@ -0,0 +1,24 @@ +# Maintainer: Yury Gubich +pkgname=mlc +pkgver=1.3.1 +pkgrel=1 +pkgdesc="Media Library Compiler: rips your media library to a lossy compilation" +arch=('i686' 'x86_64') +url="https://git.macaw.me/blue/mlc" +license=('GPL3') +depends=('flac' 'lame' 'libjpeg' 'taglib') +makedepends=('cmake>=3.5' 'gcc>=7.0') +optdepends=() + +source=("$pkgname-$pkgver.tar.gz::https://git.macaw.me/blue/$pkgname/archive/$pkgver.tar.gz") +sha256sums=('SKIP') +build() { + cd "$srcdir/$pkgname" + cmake . -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_BUILD_TYPE=Release + cmake --build . +} +package() { + cd "$srcdir/$pkgname" + DESTDIR="$pkgdir/" cmake --install . +} + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07770c0..1b1bfdd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,7 @@ endfunction(make_includable) set(SOURCES main.cpp help.cpp - decoded.cpp + #decoded.cpp flactomp3.cpp collection.cpp taskmanager.cpp @@ -17,7 +17,7 @@ set(SOURCES set(HEADERS help.h - decoded.h + #decoded.h flactomp3.h collection.h taskmanager.h diff --git a/src/settings.cpp b/src/settings.cpp index 019eff5..53eaa0a 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -48,7 +48,7 @@ bool is_space(char ch){ } Flag getFlag(const std::string_view arg) { - for (int i = 0; i < flags.size(); ++i) { + for (unsigned char i = 0; i < flags.size(); ++i) { const Literals& lit = flags[i]; unsigned char dist = std::distance(lit.begin(), std::find(lit.begin(), lit.end(), arg)); if (dist < lit.size()) @@ -82,7 +82,7 @@ Settings::Settings(int argc, char ** argv): void Settings::parseArguments() { Flag flag = Flag::none; - for (int i = 0; i < arguments.size(); ++i) { + for (unsigned int i = 0; i < arguments.size(); ++i) { const std::string_view& arg = arguments[i]; if (i == 0) { Action act = stringToAction(arg);