Modify not to use libdivsufsort if profile is tv 67/312467/3 accepted/tizen/unified/20240611.162853 accepted/tizen/unified/x/20240612.030016
authorSangYoun Kwak <sy.kwak@samsung.com>
Mon, 10 Jun 2024 09:18:02 +0000 (18:18 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Tue, 11 Jun 2024 02:39:12 +0000 (11:39 +0900)
There are no package named libdivsufsort in tv profile environment.
Thus, it is required to not use libdivsufsort if the profile is tv.
(ss_bsdiff is not used in tv profile so libdivsufsort is not mandatory)
To not use libdivsufsort, dummy functions are added.

Change-Id: Iad7c8432f0c35473d07df1659c3a35fcabe595df
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
bsdiff/CMakeLists.txt
bsdiff/ss_bsdiff.c
packaging/upgrade-tools.spec

index 66d45f876f85fdec5e48d96238bc2e7d75007c22..0aa8b5d040d4fa85c259f95f44f243262b20c6e1 100644 (file)
@@ -5,8 +5,21 @@ SET(ss_bsdiff_SRCS ss_bsdiff.c)
 
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/bsdiff)
 
+if (${ENABLE_LIBDIVSUFSORT})
+       ADD_DEFINITIONS("-DENABLE_LIBDIVSUFSORT=1")
+       SET(PKG_MODULES
+               libdivsufsort
+               libbrotlienc
+       )
+else()
+       ADD_DEFINITIONS("-DENABLE_LIBDIVSUFSORT=0")
+       SET(PKG_MODULES
+               libbrotlienc
+       )
+endif()
+
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${PROJECT_NAME}_pkgs REQUIRED libdivsufsort libbrotlienc)
+pkg_check_modules(${PROJECT_NAME}_pkgs REQUIRED ${PKG_MODULES})
 
 FOREACH(flag ${${PROJECT_NAME}_pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index b6b25bf86c3312bec3917afca9c524c29ec461b6..3dffcf78520b3a399743bcc28b8977234ac4a1ed 100644 (file)
@@ -78,9 +78,45 @@ void get_time_stamp(void)
        snprintf(ts1, 256, "%06d.%03d", sec % 100000, msec);
 }
 #endif
+
 #ifdef SUFSORT_MOD
+
+/**
+ * FIXME:
+ * Since the TV profile does not support libdivsufsort package, it is required
+ * to not use libdivsufsort if build profile is TV.
+ * Thus, dummy codes for libdivsufsort is added to use when the profile is TV.
+ * ENABLE_LIBDIVSUFSORT is 0 if it is TV profile,
+ * else ENABLE_LIBDIVSUFSORT is 1.
+ */
+#if ENABLE_LIBDIVSUFSORT == 1
+
 //supporting only 32 bit divsufsort for now.
 #include <divsufsort.h>
+
+#elif ENABLE_LIBDIVSUFSORT == 0
+
+#include <stdint.h>
+
+typedef int32_t saidx_t;
+typedef int32_t saint_t;
+typedef uint8_t sauchar_t;
+
+saint_t divsufsort(const sauchar_t *T, saidx_t *SA, saidx_t n)
+{
+       return 0;
+}
+
+saidx_t sa_search(const sauchar_t *T, saidx_t Tsize,
+               const sauchar_t *P, saidx_t Psize,
+               const saidx_t *SA, saidx_t SAsize,
+               saidx_t *left)
+{
+       return 0;
+}
+
+#endif
+
 #endif
 
 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
index ae513cf34d5cc1a82112f3a3d2dc14774ffc78c7..426b8a4421917ccbed176947177de450cdde9cad 100644 (file)
@@ -12,14 +12,22 @@ Source0:    %{name}-%{version}.tar.gz
 
 BuildRequires: cmake
 BuildRequires: pkgconfig(libbrotlienc)
+%if "%{tizen_profile_name}" != "tv"
 BuildRequires: pkgconfig(libdivsufsort)
+%endif
 
 %description
 Tools for upgrade
 
 %prep
 %setup -q
-%cmake . -DINSTALL_PATH=%{bin_install_path}
+%cmake . \
+       -DINSTALL_PATH=%{bin_install_path} \
+%if "%{tizen_profile_name}" == "tv"
+       -DENABLE_LIBDIVSUFSORT=0
+%else
+       -DENABLE_LIBDIVSUFSORT=1
+%endif
 
 %build
 make %{?jobs:-j%jobs}