academic/openboard: Switch to cmake

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Willy Sudiarto Raharjo 2024-09-16 00:24:55 +07:00
parent 585c6dda5e
commit bea15bf7b1
No known key found for this signature in database
GPG key ID: 3F617144D7238786
6 changed files with 276 additions and 14 deletions

View file

@ -0,0 +1,83 @@
From 4f45b6c4016972cf5835f9188bda6197b1b4ed2f Mon Sep 17 00:00:00 2001
From: Vekhir <Vekhir@yahoo.com>
Date: Tue, 18 Jun 2024 06:18:32 +0200
Subject: [PATCH 1/2] 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);
From 315bcac782e10cc6ceef1fc8b78fff40541ea38f Mon Sep 17 00:00:00 2001
From: Vekhir <Vekhir@yahoo.com>
Date: Tue, 18 Jun 2024 06:20:15 +0200
Subject: [PATCH 2/2] 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);
}

View file

@ -0,0 +1,126 @@
From 6a0be1b4607da3c3eb9b7d8b547e7b489bc2d219 Mon Sep 17 00:00:00 2001
From: Vekhir <Vekhir@yahoo.com>
Date: Tue, 14 May 2024 13:47:34 +0200
Subject: [PATCH] fix: Add compatibility with C++20
C++20 and Qt5 have an issue with string literals, probably related
to char/QString conversion. The QStringLiteral macro allows using
literals without automatic conversion to QString. Fixes
https://github.com/OpenBoard-org/OpenBoard/issues/958#issuecomment-2109169685
---
src/domain/UBGraphicsWidgetItem.cpp | 92 ++++++++++++++---------------
1 file changed, 46 insertions(+), 46 deletions(-)
diff --git a/src/domain/UBGraphicsWidgetItem.cpp b/src/domain/UBGraphicsWidgetItem.cpp
index 6e3c94a10..b9b4dffb8 100644
--- a/src/domain/UBGraphicsWidgetItem.cpp
+++ b/src/domain/UBGraphicsWidgetItem.cpp
@@ -75,62 +75,62 @@ const QMap<Qt::Key, QString> UBGraphicsWidgetItem::sDeadKeys
const QMap<QString, QString> UBGraphicsWidgetItem::sAccentedCharacters
{
// Dead Key: ^
- {"^a", u8"â"},
- {"^A", u8"Â"},
- {"^e", u8"ê"},
- {"^E", u8"Ê"},
- {"^i", u8"î"},
- {"^I", u8"Î"},
- {"^o", u8"ô"},
- {"^O", u8"Ô"},
- {"^u", u8"û"},
- {"^U", u8"Û"},
+ {"^a", QStringLiteral(u"â")},
+ {"^A", QStringLiteral(u"Â")},
+ {"^e", QStringLiteral(u"ê")},
+ {"^E", QStringLiteral(u"Ê")},
+ {"^i", QStringLiteral(u"î")},
+ {"^I", QStringLiteral(u"Î")},
+ {"^o", QStringLiteral(u"ô")},
+ {"^O", QStringLiteral(u"Ô")},
+ {"^u", QStringLiteral(u"û")},
+ {"^U", QStringLiteral(u"Û")},
// Dead Key: ´
- {"´a", u8"á"},
- {"´A", u8"Á"},
- {"´e", u8"é"},
- {"´E", u8"É"},
- {"´i", u8"í"},
- {"´I", u8"Í"},
- {"´o", u8"ó"},
- {"´O", u8"Ó"},
- {"´u", u8"ú"},
- {"´U", u8"Ú"},
+ {"´a", QStringLiteral(u"á")},
+ {"´A", QStringLiteral(u"Á")},
+ {"´e", QStringLiteral(u"é")},
+ {"´E", QStringLiteral(u"É")},
+ {"´i", QStringLiteral(u"í")},
+ {"´I", QStringLiteral(u"Í")},
+ {"´o", QStringLiteral(u"ó")},
+ {"´O", QStringLiteral(u"Ó")},
+ {"´u", QStringLiteral(u"ú")},
+ {"´U", QStringLiteral(u"Ú")},
// Dead Key: `
- {"`a", u8"à"},
- {"`A", u8"À"},
- {"`e", u8"è"},
- {"`E", u8"È"},
- {"`i", u8"ì"},
- {"`I", u8"Ì"},
- {"`o", u8"ò"},
- {"`O", u8"Ò"},
- {"`u", u8"ù"},
- {"`U", u8"Ù"},
+ {"`a", QStringLiteral(u"à")},
+ {"`A", QStringLiteral(u"À")},
+ {"`e", QStringLiteral(u"è")},
+ {"`E", QStringLiteral(u"È")},
+ {"`i", QStringLiteral(u"ì")},
+ {"`I", QStringLiteral(u"Ì")},
+ {"`o", QStringLiteral(u"ò")},
+ {"`O", QStringLiteral(u"Ò")},
+ {"`u", QStringLiteral(u"ù")},
+ {"`U", QStringLiteral(u"Ù")},
// Dead Key: ~
- {"~n", u8"ñ"},
- {"~N", u8"Ñ"},
+ {"~n", QStringLiteral(u"ñ")},
+ {"~N", QStringLiteral(u"Ñ")},
// Dead Key: '
- {"'c", u8"ç"},
- {"'C", u8"Ç"},
+ {"'c", QStringLiteral(u"ç")},
+ {"'C", QStringLiteral(u"Ç")},
// Dead Key: ¨
- {"¨a", u8"ä"},
- {"¨A", u8"Ä"},
- {"¨e", u8"ë"},
- {"¨E", u8"Ë"},
- {"¨i", u8"ï"},
- {"¨I", u8"Ï"},
- {"¨o", u8"ö"},
- {"¨O", u8"Ö"},
- {"¨u", u8"ü"},
- {"¨U", u8"Ü"},
- {"¨y", u8"ÿ"},
- {"¨Y", u8"Ÿ"}
+ {"¨a", QStringLiteral(u"ä")},
+ {"¨A", QStringLiteral(u"Ä")},
+ {"¨e", QStringLiteral(u"ë")},
+ {"¨E", QStringLiteral(u"Ë")},
+ {"¨i", QStringLiteral(u"ï")},
+ {"¨I", QStringLiteral(u"Ï")},
+ {"¨o", QStringLiteral(u"ö")},
+ {"¨O", QStringLiteral(u"Ö")},
+ {"¨u", QStringLiteral(u"ü")},
+ {"¨U", QStringLiteral(u"Ü")},
+ {"¨y", QStringLiteral(u"ÿ")},
+ {"¨Y", QStringLiteral(u"Ÿ")}
};
#endif

View file

@ -1,3 +1,10 @@
if [ -x /usr/bin/update-desktop-database ]; then
/usr/bin/update-desktop-database -q usr/share/applications
fi
if [ -e usr/share/icons/hicolor/icon-theme.cache ]; then
if [ -x /usr/bin/gtk-update-icon-cache ]; then
/usr/bin/gtk-update-icon-cache -f usr/share/icons/hicolor >/dev/null 2>&1
fi
fi

View file

@ -0,0 +1,39 @@
From ffeea1b662b012bd25a025f2130fa2c2044919f9 Mon Sep 17 00:00:00 2001
From: Vekhir <Vekhir@yahoo.com>
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)

View file

@ -28,7 +28,7 @@ PRGNAM=openboard
SRCNAM=OpenBoard
VERSION=${VERSION:-1.7.1}
SRCVER=$(echo $VERSION | tr _ -)
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@ -78,28 +78,35 @@ find -L . \
patch -p1 < $CWD/quazip.patch
sed -i "s|lquazip5|lquazip1-qt5|g" OpenBoard.pro
patch -p1 < $CWD/1017.patch
patch -p1 < $CWD/6a0be1b4607da3c3eb9b7d8b547e7b489bc2d219.patch
patch -p1 < $CWD/ffeea1b662b012bd25a025f2130fa2c2044919f9.patch
# Add changes for current
# Thanks to Robby Workman for the idea
QUAZIPVER=$( pkg-config --modversion quazip1-qt5 )
sed -i "s|QuaZip-Qt5-1.1|QuaZip-Qt5-$QUAZIPVER|g" OpenBoard.pro plugins/cffadaptor/UBCFFAdaptor.pro
qmake-qt5 OpenBoard.pro -spec linux-g++
make
mkdir -p build
cd build
cmake \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DQT_VERSION=5 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_CXX_STANDARD=20 \
-DQuaZip-Qt5_DIR=/usr/include/QuaZip-Qt5-$QUAZIPVER/ \
-DCMAKE_BUILD_TYPE=Release ..
make
make install/strip DESTDIR=$PKG
cd ..
mkdir -p $PKG/opt/openboard $PKG/usr/share/applications/ $PKG/usr/bin
mkdir -p $PKG/usr/share/{applications,openboard,icons/hicolor/64x64/apps}/ $PKG/usr/bin
for i in customizations etc i18n library; do
cp -rp resources/$i $PKG/opt/openboard;
cp -rp resources/$i $PKG/usr/share/openboard/;
done
cp -rp resources/images/OpenBoard.png $PKG/opt/openboard/
cp -rp build/linux/release/product/OpenBoard $PKG/opt/openboard/
install -D -m 644 $CWD/openboard.desktop $PKG/usr/share/applications/openboard.desktop
(
cd $PKG/usr/bin
ln -s /opt/openboard/OpenBoard $PKG/usr/bin/openboard
)
strip --strip-unneeded /$PKG/opt/openboard/OpenBoard
cp -rp resources/images/OpenBoard.png $PKG/usr/share/icons/hicolor/64x64/apps/
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

View file

@ -3,7 +3,7 @@ Type=Application
Name=OpenBoard
Comment=OpenBoard, an interactive white board application
Exec=openboard %f
Icon=/opt/openboard/OpenBoard.png
Icon=OpenBoard
StartupNotify=true
Terminal=false
MimeType=application/ubz