Packaging and CI attempt 1

This commit is contained in:
Blue 2023-10-10 13:24:46 -03:00
parent e266008e11
commit d8644e5d70
Signed by: blue
GPG Key ID: 9B203B252A63EE38
7 changed files with 91 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -1,3 +0,0 @@
[Project]
Name=mlc
Manager=KDevCMakeManager

View File

@ -0,0 +1,24 @@
# Maintainer: Yury Gubich <blue@macaw.me>
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 .
}

View File

@ -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

View File

@ -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);