summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kazantsev2023-09-24 02:07:16 +0500
committerfraggod@malediction2023-09-24 02:07:16 +0500
commitfcd39b7033a754fe3e4c973016a22943c7ca31e9 (patch)
tree5a6979bc9b4505b5542c24ffc3a2a19da8116bb2
parent836b01c36386fdf5980251364cfa292907c0b637 (diff)
downloadaur-fcd39b7033a754fe3e4c973016a22943c7ca31e9.tar.gz
Use more up-to-date BenWiederhake/tdlib-purple fork and a bundled build-script there
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD49
-rw-r--r--PR154-fix-build-with-tdlib-1.8.0.patch238
3 files changed, 31 insertions, 274 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 353b6634e615..d12012718018 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,20 +1,20 @@
pkgbase = telegram-tdlib-purple-minimal-git
- pkgdesc = libpurple Telegram plugin implemented using official tdlib client library, packaged for bitlbee, without voip and image-processing dependencies. Needs TD_API_ID and TD_API_HASH env vars to be set for makepkg.
- pkgver = 0.7.9.r496.80a9163
- pkgrel = 3
- url = https://github.com/ars3niy/tdlib-purple
+ pkgdesc = libpurple/pidgin Telegram plugin implemented using official tdlib client library, packaged for bitlbee, without voip and image-processing dependencies
+ pkgver = 0.8.1.r518.1cc2a5d
+ pkgrel = 1
+ url = https://github.com/BenWiederhake/tdlib-purple
arch = x86_64
arch = aarch64
license = GPL2
makedepends = cmake
makedepends = git
- makedepends = telegram-tdlib
+ makedepends = gperf
depends = libpurple
- provides = telegram-tdlib-purple=0.7.9.r496.80a9163
+ provides = telegram-tdlib-purple=0.8.1.r518.1cc2a5d
conflicts = telegram-tdlib-purple
- source = telegram-tdlib-purple-minimal-git::git+https://github.com/ars3niy/tdlib-purple
- source = PR154-fix-build-with-tdlib-1.8.0.patch
+ source = telegram-tdlib-purple-minimal-git::git+https://github.com/BenWiederhake/tdlib-purple
+ source = td::git+https://github.com/tdlib/td.git
+ sha256sums = SKIP
sha256sums = SKIP
- sha256sums = 04c6c003b79d35177027dd2e5a7635738d5f96a92abdad1824900710109e41c8
pkgname = telegram-tdlib-purple-minimal-git
diff --git a/PKGBUILD b/PKGBUILD
index 10f68f2b56d2..12589c2881e0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,18 +1,18 @@
# Maintainer: Mike Kazantsev <mk.fraggod@gmail.com>
pkgname=telegram-tdlib-purple-minimal-git
-pkgver=0.7.9.r496.80a9163
-pkgrel=3
-pkgdesc='libpurple Telegram plugin implemented using official tdlib client library, packaged for bitlbee, without voip and image-processing dependencies. Needs TD_API_ID and TD_API_HASH env vars to be set for makepkg.'
+pkgver=0.8.1.r518.1cc2a5d
+pkgrel=1
+pkgdesc='libpurple/pidgin Telegram plugin implemented using official tdlib client library, packaged for bitlbee, without voip and image-processing dependencies'
arch=(x86_64 aarch64)
-url='https://github.com/ars3niy/tdlib-purple'
+url='https://github.com/BenWiederhake/tdlib-purple'
license=(GPL2)
depends=(libpurple)
-makedepends=(cmake git telegram-tdlib)
+makedepends=(cmake git gperf)
conflicts=(telegram-tdlib-purple)
provides=(telegram-tdlib-purple="${pkgver}")
-source=($pkgname::git+"$url" PR154-fix-build-with-tdlib-1.8.0.patch)
-sha256sums=(SKIP 04c6c003b79d35177027dd2e5a7635738d5f96a92abdad1824900710109e41c8)
+source=( $pkgname::git+"$url" td::git+https://github.com/tdlib/td.git )
+sha256sums=( SKIP SKIP )
pkgver() {
cd $pkgname
@@ -23,30 +23,25 @@ pkgver() {
prepare() {
cd $pkgname
- # See https://github.com/ars3niy/tdlib-purple/pull/154
- p=PR154-fix-build-with-tdlib-1.8.0.patch
- patch --dry-run -tNp1 -R -i "$srcdir"/$p >/dev/null || patch -tNp1 -i "$srcdir"/$p
+ # build_and_install.sh is the proper way to build this, with the right tdlib version/commit
+ # But cloning td repo from scratch every time gets old fast, so replaced with proper $srcdir clone here
+ script=build_and_install.sh td_checkout="$(realpath "$srcdir")"/td
+ sed -i \
+ -e 's|^\( *\)git clone https://github.com/tdlib/td.git *$|\1'"ln -s '$td_checkout' td|" \
+ -e 's|^\( *\)sudo make install *$|\1true|' "$script"
+ grep -q "'$td_checkout'" "$script" && grep -qv '^ *sudo ' "$script" || {
+ echo >&2 "ERROR: failed to patch git-clone/sudo in build_and_install.sh script"; exit 1; }
+
+ # Extra parameters for a minimal build
+ sed -i 's|^\( *cmake .* -DNoVoip=True\)\( ..\) *$|\1 -DNoWebp=True -DNoLottie=True\2|' "$script"
+ grep -q 'cmake .* -DNoWebp=True -DNoLottie=True ..' "$script" || {
+ echo >&2 "ERROR: failed to patch cmake opts in build_and_install.sh script"; exit 1; }
}
build() {
cd $pkgname
- mkdir -p build
- cd build
-
- cmake_opts=()
- if [[ -n "$TD_API_ID" && -n "$TD_API_HASH" ]]
- then cmake_opts+=( -DAPI_ID="$TD_API_ID" -DAPI_HASH="$TD_API_HASH" )
- else
- echo >&2 "WARNING: --------------------"
- echo >&2 "WARNING: tdlib-purple will be built with default/testing API_ID and API_HASH credentials."
- echo >&2 "WARNING: This can cause 400 (API_ID_PUBLISHED_FLOOD) error on login when using it."
- echo >&2 "WARNING: Set/export TD_API_ID and TD_API_HASH env vars to use custom (working) values there."
- echo >&2 "WARNING: Check https://core.telegram.org/api/obtaining_api_id URL for how to easily get those."
- echo >&2 "WARNING: --------------------"
- fi
-
- cmake -DNoWebp=True -DNoLottie=True -DNoVoip=True "${cmake_opts[@]}" ..
- make
+ rm -rf build "$srcdir"/td/build # script will fail on repeated runs otherwise
+ ./build_and_install.sh
}
package() {
diff --git a/PR154-fix-build-with-tdlib-1.8.0.patch b/PR154-fix-build-with-tdlib-1.8.0.patch
deleted file mode 100644
index 8aafb25c2854..000000000000
--- a/PR154-fix-build-with-tdlib-1.8.0.patch
+++ /dev/null
@@ -1,238 +0,0 @@
-From 8c87b899ddbec32ec6ab4a34ddf0dc770f97d396 Mon Sep 17 00:00:00 2001
-From: ludo <kontsek@tovek.cz>
-Date: Fri, 11 Mar 2022 13:52:46 +0100
-Subject: [PATCH] Update to tdlib 1.8.0
-
----
- CMakeLists.txt | 12 +++++++-----
- client-utils.cpp | 2 +-
- identifiers.cpp | 24 ++++++++++++------------
- identifiers.h | 10 ++++++----
- td-client.cpp | 15 +++++++--------
- td-client.h | 2 +-
- 6 files changed, 34 insertions(+), 31 deletions(-)
-
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 5006f78..2b05311 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -6,11 +6,11 @@ project(tdlib-purple VERSION ${VERSION} LANGUAGES CXX)
-
- find_package(Td REQUIRED)
- math(EXPR TDLIB_VERSION_NUMBER "10000*${Td_VERSION_MAJOR} + 100*${Td_VERSION_MINOR} + ${Td_VERSION_PATCH}")
--if (NOT(${TDLIB_VERSION_NUMBER} EQUAL 10709))
-+if (${TDLIB_VERSION_NUMBER} LESS 10800)
- # Error message must begin with "tdlib version" for a grep command from readme
-- message(FATAL_ERROR "tdlib version 1.7.9 is required
-+ message(FATAL_ERROR "at least tdlib version 1.8.0 is required
- (version found: ${Td_VERSION_MAJOR}.${Td_VERSION_MINOR}.${Td_VERSION_PATCH})")
--endif (NOT(${TDLIB_VERSION_NUMBER} EQUAL 10709))
-+endif (${TDLIB_VERSION_NUMBER} LESS 10800)
-
- set(NoPkgConfig FALSE CACHE BOOL "Do not use pkg-config")
- set(NoWebp FALSE CACHE BOOL "Do not decode webp stickers")
-@@ -18,8 +18,6 @@ set(NoBundledLottie FALSE CACHE BOOL "Do not use bundled rlottie library")
- set(NoLottie FALSE CACHE BOOL "Disable animated sticker conversion")
- set(NoTranslations FALSE CACHE BOOL "Disable translation support")
- set(NoVoip FALSE CACHE BOOL "Disable voice call support")
--set(tgvoip_INCLUDE_DIRS "" CACHE STRING "Path to libtgvoip headers")
--set(tgvoip_LIBRARIES "tgvoip" CACHE STRING "tgvoip library to link against")
- set(API_ID 94575 CACHE STRING "API id")
- set(API_HASH a3406de8d171bb422bb6ddf3bbd800e2 CACHE STRING "API hash")
- set(STUFF "" CACHE STRING "")
-@@ -31,6 +29,10 @@ if (NOT NoPkgConfig)
- pkg_check_modules(libwebp libwebp)
- pkg_check_modules(libpng libpng)
- endif (NOT NoWebp)
-+ if (NOT NoVoip)
-+ pkg_check_modules(tgvoip tgvoip)
-+ endif(NOT NoVoip)
-+
- pkg_get_variable(PURPLE_PLUGIN_DIR purple plugindir)
- pkg_get_variable(PURPLE_DATA_DIR purple datarootdir)
- endif (NOT NoPkgConfig)
-diff --git a/client-utils.cpp b/client-utils.cpp
-index 16a3d78..8614694 100644
---- a/client-utils.cpp
-+++ b/client-utils.cpp
-@@ -434,7 +434,7 @@ bool isInviteLinkActive(const td::td_api::chatInviteLink &linkInfo)
- {
- return !linkInfo.is_revoked_ &&
- ((linkInfo.member_limit_ == 0) || (linkInfo.member_count_ < linkInfo.member_limit_)) &&
-- ((linkInfo.expire_date_ == 0) || (std::time(NULL) < static_cast<time_t>(linkInfo.expire_date_)));
-+ ((linkInfo.expiration_date_ == 0) || (std::time(NULL) < static_cast<time_t>(linkInfo.expiration_date_)));
- }
-
- static std::string lastMessageSetting(ChatId chatId)
-diff --git a/identifiers.cpp b/identifiers.cpp
-index 43172d2..51a3a8d 100644
---- a/identifiers.cpp
-+++ b/identifiers.cpp
-@@ -45,11 +45,7 @@ UserId getUserId(const td::td_api::chatTypePrivate &privType)
-
- UserId getUserId(const td::td_api::chatMember &member)
- {
-- if (member.member_id_ && (member.member_id_->get_id() == td::td_api::messageSenderUser::ID)) {
-- const td::td_api::messageSenderUser &userInfo = static_cast<const td::td_api::messageSenderUser &>(*member.member_id_);
-- return UserId(userInfo.user_id_);
-- }
-- return UserId::invalid;
-+ return getUserId(member.member_id_);
- }
-
- UserId getUserId(const td::td_api::call &call)
-@@ -59,10 +55,7 @@ UserId getUserId(const td::td_api::call &call)
-
- UserId getSenderUserId(const td::td_api::message &message)
- {
-- if (message.sender_ && (message.sender_->get_id() == td::td_api::messageSenderUser::ID))
-- return UserId(static_cast<const td::td_api::messageSenderUser &>(*message.sender_).user_id_);
-- else
-- return UserId::invalid;
-+ return getUserId(message.sender_id_);
- }
-
- UserId getSenderUserId(const td::td_api::messageForwardOriginUser &forwardOrigin)
-@@ -80,9 +73,9 @@ UserId getUserId(const td::td_api::updateUserStatus &update)
- return UserId(update.user_id_);
- }
-
--UserId getUserId(const td::td_api::updateUserChatAction &update)
-+UserId getUserId(const td::td_api::updateChatAction &update)
- {
-- return UserId(update.user_id_);
-+ return getUserId(update.sender_id_);
- }
-
- UserId getUserId(const td::td_api::importedContacts &contacts, unsigned index)
-@@ -95,6 +88,13 @@ UserId getUserId(const td::td_api::users &users, unsigned index)
- return UserId(users.user_ids_[index]);
- }
-
-+UserId getUserId(const td::td_api::object_ptr<td::td_api::MessageSender>& sender) {
-+ if(sender && (sender->get_id() == td::td_api::messageSenderUser::ID)) {
-+ return UserId(static_cast<const td::td_api::messageSenderUser &>(*sender.get()).user_id_);
-+ }
-+ return UserId::invalid;
-+}
-+
- ChatId getChatId(const td::td_api::updateChatPosition &update)
- {
- return ChatId(update.chat_id_);
-@@ -115,7 +115,7 @@ ChatId getChatId(const td::td_api::message &message)
- return ChatId(message.chat_id_);
- }
-
--ChatId getChatId(const td::td_api::updateUserChatAction &update)
-+ChatId getChatId(const td::td_api::updateChatAction &update)
- {
- return ChatId(update.chat_id_);
- }
-diff --git a/identifiers.h b/identifiers.h
-index 21a60eb..747edad 100644
---- a/identifiers.h
-+++ b/identifiers.h
-@@ -63,9 +63,10 @@ DEFINE_ID_CLASS(UserId, int64_t)
- friend UserId getSenderUserId(const td::td_api::messageForwardOriginUser &forwardOrigin);
- friend UserId getUserId(const td::td_api::secretChat &secretChat);
- friend UserId getUserId(const td::td_api::updateUserStatus &update);
-- friend UserId getUserId(const td::td_api::updateUserChatAction &update);
-+ friend UserId getUserId(const td::td_api::updateChatAction &update);
- friend UserId getUserId(const td::td_api::importedContacts &contacts, unsigned index);
- friend UserId getUserId(const td::td_api::users &users, unsigned index);
-+ friend UserId getUserId(const td::td_api::object_ptr<td::td_api::MessageSender>& sender);
- };
-
- DEFINE_ID_CLASS(ChatId, int64_t)
-@@ -74,7 +75,7 @@ DEFINE_ID_CLASS(ChatId, int64_t)
- friend ChatId getChatId(const td::td_api::updateChatTitle &update);
- friend ChatId getChatId(const td::td_api::messageForwardOriginChannel &forwardOrigin);
- friend ChatId getChatId(const td::td_api::message &message);
-- friend ChatId getChatId(const td::td_api::updateUserChatAction &update);
-+ friend ChatId getChatId(const td::td_api::updateChatAction &update);
- friend ChatId getChatId(const td::td_api::updateChatLastMessage &update);
- };
-
-@@ -116,15 +117,16 @@ UserId getSenderUserId(const td::td_api::message &message);
- UserId getSenderUserId(const td::td_api::messageForwardOriginUser &forwardOrigin);
- UserId getUserId(const td::td_api::secretChat &secretChat);
- UserId getUserId(const td::td_api::updateUserStatus &update);
--UserId getUserId(const td::td_api::updateUserChatAction &update);
-+UserId getUserId(const td::td_api::updateChatAction &update);
- UserId getUserId(const td::td_api::importedContacts &contacts, unsigned index);
- UserId getUserId(const td::td_api::users &users, unsigned index);
-+UserId getUserId(const td::td_api::object_ptr<td::td_api::MessageSender>& sender);
-
- ChatId getChatId(const td::td_api::updateChatPosition &update);
- ChatId getChatId(const td::td_api::updateChatTitle &update);
- ChatId getChatId(const td::td_api::messageForwardOriginChannel &forwardOrigin);
- ChatId getChatId(const td::td_api::message &message);
--ChatId getChatId(const td::td_api::updateUserChatAction &update);
-+ChatId getChatId(const td::td_api::updateChatAction &update);
- ChatId getChatId(const td::td_api::updateChatLastMessage &update);
-
- BasicGroupId getBasicGroupId(const td::td_api::updateBasicGroupFullInfo &update);
-diff --git a/td-client.cpp b/td-client.cpp
-index 34d8b9b..5aaa48f 100644
---- a/td-client.cpp
-+++ b/td-client.cpp
-@@ -111,8 +111,8 @@ void PurpleTdClient::processUpdate(td::td_api::Object &update)
- break;
- }
-
-- case td::td_api::updateUserChatAction::ID: {
-- auto &updateChatAction = static_cast<td::td_api::updateUserChatAction &>(update);
-+ case td::td_api::updateChatAction::ID: {
-+ auto &updateChatAction = static_cast<td::td_api::updateChatAction &>(update);
- purple_debug_misc(config::pluginId, "Incoming update: chat action %d\n",
- updateChatAction.action_ ? updateChatAction.action_->get_id() : 0);
- handleUserChatAction(updateChatAction);
-@@ -1276,7 +1276,7 @@ void PurpleTdClient::addChat(td::td_api::object_ptr<td::td_api::chat> chat)
- updateChat(m_data.getChat(chatId));
- }
-
--void PurpleTdClient::handleUserChatAction(const td::td_api::updateUserChatAction &updateChatAction)
-+void PurpleTdClient::handleUserChatAction(const td::td_api::updateChatAction &updateChatAction)
- {
- const td::td_api::chat *chat = m_data.getChat(getChatId(updateChatAction));
- if (!chat) {
-@@ -1295,19 +1295,18 @@ void PurpleTdClient::handleUserChatAction(const td::td_api::updateUserChatAction
- if (chatUserId != getUserId(updateChatAction)) {
- purpleDebug("Got user action for private chat {} (with user {}) for another user {}", {
- std::to_string(updateChatAction.chat_id_), std::to_string(chatUserId.value()),
-- std::to_string(updateChatAction.user_id_)
-+ std::to_string(getUserId(updateChatAction))
- });
- } else if (updateChatAction.action_) {
- if (updateChatAction.action_->get_id() == td::td_api::chatActionCancel::ID) {
-- purpleDebug("User (id {}) stopped chat action", updateChatAction.user_id_);
-+ purpleDebug("User (id {}) stopped chat action", getUserId(updateChatAction));
- showUserChatAction(getUserId(updateChatAction), false);
- } else if (updateChatAction.action_->get_id() == td::td_api::chatActionStartPlayingGame::ID) {
-- purpleDebug("User (id %d): treating chatActionStartPlayingGame as cancel",
-- updateChatAction.user_id_);
-+ purpleDebug("User (id %d): treating chatActionStartPlayingGame as cancel", getUserId(updateChatAction));
- showUserChatAction(getUserId(updateChatAction), false);
- } else {
- purpleDebug("User (id {}) started chat action (id {})", {
-- std::to_string(updateChatAction.user_id_), std::to_string(updateChatAction.action_->get_id())
-+ std::to_string(getUserId(updateChatAction)), std::to_string(updateChatAction.action_->get_id())
- });
- showUserChatAction(getUserId(updateChatAction), true);
- }
-diff --git a/td-client.h b/td-client.h
-index 33503f0..741e915 100644
---- a/td-client.h
-+++ b/td-client.h
-@@ -113,7 +113,7 @@ private:
- void addContactById(UserId userId, const std::string &phoneNumber, const std::string &alias,
- const std::string &groupName);
- void addChat(td::td_api::object_ptr<td::td_api::chat> chat);
-- void handleUserChatAction(const td::td_api::updateUserChatAction &updateChatAction);
-+ void handleUserChatAction(const td::td_api::updateChatAction &updateChatAction);
- void showUserChatAction(UserId userId, bool isTyping);
- void addBuddySearchChatResponse(uint64_t requestId, td::td_api::object_ptr<td::td_api::Object> object);
- void importContactResponse(uint64_t requestId, td::td_api::object_ptr<td::td_api::Object> object);
---
-2.35.1
-