all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
To: 70880@debbugs.gnu.org
Cc: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Subject: [bug#70880] [PATCH 5/8] gnu: heatshrink: New variable.
Date: Sat, 11 May 2024 20:58:33 +0300	[thread overview]
Message-ID: <5ed96653a085765c79a2bf6b0150ddab179339f9.1715450052.git.poptsov.artyom@gmail.com> (raw)
In-Reply-To: <cover.1715450052.git.poptsov.artyom@gmail.com>

* gnu/packages/compression.scm (heatshrink): New variable.
* gnu/packages/patches/heatshrink-add-cmake.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add "heatshrink-add-cmake.patch".

Change-Id: I0beccdcaed22e47ac6bfe522497e0759a315813d
---
 gnu/local.mk                                  |   1 +
 gnu/packages/compression.scm                  |  54 +++++++++
 .../patches/heatshrink-add-cmake.patch        | 111 ++++++++++++++++++
 3 files changed, 166 insertions(+)
 create mode 100644 gnu/packages/patches/heatshrink-add-cmake.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index edd546f81d..3ba9253ae2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1455,6 +1455,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/hdf-eos5-remove-gctp.patch		\
   %D%/packages/patches/hdf-eos5-fix-szip.patch			\
   %D%/packages/patches/hdf-eos5-fortrantests.patch		\
+  %D%/packages/patches/heatshrink-add-cmake.patch		\
   %D%/packages/patches/heimdal-CVE-2022-45142.patch		\
   %D%/packages/patches/helm-fix-gcc-9-build.patch		\
   %D%/packages/patches/highlight-gui-data-dir.patch		\
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 55784a70de..187bc73f2f 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -39,6 +39,7 @@
 ;;; Copyright © 2022 Zhu Zihao <all_but_last@163.com>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
 ;;; Copyright © 2024 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -570,6 +571,59 @@ (define-public xz
    (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
    (home-page "https://tukaani.org/xz/")))
 
+(define-public heatshrink
+  (package
+    (name "heatshrink")
+    (version "0.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/atomicobject/heatshrink/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sdhvk27yz8kahw18j8pddbpkgl78v8rh8fx6wspc3acj7w7yvrn"))
+       ;; Add CMake build script, wanted by prusa-slicer and libbgcode, which are the
+       ;; only users of this library.
+       ;;
+       ;; See
+       ;; <https://github.com/NixOS/nixpkgs/pull/269758/commits/fa36136ceed0e2c58e0c9e21492a7e60c3a64470>
+       (patches (search-patches "heatshrink-add-cmake.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      ;; XXX: No tests available with CMake.
+      ;; See <https://github.com/atomicobject/heatshrink/pull/77>
+      #:tests? #f))
+    (home-page "https://github.com/atomicobject/heatshrink/")
+    (synopsis "Data compression library for embedded/real-time systems")
+    (description
+     "A data compression/decompression library for embedded/real-time systems.
+
+Key features:
+@itemize
+@item Low memory usage (as low as 50 bytes.)
+
+It is useful for some cases with less than 50 bytes, and useful for many general
+cases with < 300 bytes.
+
+@item Incremental, bounded CPU use.
+
+You can chew on input data in arbitrarily tiny bites.  This is a useful property in
+hard real-time environments.
+
+@item Can use either static or dynamic memory allocation.
+
+The library doesn't impose any constraints on memory management.
+
+@item ISC license.
+
+You can use it freely, even for commercial purposes.
+@end itemize
+")
+    (license license:isc)))
+
 (define-public lhasa
   (package
     (name "lhasa")
diff --git a/gnu/packages/patches/heatshrink-add-cmake.patch b/gnu/packages/patches/heatshrink-add-cmake.patch
new file mode 100644
index 0000000000..f67f87126e
--- /dev/null
+++ b/gnu/packages/patches/heatshrink-add-cmake.patch
@@ -0,0 +1,111 @@
+From 0886e9ca76552b8e325841e2b820b4563e5d5aba Mon Sep 17 00:00:00 2001
+From: tamasmeszaros <meszaros.q@gmail.com>
+Date: Thu, 27 Jul 2023 23:11:25 +0200
+Subject: [PATCH] Add CMake build script
+
+---
+ CMakeLists.txt  | 82 +++++++++++++++++++++++++++++++++++++++++++++++++
+ Config.cmake.in |  5 +++
+ 2 files changed, 87 insertions(+)
+ create mode 100644 CMakeLists.txt
+ create mode 100644 Config.cmake.in
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 0000000..5b840eb
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,82 @@
++cmake_minimum_required(VERSION 3.10)
++
++project(heatshrink C)
++
++add_library(${PROJECT_NAME} heatshrink_decoder.c heatshrink_encoder.c)
++add_library(${PROJECT_NAME}_dynalloc heatshrink_decoder.c heatshrink_encoder.c)
++
++find_library(MATH_LIBRARY m) # Business as usual
++if(MATH_LIBRARY)
++    target_link_libraries(${PROJECT_NAME} PUBLIC ${MATH_LIBRARY})
++endif()
++
++target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
++target_include_directories(${PROJECT_NAME}_dynalloc PUBLIC $<INSTALL_INTERFACE:include>)
++
++target_compile_definitions(${PROJECT_NAME} PUBLIC HEATSHRINK_DYNAMIC_ALLOC=0)
++target_compile_definitions(${PROJECT_NAME}_dynalloc PUBLIC HEATSHRINK_DYNAMIC_ALLOC=1)
++
++if (UNIX)
++  add_executable(${PROJECT_NAME}_cmd heatshrink.c)
++  target_link_libraries(${PROJECT_NAME}_cmd ${PROJECT_NAME}_dynalloc)
++  set_target_properties(${PROJECT_NAME}_cmd PROPERTIES OUTPUT_NAME ${PROJECT_NAME})
++endif ()
++
++# Installation and export:
++
++include(CMakePackageConfigHelpers)
++
++write_basic_package_version_file(
++    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
++    VERSION 0.4.1
++    COMPATIBILITY AnyNewerVersion
++)
++
++set(_exported_targets ${PROJECT_NAME} ${PROJECT_NAME}_dynalloc)
++if (UNIX)
++  list(APPEND _exported_targets ${PROJECT_NAME}_cmd)
++endif ()
++
++install(TARGETS ${_exported_targets}
++        EXPORT ${PROJECT_NAME}Targets
++)
++
++export(EXPORT ${PROJECT_NAME}Targets 
++       FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake" 
++       NAMESPACE ${PROJECT_NAME}::
++)
++
++include(GNUInstallDirs)
++set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
++
++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
++  "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
++  INSTALL_DESTINATION ${ConfigPackageLocation}
++)
++
++install(
++    FILES
++      heatshrink_common.h
++      heatshrink_config.h
++      heatshrink_encoder.h
++      heatshrink_decoder.h
++    DESTINATION
++      include/${PROJECT_NAME}
++  )
++
++install(EXPORT ${PROJECT_NAME}Targets
++  FILE
++    ${PROJECT_NAME}Targets.cmake
++  NAMESPACE
++    ${PROJECT_NAME}::
++  DESTINATION
++    ${ConfigPackageLocation}
++)
++
++install(
++  FILES
++    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
++    "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
++  DESTINATION
++    ${ConfigPackageLocation}
++)
+diff --git a/Config.cmake.in b/Config.cmake.in
+new file mode 100644
+index 0000000..0809ba9
+--- /dev/null
++++ b/Config.cmake.in
+@@ -0,0 +1,5 @@
++@PACKAGE_INIT@
++
++if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake)
++    include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
++endif ()
-- 
2.41.0





  parent reply	other threads:[~2024-05-11 18:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-11 17:56 [bug#70880] [PATCH 0/8] gnu: prusa-slicer: Update to 2.7.4 Artyom V. Poptsov
2024-05-11 17:58 ` [bug#70880] [PATCH 1/8] gnu: cgal: Update to 5.6.1 Artyom V. Poptsov
2024-05-11 17:58 ` [bug#70880] [PATCH 2/8] gnu: glfw: Update to 3.3.10 Artyom V. Poptsov
2024-05-11 17:58 ` [bug#70880] [PATCH 3/8] gnu: glfw-3.4: New variable Artyom V. Poptsov
2024-05-11 17:58 ` [bug#70880] [PATCH 4/8] gnu: libigl: Update to 2.4.0 Artyom V. Poptsov
2024-05-11 17:58 ` Artyom V. Poptsov [this message]
2024-06-24  3:22   ` [bug#70880] [PATCH 5/8] gnu: heatshrink: New variable Maxim Cournoyer
2024-06-24  3:24   ` Maxim Cournoyer
2024-05-11 17:58 ` [bug#70880] [PATCH 6/8] gnu: Add prusa-libbgcode Artyom V. Poptsov
2024-06-24  3:18   ` Maxim Cournoyer
2024-07-01 16:25     ` Artyom V. Poptsov
2024-07-09 18:59       ` Artyom V. Poptsov
2024-05-11 17:58 ` [bug#70880] [PATCH 7/8] gnu: Add prusa-wxwidgets Artyom V. Poptsov
2024-06-24  3:28   ` Maxim Cournoyer
2024-06-24  3:30   ` Maxim Cournoyer
2024-05-11 17:58 ` [bug#70880] [PATCH 8/8] gnu: prusa-slicer: Update to 2.7.4 Artyom V. Poptsov
2024-06-24  3:38   ` Maxim Cournoyer
2024-06-08 14:27 ` [bug#70880] [PATCH 0/8] " Artyom V. Poptsov
2024-08-12 22:41 ` bug#70880: " Sharlatan Hellseher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ed96653a085765c79a2bf6b0150ddab179339f9.1715450052.git.poptsov.artyom@gmail.com \
    --to=poptsov.artyom@gmail.com \
    --cc=70880@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.