Subject: Re: bug#65835: [PATCH] gnu: tensorflow-lite: Update to 2.13.0
From: Ludovic Courtès <[email-masked]>
To: Andy Tai <[email-masked]>
Cc: [email-masked]
Date: Mon, 18 Sep 2023 23:29:56 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

Andy Tai <[email-masked]> skribis:

> * gnu/packages/machine-learning.scm: (tensorflow-lite):
> Update to 2.13.0
> [inputs]: Add gemmlowp
> [native-inputs]: Remove gemmlowp-src
> * gnu/packages/patches/tensorflow-lite-disable-local-cmake-3rdparty-components.patch:
> New file
> * gnu/local.mk (dist_patch_DATA): Add it.

Applied with the changes below: shortening the patch file name (as
reported by ‘guix lint’), fixing typos, removing leftover comments.

Thanks,
Ludo’.

diff --git a/gnu/local.mk b/gnu/local.mk
index 85bdc19145..de3cb0332c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2003,7 +2003,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/tcsh-fix-autotest.patch			\
   %D%/packages/patches/teensy-loader-cli-help.patch		\
   %D%/packages/patches/tensorflow-c-api-fix.patch		\
-  %D%/packages/patches/tensorflow-lite-disable-local-cmake-3rdparty-components.patch  \
+  %D%/packages/patches/tensorflow-lite-unbundle.patch 		\
   %D%/packages/patches/texinfo-headings-single.patch		\
   %D%/packages/patches/texinfo-5-perl-compat.patch		\
   %D%/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch   \
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 23975dadf2..abba41626d 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -3008,11 +3008,7 @@ (define-public tensorflow-lite
        (sha256
         (base32
          "07g6vlrs0aayrg2mfdl15gxg5dy103wx2xlqkran15dib40nkbj6"))
-       (patches
-        (search-patches
-        ;; patch to disable local cmake build code for 3rdparty
-        ;; componentas
-         "tensorflow-lite-disable-local-cmake-3rdparty-components.patch"))))
+       (patches (search-patches "tensorflow-lite-unbundle.patch"))))
     (build-system cmake-build-system)
     (arguments
      (list
@@ -3068,7 +3064,6 @@ (define-public tensorflow-lite
 
          "-DFFT2D_SOURCE_DIR=/tmp/fft2d"
          "-DFARMHASH_SOURCE_DIR=/tmp/farmhash"
-         ;"-Dgemmlowp_SOURCE_DIR=/tmp/gemmlowp"
          (string-append "-Dgemmlowp_ROOT=" #$(this-package-input "gemmlowp")))
       #:phases
       #~(modify-phases %standard-phases
@@ -3145,19 +3140,6 @@ (define-public tensorflow-lite
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("googletest" ,googletest)
-       ;("gemmlowp-src"
-       ; ;; The commit hash is taken from
-       ; ;; "tensorflow/lite/tools/cmake/modules/gemmlowp.cmake".
-       ; ,(let ((commit "fda83bdc38b118cc6b56753bd540caa49e570745"))
-       ;    (origin
-       ;      (method git-fetch)
-       ;      (uri (git-reference
-       ;            (url "https://github.com/google/gemmlowp")
-       ;            (commit commit)))
-       ;      (file-name (git-file-name "gemmlowp" (string-take commit 8)))
-       ;      (sha256
-       ;       (base32
-       ;        "1sbp8kmr2azwlvfbzryy1frxi99jhsh1nc93bdbxdf8zdgpv0kxl")))))
        ("farmhash-src"
         ,(let ((commit "816a4ae622e964763ca0862d9dbd19324a1eaf45"))
            (origin
diff --git a/gnu/packages/patches/tensorflow-lite-disable-local-cmake-3rdparty-components.patch b/gnu/packages/patches/tensorflow-lite-unbundle.patch
similarity index 86%
rename from gnu/packages/patches/tensorflow-lite-disable-local-cmake-3rdparty-components.patch
rename to gnu/packages/patches/tensorflow-lite-unbundle.patch
index 677a6be8c3..efd7d5bbc6 100644
--- a/gnu/packages/patches/tensorflow-lite-disable-local-cmake-3rdparty-components.patch
+++ b/gnu/packages/patches/tensorflow-lite-unbundle.patch
@@ -1,4 +1,4 @@
-Patch to disable local cmake build code for 3rdparty componentas
+Disable local CMake build code for bundled 3rdparty components.
 
 diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt
 index 0476170e075..90abea00e8c 100644
@@ -17,12 +17,11 @@ diff --git a/tensorflow/lite/tools/cmake/modules/Findgemmlowp.cmake b/tensorflow
 index 70331ad0a69..a9bd8a0f3bd 100644
 --- a/tensorflow/lite/tools/cmake/modules/Findgemmlowp.cmake
 +++ b/tensorflow/lite/tools/cmake/modules/Findgemmlowp.cmake
-@@ -18,7 +18,7 @@
+@@ -18,7 +18,6 @@
  include(gemmlowp)
  if(gemmlowp_POPULATED)
    set(GEMMLOWP_FOUND TRUE)
 -  get_target_property(GEMMLOWP_INCLUDE_DIRS gemmlowp INTERFACE_DIRECTORIES)
-+  #get_target_property(GEMMLOWP_INCLUDE_DIRS gemmlowp INTERFACE_DIRECTORIES)
    set(GEMMLOWP_LIBRARIES
      gemmlowp
      gemmlowp_fixedpoint