diff --git a/srcpkgs/remmina/patches/libsoup3.patch b/srcpkgs/remmina/patches/libsoup3.patch new file mode 100644 index 00000000000..9f937275c49 --- /dev/null +++ b/srcpkgs/remmina/patches/libsoup3.patch @@ -0,0 +1,452 @@ +From edbaeb1b588edc0e969b0eedd731758aad369391 Mon Sep 17 00:00:00 2001 +From: "Antenore Gatta (tmow)" +Date: Mon, 3 Oct 2022 17:38:35 +0000 +Subject: [PATCH] Multiple changes to build and run with libsoup 3.0 + +--- + ...{FindLIBSOUP24.cmake => FindLIBSOUP.cmake} | 27 +-- + cmake/FindWEBKIT2GTK.cmake | 6 +- + plugins/www/CMakeLists.txt | 10 +- + src/CMakeLists.txt | 8 +- + src/rmnews.c | 216 +++++++++++++----- + 8 files changed, 323 insertions(+), 164 deletions(-) + rename cmake/{FindLIBSOUP24.cmake => FindLIBSOUP.cmake} (55%) + +diff --git a/cmake/FindLIBSOUP24.cmake b/cmake/FindLIBSOUP.cmake +similarity index 55% +rename from cmake/FindLIBSOUP24.cmake +rename to cmake/FindLIBSOUP.cmake +index 96ec22239..23cc06ff6 100644 +--- a/cmake/FindLIBSOUP24.cmake ++++ b/cmake/FindLIBSOUP.cmake +@@ -1,7 +1,5 @@ + # Remmina - The GTK+ Remote Desktop Client + # +-# Copyright (C) 2011 Marc-Andre Moreau +-# Copyright (C) 2014-2015 Antenore Gatta, Fabio Castelli, Giovanni Panozzo + # Copyright (C) 2016-2022 Antenore Gatta, Giovanni Panozzo + # + # This program is free software; you can redistribute it and/or modify +@@ -21,26 +19,25 @@ + + include(FindPackageHandleStandardArgs) + +-pkg_check_modules(PC_LIBSOUP24 libsoup-2.4) ++pkg_search_module(PC_LIBSOUP REQUIRED libsoup-3.0 libsoup-2.4) + +- +-find_path(LIBSOUP24_INCLUDE_DIR NAMES libsoup/soup.h +- HINTS ${PC_LIBSOUP24_INCLUDEDIR} ${PC_LIBSOUP24_INCLUDE_DIRS} ++find_path(LIBSOUP_INCLUDE_DIR NAMES libsoup/soup.h ++ HINTS ${PC_LIBSOUP_INCLUDEDIR} ${PC_LIBSOUP_INCLUDE_DIRS} + ) + +-find_library(LIBSOUP24_LIBRARY +- NAMES soup-2.4 +- HINTS ${PC_LIBSOUP24_LIBDIR} ${PC_LIBSOUP24_LIBRARY_DIRS} ++find_library(LIBSOUP_LIBRARY ++ NAMES soup soup-3.0 soup-2.4 ++ HINTS ${PC_LIBSOUP_LIBDIR} ${PC_LIBSOUP_LIBRARY_DIRS} + ) + +-if (LIBSOUP24_INCLUDE_DIR AND LIBSOUP24_LIBRARY) +- find_package_handle_standard_args(LIBSOUP24 DEFAULT_MSG LIBSOUP24_LIBRARY LIBSOUP24_INCLUDE_DIR) ++if (LIBSOUP_INCLUDE_DIR AND LIBSOUP_LIBRARY) ++ find_package_handle_standard_args(LIBSOUP DEFAULT_MSG LIBSOUP_LIBRARY LIBSOUP_INCLUDE_DIR) + endif() + +-if (LIBSOUP24_FOUND) +- set(LIBSOUP24_LIBRARIES ${LIBSOUP24_LIBRARY}) +- set(LIBSOUP24_INCLUDE_DIRS ${LIBSOUP24_INCLUDE_DIR}) ++if (LIBSOUP_FOUND) ++ set(LIBSOUP_LIBRARIES ${LIBSOUP_LIBRARY}) ++ set(LIBSOUP_INCLUDE_DIRS ${LIBSOUP_INCLUDE_DIR}) + endif() + +-mark_as_advanced(LIBSOUP24_INCLUDE_DIR LIBSOUP24_LIBRARY) ++mark_as_advanced(LIBSOUP_INCLUDE_DIR LIBSOUP_LIBRARY) + +diff --git a/cmake/FindWEBKIT2GTK.cmake b/cmake/FindWEBKIT2GTK.cmake +index 391fdfe9d..0af554cff 100644 +--- a/cmake/FindWEBKIT2GTK.cmake ++++ b/cmake/FindWEBKIT2GTK.cmake +@@ -33,7 +33,8 @@ + find_package(PkgConfig) + + if(PKG_CONFIG_FOUND) +- pkg_check_modules(_WEBKIT2GTK webkit2gtk-4.0) ++ #pkg_check_modules(_WEBKIT2GTK webkit2gtk-4.0) ++ pkg_search_module(_WEBKIT2GTK webkit2gtk-4.1 webkit2gtk-4.0) + endif(PKG_CONFIG_FOUND) + + set(WEBKIT2GTK_DEFINITIONS ${_WEBKIT2GTK_CFLAGS_OTHER}) +@@ -42,7 +43,8 @@ find_path(WEBKIT2GTK_INCLUDE_DIR NAMES webkit2/webkit2.h + HINTS ${_WEBKIT2GTK_INCLUDEDIR} ${_WEBKIT2GTK_INCLUDE_DIRS} + ) + +-find_library(WEBKIT2GTK_LIB webkit2gtk-4.0 ++find_library(WEBKIT2GTK_LIB ++ NAMES webkit2gtk-4.1 webkit2gtk-4.0 + HINTS + ${_WEBKIT2GTK_LIBDIR} + ${_WEBKIT2GTK_LIBRARY_DIRS} +diff --git a/plugins/www/CMakeLists.txt b/plugins/www/CMakeLists.txt +index cd1ab3a32..39f44a0c7 100644 +--- a/plugins/www/CMakeLists.txt ++++ b/plugins/www/CMakeLists.txt +@@ -45,12 +45,12 @@ set_target_properties(remmina-plugin-www PROPERTIES NO_SONAME 1) + + add_definitions(${WEBKIT2GTK_CFLAGS_OTHER}) + +-find_required_package(LIBSOUP24) +-if(LIBSOUP24_FOUND) +- include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${WEBKIT2GTK_INCLUDE_DIRS} ${LIBSOUP24_INCLUDE_DIRS}) +- target_link_libraries(remmina-plugin-www ${REMMINA_COMMON_LIBRARIES} ${LIBSOUP24_LIBRARIES} ${WEBKIT2GTK_LIBRARIES}) ++find_required_package(LIBSOUP) ++if(LIBSOUP_FOUND) ++ include_directories(${REMMINA_COMMON_INCLUDE_DIRS} ${WEBKIT2GTK_INCLUDE_DIRS} ${LIBSOUP_INCLUDE_DIRS}) ++ target_link_libraries(remmina-plugin-www ${REMMINA_COMMON_LIBRARIES} ${LIBSOUP_LIBRARIES} ${WEBKIT2GTK_LIBRARIES}) + else() +- message(FATAL_ERROR "libsoup 2.4 library not found") ++ message(FATAL_ERROR "libsoup library not found") + endif() + + install(TARGETS remmina-plugin-www DESTINATION ${REMMINA_PLUGINDIR}) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 8d7ddadbb..eb1fec2e0 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -255,10 +255,10 @@ if(GTK3_FOUND) + else() + message(FATAL_ERROR "json-glib library not found") + endif() +- find_required_package(LIBSOUP24) +- if(LIBSOUP24_FOUND) +- include_directories(${LIBSOUP24_INCLUDE_DIRS}) +- target_link_libraries(remmina ${LIBSOUP24_LIBRARIES}) ++ find_required_package(LIBSOUP) ++ if(LIBSOUP_FOUND) ++ include_directories(${LIBSOUP_INCLUDE_DIRS}) ++ target_link_libraries(remmina ${LIBSOUP_LIBRARIES}) + else() + message(FATAL_ERROR "libsoup 2.4 library not found") + endif() +diff --git a/src/rmnews.c b/src/rmnews.c +index d4ae81d22..f44af8704 100644 +--- a/src/rmnews.c ++++ b/src/rmnews.c +@@ -74,6 +74,12 @@ static RemminaNewsDialog *rmnews_news_dialog; + #define GET_OBJ(object_name) gtk_builder_get_object(rmnews_news_dialog->builder, object_name) + + static SoupSession *session; ++ ++#if SOUP_MAJOR_VERSION < 3 ++#define soup_message_get_status(message) message->status_code ++#define soup_message_get_response_headers(message) message->response_headers ++#endif ++ + static const gchar *output_file_path = NULL; + + static +@@ -96,6 +102,23 @@ gint eweekdays[7] = { + 604800 + }; + ++ ++#if SOUP_CHECK_VERSION (2, 99, 2) ++static void rmnews_on_stream_splice (GObject *source, GAsyncResult *result, gpointer user_data) ++{ ++ GError *error = NULL; ++ g_output_stream_splice_finish (G_OUTPUT_STREAM (source), ++ result, ++ &error); ++ if (error) { ++ g_printerr ("Failed to download: %s\n", error->message); ++ g_error_free (error); ++ return; ++ } ++ ++} ++#endif ++ + void rmnews_news_switch_state_set_cb() + { + TRACE_CALL(__func__); +@@ -225,71 +248,136 @@ void rmnews_show_news(GtkWindow *parent) + gtk_window_set_modal(GTK_WINDOW(rmnews_news_dialog->dialog), TRUE); + } + +-static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer data) ++#if SOUP_CHECK_VERSION (2, 99, 2) ++static void rmnews_get_url_cb (GObject *source, GAsyncResult *result, gpointer user_data) + { + TRACE_CALL(__func__); + const char *name; + const char *header; +- SoupBuffer *sb; +- FILE *output_file = NULL; ++ GFile *output_file; + gchar *filesha = NULL; + gchar *filesha_after = NULL; +- GDateTime *gdt; +- gint64 unixts; + +- REMMINA_DEBUG("Status code %d", msg->status_code); ++ GError *error = NULL; ++ GInputStream *in = soup_session_send_finish (SOUP_SESSION (source), result, &error); + +- name = soup_message_get_uri(msg)->path; ++ if (error) { ++ REMMINA_DEBUG ("Failed to send request: %s", error->message); ++ g_error_free (error); ++ return; ++ } + +- gdt = g_date_time_new_now_utc(); +- unixts = g_date_time_to_unix(gdt); ++ GDateTime *gdt = g_date_time_new_now_utc(); ++ gint64 unixts = g_date_time_to_unix(gdt); + g_date_time_unref(gdt); + +- if (SOUP_STATUS_IS_CLIENT_ERROR(msg->status_code)) { +- REMMINA_DEBUG("Status 404 - Release file not available"); +- remmina_pref.periodic_rmnews_last_get = unixts; +- REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); +- REMMINA_DEBUG ("Saving preferences"); +- remmina_pref_save(); +- return; +- } ++ if (output_file_path) { ++ REMMINA_DEBUG("Calculating the SHA1 of the local file"); ++ filesha = remmina_sha1_file(output_file_path); ++ REMMINA_DEBUG("SHA1 is %s", filesha); ++ if (filesha == NULL || filesha[0] == 0) filesha = "0\0"; ++ REMMINA_DEBUG("Opening %s output file for writing", output_file_path); ++ GFile *output_file = g_file_new_for_commandline_arg (output_file_path); ++ GOutputStream *out = G_OUTPUT_STREAM (g_file_replace (output_file, NULL, NULL, ++ G_FILE_CREATE_REPLACE_DESTINATION, NULL, &error)); ++ if (error) { ++ REMMINA_DEBUG("Failed to create \"%s\": %s", output_file_path, error->message); ++ remmina_pref.periodic_rmnews_last_get = unixts; ++ REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); ++ REMMINA_DEBUG ("Saving preferences"); ++ remmina_pref_save(); ++ g_free(filesha); filesha = NULL; ++ g_error_free (error); ++ g_object_unref (in); ++ g_object_unref (output_file); ++ g_object_unref (out); ++ return; ++ } ++ ++ /* Start downloading to the file */ ++ // g_output_stream_splice_async (G_OUTPUT_STREAM (out), in, ++ // G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, ++ // G_PRIORITY_DEFAULT, ++ // NULL, ++ // rmnews_on_stream_splice, ++ // NULL); ++ g_output_stream_splice (G_OUTPUT_STREAM (out), in, ++ G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE | G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET, ++ NULL, ++ &error); ++ ++ if (error) { ++ REMMINA_DEBUG ("Failed to download: %s", error->message); ++ remmina_pref.periodic_rmnews_last_get = unixts; ++ REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); ++ REMMINA_DEBUG ("Saving preferences"); ++ remmina_pref_save(); ++ g_free(filesha); filesha = NULL; ++ g_error_free (error); ++ g_object_unref (in); ++ g_object_unref (output_file); ++ g_object_unref (out); ++ return; ++ } + +- if (SOUP_STATUS_IS_SERVER_ERROR(msg->status_code)) { +- REMMINA_DEBUG("Server not available"); +- remmina_pref.periodic_rmnews_last_get = unixts; +- REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); +- REMMINA_DEBUG ("Saving preferences"); +- remmina_pref_save(); +- return; +- } + +- if (SOUP_STATUS_IS_TRANSPORT_ERROR(msg->status_code)) { +- REMMINA_DEBUG("Transport Error"); ++ filesha_after = remmina_sha1_file(output_file_path); ++ ++ REMMINA_DEBUG("SHA1 after download is %s", filesha_after); ++ if (g_strcmp0(filesha, filesha_after) != 0) { ++ REMMINA_DEBUG("SHA1 differs, we show the news and reset the counter"); ++ remmina_pref.periodic_rmnews_last_get = 0; ++ REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); ++ REMMINA_DEBUG ("Saving preferences"); ++ GtkWindow *parent = remmina_main_get_window(); ++ if (!kioskmode && kioskmode == FALSE) ++ rmnews_show_news(parent); ++ } else { ++ remmina_pref.periodic_rmnews_last_get = unixts; ++ } ++ /* Increase counter with number of successful GETs */ ++ remmina_pref.periodic_rmnews_get_count = remmina_pref.periodic_rmnews_get_count + 1; ++ remmina_pref_save(); ++ g_free(filesha); filesha = NULL; ++ g_object_unref (out); ++ } else { ++ REMMINA_DEBUG("Cannot open output file for writing, because output_file_path is NULL"); + remmina_pref.periodic_rmnews_last_get = unixts; + REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); + REMMINA_DEBUG ("Saving preferences"); + remmina_pref_save(); + return; +- } ++ } + +- if (msg->status_code == SOUP_STATUS_SSL_FAILED) { +- GTlsCertificateFlags flags; ++ g_object_unref (in); + +- if (soup_message_get_https_status(msg, NULL, &flags)) +- REMMINA_DEBUG("%s: %d %s (0x%x)\n", name, msg->status_code, msg->reason_phrase, flags); +- else +- REMMINA_DEBUG("%s: %d %s (no handshake status)\n", name, msg->status_code, msg->reason_phrase); +- remmina_pref.periodic_rmnews_last_get = unixts; +- REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); +- REMMINA_DEBUG ("Saving preferences"); +- remmina_pref_save(); +- return; +- } else if (SOUP_STATUS_IS_TRANSPORT_ERROR(msg->status_code)) { +- REMMINA_DEBUG("%s: %d %s\n", name, msg->status_code, msg->reason_phrase); +- } + +- if (SOUP_STATUS_IS_REDIRECTION(msg->status_code)) { +- header = soup_message_headers_get_one(msg->response_headers, ++} ++#else ++static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer data) ++{ ++ TRACE_CALL(__func__); ++ const char *name; ++ const char *header; ++ g_autoptr(SoupBuffer) sb; ++ FILE *output_file = NULL; ++ gchar *filesha = NULL; ++ gchar *filesha_after = NULL; ++ GDateTime *gdt; ++ gint64 unixts; ++ gint status; ++ ++ status = soup_message_get_status(msg); ++ REMMINA_DEBUG("Status code %d", status); ++ ++ name = soup_message_get_uri(msg)->path; ++ ++ gdt = g_date_time_new_now_utc(); ++ unixts = g_date_time_to_unix(gdt); ++ g_date_time_unref(gdt); ++ ++ if (SOUP_STATUS_IS_REDIRECTION(status)) { ++ header = soup_message_headers_get_one(soup_message_get_response_headers(msg), + "Location"); + REMMINA_DEBUG("Redirection detected"); + if (header) { +@@ -309,18 +397,25 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d + REMMINA_DEBUG ("Saving preferences"); + remmina_pref_save(); + return; +- } else if (SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { ++ } ++ ++ if (!SOUP_STATUS_IS_SUCCESSFUL(status)) { ++ REMMINA_DEBUG ("Could not access %s: %s", name , soup_status_get_phrase(status)); ++ REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); ++ REMMINA_DEBUG ("Saving preferences"); ++ remmina_pref_save(); ++ return; ++ } else { + REMMINA_DEBUG("Status 200"); + if (output_file_path) { + REMMINA_DEBUG("Calculating the SHA1 of the local file"); + filesha = remmina_sha1_file(output_file_path); + REMMINA_DEBUG("SHA1 is %s", filesha); +- if (filesha == NULL || filesha[0] == 0) +- filesha = "0\0"; ++ if (filesha == NULL || filesha[0] == 0) filesha = "0\0"; + REMMINA_DEBUG("Opening %s output file for writing", output_file_path); + output_file = fopen(output_file_path, "w"); + if (!output_file) { +- g_printerr("Error trying to create file %s.\n", output_file_path); ++ REMMINA_DEBUG("Error trying to create file %s.", output_file_path); + remmina_pref.periodic_rmnews_last_get = unixts; + REMMINA_DEBUG ("periodic_rmnews_last_get set to %ld", remmina_pref.periodic_rmnews_last_get); + REMMINA_DEBUG ("Saving preferences"); +@@ -336,8 +431,6 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d + remmina_pref_save(); + return; + } +- +- + sb = soup_message_body_flatten(msg->response_body); + if (output_file) { + fwrite(sb->data, 1, sb->length, output_file); +@@ -364,8 +457,10 @@ static void rmnews_get_url_cb(SoupSession *session, SoupMessage *msg, gpointer d + g_free(filesha); filesha = NULL; + } + } ++ + g_object_unref(msg); + } ++#endif + + /** + * Try to get a unique system+user ID to identify this remmina user +@@ -417,8 +512,16 @@ void rmnews_get_url(const char *url) + + REMMINA_DEBUG("Fetching %s", url); + ++#if SOUP_CHECK_VERSION (2, 99, 2) ++ // Use soup_session_send_async or soup_session_send_and_read_async ++ soup_session_send_async ( session, msg, G_PRIORITY_DEFAULT, ++ NULL, // cancellable ++ rmnews_get_url_cb, // callback ++ NULL); // user_data ++#else + g_object_ref(msg); + soup_session_queue_message(session, msg, rmnews_get_url_cb, NULL); ++#endif + } + + void rmnews_get_news() +@@ -466,14 +569,25 @@ void rmnews_get_news() + } + + REMMINA_DEBUG("Gathering news"); ++ /* Build the session with all of the features we need */ ++ session = soup_session_new_with_options ("user-agent", "get ", ++ "accept-language-auto", TRUE, ++ "timeout", 15, ++ NULL); ++ ++#if SOUP_CHECK_VERSION (2, 99, 2) ++ soup_session_add_feature_by_type (session, SOUP_TYPE_COOKIE_JAR); ++ logger = soup_logger_new(SOUP_LOGGER_LOG_NONE); ++#else + session = g_object_new(SOUP_TYPE_SESSION, + SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_CONTENT_DECODER, + SOUP_SESSION_ADD_FEATURE_BY_TYPE, SOUP_TYPE_COOKIE_JAR, + SOUP_SESSION_USER_AGENT, "get ", + SOUP_SESSION_ACCEPT_LANGUAGE_AUTO, TRUE, + NULL); +- /* TODO: Catch log level and set SOUP_LOGGER_LOG_MINIMAL or more */ + logger = soup_logger_new(SOUP_LOGGER_LOG_NONE, -1); ++#endif ++ /* TODO: Catch log level and set SOUP_LOGGER_LOG_MINIMAL or more */ + soup_session_add_feature(session, SOUP_SESSION_FEATURE(logger)); + g_object_unref(logger); + +-- +GitLab + diff --git a/srcpkgs/remmina/template b/srcpkgs/remmina/template index cae838c694c..cc99b1a696b 100644 --- a/srcpkgs/remmina/template +++ b/srcpkgs/remmina/template @@ -1,7 +1,7 @@ # Template file for 'remmina' pkgname=remmina version=1.4.27 -revision=1 +revision=2 wrksrc="Remmina-v${version}" build_style=cmake configure_args="-DWITH_APPINDICATOR=OFF -DCMAKE_USE_PTHREADS_INIT=ON" @@ -9,10 +9,10 @@ hostmakedepends="glib-devel intltool pkg-config shared-mime-info" makedepends="avahi-glib-libs-devel avahi-ui-libs-devel freerdp-devel gobject-introspection gstreamermm-devel json-glib-devel libgcrypt-devel libgnome-keyring-devel liblz4-devel libsasl-devel - libsecret-devel libsodium-devel libsoup-devel libssh-devel libva-devel + libsecret-devel libsodium-devel libsoup3-devel libssh-devel libva-devel libvncserver-devel libxkbfile-devel opus-devel phodav-devel spice-gtk-devel spice-protocol telepathy-glib-devel usbredir-devel - vte3-devel libappindicator-devel webkit2gtk-devel python3-devel" + vte3-devel libappindicator-devel libwebkit2gtk41-devel python3-devel" depends="desktop-file-utils hicolor-icon-theme" short_desc="Remote desktop client written in GTK+" maintainer="Frank Steinborn "