1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

appimage: Add a few hacks that are currently needed to build an AppImage

* Apply a patch to latest pinentry to make it build with Qt 5.9
* Copy appimage.desktop and speedo.mk with appimage support which are
not yet available in gnupg (outside of the work branch)

GnuPG-bug-id: 5598
This commit is contained in:
Ingo Klöcker 2021-09-15 12:01:57 +02:00
parent 1e32524494
commit e43ff7868f
4 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,104 @@
From c68d80e23a860a06e7b22b6c0d72aed5d049faef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
Date: Tue, 14 Sep 2021 18:12:44 +0200
Subject: [PATCH] qt: Support building with Qt 5.9
* qt/pinlineedit.cpp (class PinLineEdit::Private): Add field q.
(PinLineEdit::Private::Private): New.
(PinLineEdit::Private::copyToClipboard): Remove obsolete parameter.
Use new field q instead.
(PinLineEdit::Private::selectionEnd): New.
(PinLineEdit::PinLineEdit): Pass this to Private.
(PinLineEdit::setFormattedPassphrase): Use new selectionEnd.
(PinLineEdit::copy): Call copyToClipboard without parameter.
--
QLineEdit::selectionEnd() exists since Qt 5.10. Provide an alternative
implementation for Qt 5.9 and earlier. This makes it possible to build
pinentry-qt on CentOS 7 which is used for building an AppImage.
GnuPG-bug-id: 5592
---
qt/pinlineedit.cpp | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/qt/pinlineedit.cpp b/qt/pinlineedit.cpp
index 54367ae..49751c6 100644
--- a/qt/pinlineedit.cpp
+++ b/qt/pinlineedit.cpp
@@ -42,7 +42,13 @@ struct Selection
class PinLineEdit::Private
{
+ PinLineEdit *const q;
+
public:
+ Private(PinLineEdit *q)
+ : q{q}
+ {}
+
QString formatted(QString text) const
{
const int dashCount = text.size() / FormattedPassphraseGroupSize;
@@ -83,13 +89,13 @@ public:
};
}
- void copyToClipboard(const PinLineEdit *edit)
+ void copyToClipboard()
{
- if (edit->echoMode() != QLineEdit::Normal) {
+ if (q->echoMode() != QLineEdit::Normal) {
return;
}
- QString text = edit->selectedText();
+ QString text = q->selectedText();
if (mFormattedPassphrase) {
text.remove(FormattedPassphraseSeparator);
}
@@ -98,13 +104,22 @@ public:
}
}
+ int selectionEnd()
+ {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ return q->selectionEnd();
+#else
+ return q->selectionStart() + q->selectedText().size();
+#endif
+ }
+
public:
bool mFormattedPassphrase = false;
};
PinLineEdit::PinLineEdit(QWidget *parent)
: QLineEdit(parent)
- , d{new Private}
+ , d{new Private{this}}
{
connect(this, SIGNAL(textEdited(QString)),
this, SLOT(textEdited()));
@@ -118,7 +133,7 @@ void PinLineEdit::setFormattedPassphrase(bool on)
return;
}
d->mFormattedPassphrase = on;
- Selection selection{selectionStart(), selectionEnd()};
+ Selection selection{selectionStart(), d->selectionEnd()};
if (d->mFormattedPassphrase) {
setText(d->formatted(text()));
selection = d->formattedSelection(selection);
@@ -133,7 +148,7 @@ void PinLineEdit::setFormattedPassphrase(bool on)
void PinLineEdit::copy() const
{
- d->copyToClipboard(this);
+ d->copyToClipboard();
}
void PinLineEdit::cut()
--
2.33.0

View File

@ -22,6 +22,9 @@
set -e set -e
# Needed for below HACK
sourcedir=$(cd $(dirname $0)/..; pwd)
tag_or_branch=gnupg-2.2.30 tag_or_branch=gnupg-2.2.30
buildroot=$(mktemp -d --tmpdir gnupg-appimage.XXXXXXXXXX) buildroot=$(mktemp -d --tmpdir gnupg-appimage.XXXXXXXXXX)
echo Using ${buildroot} echo Using ${buildroot}
@ -37,6 +40,14 @@ cd gnupg
# to verify the signature # to verify the signature
build-aux/getswdb.sh build-aux/getswdb.sh
# HACK copy appimage.desktop to make it available in the Docker container
mkdir -p ${buildroot}/gnupg/appimage
cp ${sourcedir}/appimage/appimage.desktop ${buildroot}/gnupg/appimage
# HACK replace with speedo.mk that supports appimage
cp ${sourcedir}/build-aux/speedo.mk ${buildroot}/gnupg/build-aux
# HACK copy patch to make it available in the Docker container
cp ${sourcedir}/appimage/0001-qt-Support-building-with-Qt-5.9.patch ${buildroot}/gnupg
cd ${buildroot} cd ${buildroot}
mkdir -p build mkdir -p build

View File

@ -52,6 +52,10 @@ RUN yum -y install \
sqlite-devel \ sqlite-devel \
wget wget
# Install patch; this is needed for a temporary HACK
RUN yum -y install \
patch
COPY build-appimage.sh / COPY build-appimage.sh /
RUN chmod +x build-appimage.sh RUN chmod +x build-appimage.sh

View File

@ -27,6 +27,13 @@ mkdir -p /build/AppDir
cd /src cd /src
source /opt/rh/devtoolset-7/enable source /opt/rh/devtoolset-7/enable
# HACK disable "exit on error" for first make run because the released pinentry
# doesn't build with Qt 5.9 on CentOS 7
set +e
make -f build-aux/speedo.mk INSTALL_PREFIX=/build/AppDir/usr CUSTOM_SWDB=1 appimage
set -e
# HACK patch pinentry and run make a second time
(cd PLAY/src/pinentry; patch -p1 <../../../0001-qt-Support-building-with-Qt-5.9.patch)
make -f build-aux/speedo.mk INSTALL_PREFIX=/build/AppDir/usr CUSTOM_SWDB=1 appimage make -f build-aux/speedo.mk INSTALL_PREFIX=/build/AppDir/usr CUSTOM_SWDB=1 appimage
mkdir -p /build/download mkdir -p /build/download