Unverified Commit a1ba3c5c authored by Cosima Neidahl's avatar Cosima Neidahl Committed by GitHub
Browse files

lomiri.lomiri-download-manager: 0.1.3 -> 0.2.1 (#407706)

parents b2bbf143 282c93a9
Loading
Loading
Loading
Loading
+0 −154
Original line number Diff line number Diff line
From a487908c22fe0a37669bbe5a8bdcd945b05b2f33 Mon Sep 17 00:00:00 2001
From: OPNA2608 <opna2608@protonmail.com>
Date: Mon, 20 Jan 2025 19:06:54 +0100
Subject: [PATCH] treewide: Switch to glog CMake module

---
 CMakeLists.txt                           | 2 +-
 src/common/priv/CMakeLists.txt           | 2 +-
 src/common/public/CMakeLists.txt         | 2 +-
 src/downloads/daemon/CMakeLists.txt      | 2 +-
 src/downloads/priv/CMakeLists.txt        | 2 +-
 src/downloads/qml/CMakeLists.txt         | 2 +-
 src/downloads/test-daemon/CMakeLists.txt | 2 +-
 src/extractor/CMakeLists.txt             | 2 +-
 src/uploads/daemon/CMakeLists.txt        | 2 +-
 src/uploads/priv/CMakeLists.txt          | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8c4750a2..e44d09ad 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,10 +50,10 @@ set(CMAKE_AUTOMOC ON)
 
 find_package(Qt5 COMPONENTS Core DBus Network Sql Test REQUIRED)
 find_package(Boost COMPONENTS log program_options REQUIRED)
+find_package(glog REQUIRED)
 
 find_package(PkgConfig REQUIRED)
 pkg_check_modules(DBUS REQUIRED dbus-1)
-pkg_check_modules(GLOG REQUIRED libglog)
 pkg_check_modules(LOMIRI_API REQUIRED liblomiri-api)
 
 if(USE_SYSTEMD)
diff --git a/src/common/priv/CMakeLists.txt b/src/common/priv/CMakeLists.txt
index e7723f3d..105ec5d2 100644
--- a/src/common/priv/CMakeLists.txt
+++ b/src/common/priv/CMakeLists.txt
@@ -75,7 +75,7 @@ set_target_properties(
 
 target_link_libraries(${TARGET}
 	${LOMIRI_API_LDFLAGS}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::Network
 	Qt5::Sql
 	Qt5::Core
diff --git a/src/common/public/CMakeLists.txt b/src/common/public/CMakeLists.txt
index 4b1e8660..eeeeab13 100644
--- a/src/common/public/CMakeLists.txt
+++ b/src/common/public/CMakeLists.txt
@@ -50,7 +50,7 @@ set_target_properties(
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::DBus
 	Qt5::Network
 )
diff --git a/src/downloads/daemon/CMakeLists.txt b/src/downloads/daemon/CMakeLists.txt
index cdc9f83b..24e2334c 100644
--- a/src/downloads/daemon/CMakeLists.txt
+++ b/src/downloads/daemon/CMakeLists.txt
@@ -16,7 +16,7 @@ add_executable(${TARGET}
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::Core
 	ldm-common
 	ldm-priv-common
diff --git a/src/downloads/priv/CMakeLists.txt b/src/downloads/priv/CMakeLists.txt
index 9eaf3092..c453a7a1 100644
--- a/src/downloads/priv/CMakeLists.txt
+++ b/src/downloads/priv/CMakeLists.txt
@@ -65,7 +65,7 @@ set_target_properties(
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::DBus
 	Qt5::Sql
 	ldm-common
diff --git a/src/downloads/qml/CMakeLists.txt b/src/downloads/qml/CMakeLists.txt
index 7e2d9285..49d68f1c 100644
--- a/src/downloads/qml/CMakeLists.txt
+++ b/src/downloads/qml/CMakeLists.txt
@@ -34,7 +34,7 @@ find_package(Qt5 COMPONENTS Core Qml Quick REQUIRED)
 target_link_libraries(${TARGET} Qt5::Core Qt5::Qml Qt5::Quick)
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	ldm-common
 	lomiri-download-manager-common
 	lomiri-download-manager-client
diff --git a/src/downloads/test-daemon/CMakeLists.txt b/src/downloads/test-daemon/CMakeLists.txt
index d12207a1..6734e65d 100644
--- a/src/downloads/test-daemon/CMakeLists.txt
+++ b/src/downloads/test-daemon/CMakeLists.txt
@@ -30,7 +30,7 @@ add_executable(${TARGET}
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::Core
 	Qt5::DBus
 	Qt5::Network
diff --git a/src/extractor/CMakeLists.txt b/src/extractor/CMakeLists.txt
index 8c40b9b5..3615d5c7 100644
--- a/src/extractor/CMakeLists.txt
+++ b/src/extractor/CMakeLists.txt
@@ -23,7 +23,7 @@ add_executable(${TARGET}
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::Core
 	${Boost_LIBRARIES}
 	ldm-priv-common
diff --git a/src/uploads/daemon/CMakeLists.txt b/src/uploads/daemon/CMakeLists.txt
index 157c6fd6..3692d3c9 100644
--- a/src/uploads/daemon/CMakeLists.txt
+++ b/src/uploads/daemon/CMakeLists.txt
@@ -16,7 +16,7 @@ add_executable(${TARGET}
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::Core
 	ldm-common
 	ldm-priv-common
diff --git a/src/uploads/priv/CMakeLists.txt b/src/uploads/priv/CMakeLists.txt
index dff67e35..672e49ef 100644
--- a/src/uploads/priv/CMakeLists.txt
+++ b/src/uploads/priv/CMakeLists.txt
@@ -47,7 +47,7 @@ set_target_properties(
 )
 
 target_link_libraries(${TARGET}
-	${GLOG_LIBRARIES}
+	glog::glog
 	Qt5::DBus
 	Qt5::Sql
 	ldm-common
-- 
2.47.1
+18 −23
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
  glog,
  graphviz,
  gtest,
  libapparmor,
  lomiri-api,
  pkg-config,
  python3,
@@ -28,13 +29,13 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "lomiri-download-manager";
  version = "0.1.3";
  version = "0.2.1";

  src = fetchFromGitLab {
    owner = "ubports";
    repo = "development/core/lomiri-download-manager";
    rev = finalAttrs.version;
    hash = "sha256-LhhO/zZ4wNiRd235NB2b08SQcCZt1awN/flcsLs2m8U=";
    tag = finalAttrs.version;
    hash = "sha256-dVyel4NL5LFORNTQzOyeTFkt9Wn23+4uwHsKcj+/0rk=";
  };

  outputs = [
@@ -43,31 +44,23 @@ stdenv.mkDerivation (finalAttrs: {
  ] ++ lib.optionals withDocumentation [ "doc" ];

  patches = [
    # This change seems incomplete, potentially breaks things on systems that don't use AppArmor mediation
    # https://gitlab.com/ubports/development/core/lomiri-download-manager/-/merge_requests/24#note_1746801673
    # Remove when version > 0.2.1
    (fetchpatch {
      name = "0001-lomiri-download-manager-Revert-Drop-GetConnectionAppArmorSecurityContext.patch";
      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/2367f3dff852b69457b1a65a487cb032c210569f.patch";
      revert = true;
      hash = "sha256-xS0Wz6d+bZWj/kDGK2WhOduzyP4Rgz3n9n2XY1Zu5hE=";
      name = "0001-lomiri-download-manager-treewide-Make-pkg-config-includedir-values-reasonable.patch";
      url = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/commit/230aa1965917f90d235f55477a257eca1f5eaf46.patch";
      hash = "sha256-Kdmu4U98Yc213pHS0o4DjpG8T5p50Q5hijRgdvscA/c=";
    })

    # Fix compatibility with glog 0.7.x
    # Remove when https://gitlab.com/ubports/development/core/lomiri-download-manager/-/merge_requests/29 merged & in release (vendored patch was manually backported)
    ./1001-treewide-Switch-to-glog-CMake-module.patch
  ];

  postPatch = ''
    # Substitute systemd's prefix in pkg-config call
    substituteInPlace CMakeLists.txt \
      --replace-fail 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir)' 'pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir DEFINE_VARIABLES prefix=''${CMAKE_INSTALL_PREFIX})' \
      --replace-fail "\''${CMAKE_INSTALL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"
      --replace-fail "\''${CMAKE_INSTALL_FULL_LIBDIR}/qt\''${QT_VERSION_MAJOR}/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}"

    # For our automatic pkg-config output patcher to work, prefix must be used here
    substituteInPlace src/{common/public,downloads/client,downloads/common,uploads/common}/*.pc.in \
      --replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}'
    substituteInPlace src/downloads/client/lomiri-download-manager-client.pc.in \
      --replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
    # Upstream code is to work around a bug, but it only seems to cause config issues for us
    substituteInPlace tests/common/CMakeLists.txt \
      --replace-fail 'add_dependencies(''${TARGET} GMock)' '# add_dependencies(''${TARGET} GMock)'
  '';

  strictDeps = true;
@@ -89,6 +82,7 @@ stdenv.mkDerivation (finalAttrs: {
    boost
    cmake-extras
    glog
    libapparmor
    lomiri-api
    qtbase
    qtdeclarative
@@ -104,10 +98,9 @@ stdenv.mkDerivation (finalAttrs: {
  checkInputs = [ gtest ];

  cmakeFlags = [
    (lib.cmakeBool "ENABLE_QT6" (lib.strings.versionAtLeast qtbase.version "6"))
    (lib.cmakeBool "ENABLE_DOC" withDocumentation)
    # Deprecation warnings on Qt 5.15
    # https://gitlab.com/ubports/development/core/lomiri-download-manager/-/issues/1
    (lib.cmakeBool "ENABLE_WERROR" false)
    (lib.cmakeBool "ENABLE_WERROR" true)
  ];

  makeTargets = [ "all" ] ++ lib.optionals withDocumentation [ "doc" ];
@@ -130,7 +123,9 @@ stdenv.mkDerivation (finalAttrs: {
  meta = {
    description = "Performs uploads and downloads from a centralized location";
    homepage = "https://gitlab.com/ubports/development/core/lomiri-download-manager";
    changelog = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/blob/${finalAttrs.version}/ChangeLog";
    changelog = "https://gitlab.com/ubports/development/core/lomiri-download-manager/-/blob/${
      if (!builtins.isNull finalAttrs.src.tag) then finalAttrs.src.tag else finalAttrs.src.rev
    }/ChangeLog";
    license = lib.licenses.lgpl3Only;
    teams = [ lib.teams.lomiri ];
    platforms = lib.platforms.linux;