Skip to content

Commit

Permalink
user/openboard: new package
Browse files Browse the repository at this point in the history
  • Loading branch information
breakgimme authored and nekopsykose committed Oct 2, 2024
1 parent 011484c commit 2b359f6
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 0 deletions.
1 change: 1 addition & 0 deletions user/openboard-locale
41 changes: 41 additions & 0 deletions user/openboard/patches/cxx-standard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Patch-Source: https://github.com/OpenBoard-org/OpenBoard/commit/09c2e2573767d56e6c95277c3f53071f5282cf4a
--
From ffeea1b662b012bd25a025f2130fa2c2044919f9 Mon Sep 17 00:00:00 2001
From: Vekhir <[email protected]>
Date: Mon, 13 May 2024 10:58:33 +0200
Subject: [PATCH] fix: Make CMAKE_CXX_STANDARD a cache variable

poppler 24.05 exposes std::string::starts_with in its headers
which requires C++20. Requiring C++20 means dropping support
for still maintained distributions. As such, the C++ standard
defaults to the current C++17, but can be overridden where
necessary.

Emit a status message showing the chosen C++ standard for debug
purposes.
---
CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 97ad4f50f..33a5599b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -80,7 +80,7 @@ set(OPENBOARD_MIMEICON_FILE resources/linux/ch.openboard.application-ubz.svg)
# Basic compiler settings
# ==========================================================================

-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to use - defaults to C++17")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
@@ -89,6 +89,8 @@ list(APPEND CMAKE_AUTOUIC_SEARCH_PATHS
${OPENBOARD_FORMS_DIR}
)

+message(STATUS "Using C++" ${CMAKE_CXX_STANDARD})
+
# OpenMP support
include(FindOpenMP)

47 changes: 47 additions & 0 deletions user/openboard/patches/fix-ffmpeg7-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Patch-Source: https://github.com/OpenBoard-org/OpenBoard/commit/4f45b6c4016972cf5835f9188bda6197b1b4ed2f
--
From 4f45b6c4016972cf5835f9188bda6197b1b4ed2f Mon Sep 17 00:00:00 2001
From: Vekhir <[email protected]>
Date: Tue, 18 Jun 2024 06:18:32 +0200
Subject: [PATCH] fix: Support FFmpeg 7.0

The `channels` attribute was deprecated for a long time and has finally
been removed with 7.0.
Use `ch_layout.nb_channels` which is the recommended alternative.
---
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp b/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
index b7c3f944c..bd25946d8 100644
--- a/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
+++ b/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
@@ -520,7 +520,12 @@ bool UBFFmpegVideoEncoder::init()
}

// Buffer for resampled/converted audio
- mAudioOutBuffer = av_audio_fifo_alloc(c->sample_fmt, c->channels, c->frame_size);
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 3, 100)
+ int nb_channels = c->channels;
+#else
+ int nb_channels = c->ch_layout.nb_channels;
+#endif
+ mAudioOutBuffer = av_audio_fifo_alloc(c->sample_fmt, nb_channels, c->frame_size);
}


@@ -639,8 +644,13 @@ void UBFFmpegVideoEncoder::processAudio(QByteArray &data)
uint8_t ** outSamples = nullptr;
int outSamplesLineSize;

+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 3, 100)
+ int nb_channels = codecContext->channels;
+#else
+ int nb_channels = codecContext->ch_layout.nb_channels;
+#endif
ret = av_samples_alloc_array_and_samples(&outSamples, &outSamplesLineSize,
- codecContext->channels, outSamplesCount,
+ nb_channels, outSamplesCount,
codecContext->sample_fmt, 0);
if (ret < 0) {
qWarning() << "Could not allocate audio samples" << avErrorToQString(ret);
39 changes: 39 additions & 0 deletions user/openboard/patches/fix-ffmpeg7-warnings.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Patch-Source: https://github.com/OpenBoard-org/OpenBoard/commit/315bcac782e10cc6ceef1fc8b78fff40541ea38f
--
From 315bcac782e10cc6ceef1fc8b78fff40541ea38f Mon Sep 17 00:00:00 2001
From: Vekhir <[email protected]>
Date: Tue, 18 Jun 2024 06:20:15 +0200
Subject: [PATCH] fix: Resolve FFmpeg 7.0 warnings

`avcodec_close` has been discouraged from use since 2.3 and is
formally deprecated with 7.0. Use `avcodec_free_context` instead.

`avcodec_free_context` takes a double pointer as argument.
---
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp b/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
index bd25946d8..24451f27a 100644
--- a/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
+++ b/src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
@@ -746,11 +746,19 @@ void UBFFmpegVideoEncoder::finishEncoding()
av_write_trailer(mOutputFormatContext);
avio_close(mOutputFormatContext->pb);

+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 3, 100)
avcodec_close(mVideoCodecContext);
+#else
+ avcodec_free_context(&mVideoCodecContext);
+#endif
sws_freeContext(mSwsContext);

if (mShouldRecordAudio) {
+#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 3, 100)
avcodec_close(mAudioCodecContext);
+#else
+ avcodec_free_context(&mAudioCodecContext);
+#endif
swr_free(&mSwrContext);
}

30 changes: 30 additions & 0 deletions user/openboard/template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
pkgname = "openboard"
pkgver = "1.7.1"
pkgrel = 0
build_style = "cmake"
configure_args = ["-DCMAKE_CXX_STANDARD=20"]
hostmakedepends = ["cmake", "ninja", "pkgconf"]
makedepends = [
"ffmpeg-devel",
"openssl-devel",
"poppler-devel",
"qt6-qt5compat-devel",
"qt6-qtbase-devel",
"qt6-qtmultimedia-devel",
"qt6-qtsvg-devel",
"qt6-qttools-devel",
"qt6-qtwebengine-devel",
"quazip-devel",
]
pkgdesc = "Interactive whiteboard application"
maintainer = "breakgimme <[email protected]>"
license = "GPL-3.0-or-later"
url = "https://openboard.ch"
source = f"https://github.com/OpenBoard-org/OpenBoard/archive/refs/tags/v{pkgver}.tar.gz"
sha256 = "5c9fcb54bc1598b4b7026e6ecca07137660dd3d45bda472a5710acf600a2a22f"


@subpackage("openboard-locale")
def _(self):
self.install_if = [self.parent, "base-locale"]
return ["usr/share/openboard/i18n"]

0 comments on commit 2b359f6

Please sign in to comment.