summarylogtreecommitdiffstats
path: root/ENABLE_UPDATER-fix.patch
blob: 815dab18c5132c36c5a52cedb1fd3ce4ebd6108b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
From 8fce589069090bb086d7ad7b0b50340171c98b17 Mon Sep 17 00:00:00 2001
From: David Capello <david@igara.com>
Date: Wed, 22 May 2024 12:41:23 -0300
Subject: [PATCH] Now updater-lib is always compiled as it's required for
 app.os.fullName in scripts (fix #4486)

ENABLE_UPDATER flag now only controls the "check update" portion of
the updater-lib. Probably the user agent string could be moved to the
ver-lib in the future.
---
 src/CMakeLists.txt         |  8 ++++----
 src/app/CMakeLists.txt     |  5 +----
 src/updater/CMakeLists.txt | 22 +++++++++++-----------
 3 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0f676af1e3..3b44e9e55e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -117,6 +117,10 @@ if(REQUIRE_CURL)
   add_subdirectory(net)
 endif()
 
+# We need the updater library to check for updates (when
+# ENABLE_UPDATER) or for the app.os object (ENABLE_SCRIPTING).
+add_subdirectory(updater)
+
 if(GEN_EXE)
   add_executable(gen IMPORTED)
   set_target_properties(gen PROPERTIES IMPORTED_LOCATION ${GEN_EXE})
@@ -127,10 +131,6 @@ else()
   set(GEN_DEP gen)
 endif()
 
-if(ENABLE_UPDATER)
-  add_subdirectory(updater)
-endif()
-
 if(ENABLE_STEAM)
   add_subdirectory(steam)
 endif()
diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt
index 0db978e882..63b60a9aed 100644
--- a/src/app/CMakeLists.txt
+++ b/src/app/CMakeLists.txt
@@ -717,6 +717,7 @@ target_link_libraries(app-lib
   laf-os
   ui-lib
   ver-lib
+  updater-lib
   undo
   ${CMARK_LIBRARIES}
   ${TINYXML_LIBRARY}
@@ -756,10 +757,6 @@ if(ENABLE_SCRIPTING)
   endif()
 endif()
 
-if(ENABLE_UPDATER)
-  target_link_libraries(app-lib updater-lib)
-endif()
-
 if(ENABLE_STEAM)
   # We need the ENABLE_STEAM flag in main module too so AppOptions are
   # equal in both modules, app-lib and main (that's why this flag is
diff --git a/src/updater/CMakeLists.txt b/src/updater/CMakeLists.txt
index 6dc818caf3..15e6b4c8f2 100644
--- a/src/updater/CMakeLists.txt
+++ b/src/updater/CMakeLists.txt
@@ -1,15 +1,15 @@
 # ASEPRITE
-# Copyright (C) 2020-2021  Igara Studio S.A.
+# Copyright (C) 2020-2024  Igara Studio S.A.
 # Copyright (C) 2001-2017  David Capello
 
-set(UPDATER_LIB_SOURCES
-  check_update.cpp
-  user_agent.cpp)
+# By default the updater-lib will contain only the functions related
+# the user agent string.
+add_library(updater-lib user_agent.cpp)
+target_link_libraries(updater-lib laf-base ver-lib)
 
-add_library(updater-lib ${UPDATER_LIB_SOURCES})
-
-target_link_libraries(updater-lib
-  laf-base
-  net-lib
-  ver-lib
-  ${TINYXML_LIBRARY})
+# Only when ENABLE_UPDATER is ON we'll enable the "check for update"
+# portion of the library.
+if(ENABLE_UPDATER)
+  target_sources(updater-lib PRIVATE check_update.cpp)
+  target_link_libraries(updater-lib net-lib ${TINYXML_LIBRARY})
+endif()