[PATCH 0/2] Add docxbox

  • Open
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Wiktor ?elazny
Owner
unassigned
Submitted by
Wiktor ?elazny
Severity
normal
W
W
Wiktor ?elazny wrote on 22 Aug 2022 11:27
(address . guix-patches@gnu.org)(name . Wiktor ?elazny)(address . wz@freeshell.de)
20220822092753.31295-1-wz@freeshell.de
The docxbox patch is probably not ready for applying, yet (but it should
be close). This is my first attempt at “unvendoring”. The thing builds
and seems to work. The problem is that etc/ld.so.cache gets created. I
have no idea where it comes from, but I suspect that it shouldn’t be
there, as it’s easy to imagine a conflict if multiple packages with
etc/ld.so.cache are being installed.

miniz-cpp-fixed-duplicated-symbols.patch is the last commit in


I think I just used `git show` and redirected the output to the file.
I’m noting this because I’m not sure if there are any potential
copyright issues involved in such a workflow.

I couldn’t get the test suite to work. Please, see the comment in the
package definition for the details.

Then, there are linter messages:

/home/<USER>/guix/guix-git/gnu/packages/textutils.scm:1512:12: docxbox@0.0.5: the source file name should contain the package name

Adding the

(file-name (git-file-name name version))

line removes the warning, but breaks the build.

/home/<USER>/guix/guix-git/gnu/packages/textutils.scm:1512:12: docxbox@0.0.5: the source URI should not be an autogenerated tarball

I’m guessing this refers to GitHub Automatic Releases feature.
Unfortunately, there are no other releases to choose from in that
repository.

Finally, there’s the question related to the MS Word being proprietary
software. I don’t think there should be controversies here, as docxbox
is about interacting with the docx format, rather than the software
itself. And the format itself is standardized. Perhaps the synopsis
the package should avoid mentioning MS Word. I borrowed it from the
docxbox repository.

Wiktor ?elazny (2):
gnu: Add miniz-cpp.
gnu: Add docxbox.

gnu/local.mk | 1 +
gnu/packages/cpp.scm | 27 +
.../miniz-cpp-fixed-duplicated-symbols.patch | 2734 +++++++++++++++++
gnu/packages/textutils.scm | 73 +-
4 files changed, 2833 insertions(+), 2 deletions(-)
create mode 100644 gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch


base-commit: b8f2eb286ec52c97048e23d326d94ae5772797e8
--
2.37.2
W
W
Wiktor ?elazny wrote on 22 Aug 2022 11:36
[PATCH 1/2] gnu: Add miniz-cpp.
(address . 57337@debbugs.gnu.org)(name . Wiktor ?elazny)(address . wzelazny@vurv.cz)
20220822093651.31574-1-wz@freeshell.de
From: Wiktor ?elazny <wzelazny@vurv.cz>

* gnu/packages/cpp.scm (miniz-cpp): New variable.
---
gnu/local.mk | 1 +
gnu/packages/cpp.scm | 27 +
.../miniz-cpp-fixed-duplicated-symbols.patch | 2734 +++++++++++++++++
3 files changed, 2762 insertions(+)
create mode 100644 gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch

Toggle diff (390 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 26dfb6afe2..ccfcfde2e6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1511,6 +1511,7 @@ dist_patch_DATA = \
%D%/packages/patches/mingw-w64-6.0.0-gcc.patch \
%D%/packages/patches/mingw-w64-dlltool-temp-prefix.patch \
%D%/packages/patches/mingw-w64-reproducible-gendef.patch \
+ %D%/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch \
%D%/packages/patches/minisat-friend-declaration.patch \
%D%/packages/patches/minisat-install.patch \
%D%/packages/patches/mit-krb5-hurd.patch \
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index e6d734010d..3e5cf9451f 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1905,3 +1905,30 @@ (define-public cpp-mustache
templated string type for compatibility with any STL-like string (std::string,
std::wstring, etc).")
(license license:boost1.0)))
+
+(define-public miniz-cpp
+ (let ((commit "052335e4f7773368df07b26d2baedb0e6d4dbd38")
+ (revision "1"))
+ (package
+ (name "miniz-cpp")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tfussell/miniz-cpp.git")
+ (commit commit)))
+ (sha256
+ (base32
+ "1y8wzplyq2910fms2l9z1k6xrxb2x4w3gryykqkj11rwpkadw7b9"))
+ (patches (search-patches
+ ;; To be removed once https://github.com/tfussell/miniz-cpp/pull/11
+ ;; gets merged.
+ "miniz-cpp-fixed-duplicated-symbols.patch"))))
+ (build-system copy-build-system)
+ (home-page "https://github.com/tfussell/miniz-cpp/")
+ (synopsis
+ "A header-only C++14 library for reading and writing ZIP files")
+ (description
+ "@code{miniz-cpp} is a cross-platform header-only library for reading and
+writing ZIP files using a nice simple API similar to Python's @code{zipfile}.")
+ (license license:expat))))
diff --git a/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
new file mode 100644
index 0000000000..035f989767
--- /dev/null
+++ b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
@@ -0,0 +1,2734 @@
+commit 64f974213ac16f78c008bd148c8a2a07e902f148
+Author: Kay Stenschke <info@stenschke.com>
+Date: Mon Apr 27 12:13:34 2020 +0200
+
+ Fixed duplicated symbols
+
+ Using miniz-cpp from multiple translation units caused linker error.
+ Done: marked declarations as static for correct linking from multiple translation units.
+
+diff --git a/zip_file.hpp b/zip_file.hpp
+index c324f70..3aff33c 100644
+--- a/zip_file.hpp
++++ b/zip_file.hpp
+@@ -226,12 +226,12 @@
+ //#define MINIZ_NO_MALLOC
+
+ #if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
+- // TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
++// TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
+ #define MINIZ_NO_TIME
+ #endif
+
+ #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
+- #include <time.h>
++#include <time.h>
+ #endif
+
+ #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
+@@ -272,15 +272,15 @@ extern "C" {
+ typedef unsigned long mz_ulong;
+
+ // mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap.
+-void mz_free(void *p);
++static void mz_free(void *p);
+
+ #define MZ_ADLER32_INIT (1)
+ // mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL.
+-mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
++static mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
+
+ #define MZ_CRC32_INIT (0)
+ // mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL.
+-mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
++static mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
+
+ // Compression strategies.
+ enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 };
+@@ -343,7 +343,7 @@ typedef struct mz_stream_s
+ typedef mz_stream *mz_streamp;
+
+ // Returns the version string of miniz.c.
+-const char *mz_version(void);
++static const char *mz_version(void);
+
+ // mz_deflateInit() initializes a compressor with default options:
+ // Parameters:
+@@ -356,17 +356,17 @@ const char *mz_version(void);
+ // MZ_STREAM_ERROR if the stream is bogus.
+ // MZ_PARAM_ERROR if the input parameters are bogus.
+ // MZ_MEM_ERROR on out of memory.
+-int mz_deflateInit(mz_streamp pStream, int level);
++static int mz_deflateInit(mz_streamp pStream, int level);
+
+ // mz_deflateInit2() is like mz_deflate(), except with more control:
+ // Additional parameters:
+ // method must be MZ_DEFLATED
+ // window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer)
+ // mem_level must be between [1, 9] (it's checked but ignored by miniz.c)
+-int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
++static int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
+
+ // Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2().
+-int mz_deflateReset(mz_streamp pStream);
++static int mz_deflateReset(mz_streamp pStream);
+
+ // mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible.
+ // Parameters:
+@@ -378,31 +378,31 @@ int mz_deflateReset(mz_streamp pStream);
+ // MZ_STREAM_ERROR if the stream is bogus.
+ // MZ_PARAM_ERROR if one of the parameters is invalid.
+ // MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.)
+-int mz_deflate(mz_streamp pStream, int flush);
++static int mz_deflate(mz_streamp pStream, int flush);
+
+ // mz_deflateEnd() deinitializes a compressor:
+ // Return values:
+ // MZ_OK on success.
+ // MZ_STREAM_ERROR if the stream is bogus.
+-int mz_deflateEnd(mz_streamp pStream);
++static int mz_deflateEnd(mz_streamp pStream);
+
+ // mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH.
+-mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
++static mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
+
+ // Single-call compression functions mz_compress() and mz_compress2():
+ // Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure.
+-int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
+-int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
++static int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
++static int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
+
+ // mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress().
+-mz_ulong mz_compressBound(mz_ulong source_len);
++static mz_ulong mz_compressBound(mz_ulong source_len);
+
+ // Initializes a decompressor.
+-int mz_inflateInit(mz_streamp pStream);
++static int mz_inflateInit(mz_streamp pStream);
+
+ // mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer:
+ // window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate).
+-int mz_inflateInit2(mz_streamp pStream, int window_bits);
++static int mz_inflateInit2(mz_streamp pStream, int window_bits);
+
+ // Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible.
+ // Parameters:
+@@ -418,91 +418,91 @@ int mz_inflateInit2(mz_streamp pStream, int window_bits);
+ // MZ_PARAM_ERROR if one of the parameters is invalid.
+ // MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again
+ // with more input data, or with more room in the output buffer (except when using single call decompression, described above).
+-int mz_inflate(mz_streamp pStream, int flush);
++static int mz_inflate(mz_streamp pStream, int flush);
+
+ // Deinitializes a decompressor.
+-int mz_inflateEnd(mz_streamp pStream);
++static int mz_inflateEnd(mz_streamp pStream);
+
+ // Single-call decompression.
+ // Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure.
+-int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
++static int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
+
+ // Returns a string description of the specified error code, or NULL if the error code is invalid.
+-const char *mz_error(int err);
++static const char *mz_error(int err);
+
+ // Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports.
+ // Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project.
+ #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
+- typedef unsigned char Byte;
+- typedef unsigned int uInt;
+- typedef mz_ulong uLong;
+- typedef Byte Bytef;
+- typedef uInt uIntf;
+- typedef char charf;
+- typedef int intf;
+- typedef void *voidpf;
+- typedef uLong uLongf;
+- typedef void *voidp;
+- typedef void *const voidpc;
+- #define Z_NULL 0
+- #define Z_NO_FLUSH MZ_NO_FLUSH
+- #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
+- #define Z_SYNC_FLUSH MZ_SYNC_FLUSH
+- #define Z_FULL_FLUSH MZ_FULL_FLUSH
+- #define Z_FINISH MZ_FINISH
+- #define Z_BLOCK MZ_BLOCK
+- #define Z_OK MZ_OK
+- #define Z_STREAM_END MZ_STREAM_END
+- #define Z_NEED_DICT MZ_NEED_DICT
+- #define Z_ERRNO MZ_ERRNO
+- #define Z_STREAM_ERROR MZ_STREAM_ERROR
+- #define Z_DATA_ERROR MZ_DATA_ERROR
+- #define Z_MEM_ERROR MZ_MEM_ERROR
+- #define Z_BUF_ERROR MZ_BUF_ERROR
+- #define Z_VERSION_ERROR MZ_VERSION_ERROR
+- #define Z_PARAM_ERROR MZ_PARAM_ERROR
+- #define Z_NO_COMPRESSION MZ_NO_COMPRESSION
+- #define Z_BEST_SPEED MZ_BEST_SPEED
+- #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
+- #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
+- #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
+- #define Z_FILTERED MZ_FILTERED
+- #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
+- #define Z_RLE MZ_RLE
+- #define Z_FIXED MZ_FIXED
+- #define Z_DEFLATED MZ_DEFLATED
+- #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
+- #define alloc_func mz_alloc_func
+- #define free_func mz_free_func
+- #define internal_state mz_internal_state
+- #define z_stream mz_stream
+- #define deflateInit mz_deflateInit
+- #define deflateInit2 mz_deflateInit2
+- #define deflateReset mz_deflateReset
+- #define deflate mz_deflate
+- #define deflateEnd mz_deflateEnd
+- #define deflateBound mz_deflateBound
+- #define compress mz_compress
+- #define compress2 mz_compress2
+- #define compressBound mz_compressBound
+- #define inflateInit mz_inflateInit
+- #define inflateInit2 mz_inflateInit2
+- #define inflate mz_inflate
+- #define inflateEnd mz_inflateEnd
+- #define uncompress mz_uncompress
+- #define crc32 mz_crc32
+- #define adler32 mz_adler32
+- #define MAX_WBITS 15
+- #define MAX_MEM_LEVEL 9
+- #define zError mz_error
+- #define ZLIB_VERSION MZ_VERSION
+- #define ZLIB_VERNUM MZ_VERNUM
+- #define ZLIB_VER_MAJOR MZ_VER_MAJOR
+- #define ZLIB_VER_MINOR MZ_VER_MINOR
+- #define ZLIB_VER_REVISION MZ_VER_REVISION
+- #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
+- #define zlibVersion mz_version
+- #define zlib_version mz_version()
++typedef unsigned char Byte;
++typedef unsigned int uInt;
++typedef mz_ulong uLong;
++typedef Byte Bytef;
++typedef uInt uIntf;
++typedef char charf;
++typedef int intf;
++typedef void *voidpf;
++typedef uLong uLongf;
++typedef void *voidp;
++typedef void *const voidpc;
++#define Z_NULL 0
++#define Z_NO_FLUSH MZ_NO_FLUSH
++#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
++#define Z_SYNC_FLUSH MZ_SYNC_FLUSH
++#define Z_FULL_FLUSH MZ_FULL_FLUSH
++#define Z_FINISH MZ_FINISH
++#define Z_BLOCK MZ_BLOCK
++#define Z_OK MZ_OK
++#define Z_STREAM_END MZ_STREAM_END
++#define Z_NEED_DICT MZ_NEED_DICT
++#define Z_ERRNO MZ_ERRNO
++#define Z_STREAM_ERROR MZ_STREAM_ERROR
++#define Z_DATA_ERROR MZ_DATA_ERROR
++#define Z_MEM_ERROR MZ_MEM_ERROR
++#define Z_BUF_ERROR MZ_BUF_ERROR
++#define Z_VERSION_ERROR MZ_VERSION_ERROR
++#define Z_PARAM_ERROR MZ_PARAM_ERROR
++#define Z_NO_COMPRESSION MZ_NO_COMPRESSION
++#define Z_BEST_SPEED MZ_BEST_SPEED
++#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
++#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
++#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
++#define Z_FILTERED MZ_FILTERED
++#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
++#define Z_RLE MZ_RLE
++#define Z_FIXED MZ_FIXED
++#define Z_DEFLATED MZ_DEFLATED
++#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
++#define alloc_func mz_alloc_func
++#define free_func mz_free_func
++#define internal_state mz_internal_state
++#define z_stream mz_stream
++#define deflateInit mz_deflateInit
++#define deflateInit2 mz_deflateInit2
++#define deflateReset mz_deflateReset
++#define deflate mz_deflate
++#define deflateEnd mz_deflateEnd
++#define deflateBound mz_deflateBound
++#define compress mz_compress
++#define compress2 mz_compress2
++#define compressBound mz_compressBound
++#define inflateInit mz_inflateInit
++#define inflateInit2 mz_inflateInit2
++#define inflate mz_inflate
++#define inflateEnd mz_inflateEnd
++#define uncompress mz_uncompress
++#define crc32 mz_crc32
++#define adler32 mz_adler32
++#define MAX_WBITS 15
++#define MAX_MEM_LEVEL 9
++#define zError mz_error
++#define ZLIB_VERSION MZ_VERSION
++#define ZLIB_VERNUM MZ_VERNUM
++#define ZLIB_VER_MAJOR MZ_VER_MAJOR
++#define ZLIB_VER_MINOR MZ_VER_MINOR
++#define ZLIB_VER_REVISION MZ_VER_REVISION
++#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
++#define zlibVersion mz_version
++#define zlib_version mz_version()
+ #endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
+
+ #endif // MINIZ_NO_ZLIB_APIS
+@@ -523,9 +523,9 @@ typedef int mz_bool;
+
+ // An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message.
+ #ifdef _MSC_VER
+- #define MZ_MACRO_END while (0, 0)
++#define MZ_MACRO_END while (0, 0)
+ #else
+- #define MZ_MACRO_END while (0)
++#define MZ_MACRO_END while (0)
+ #endif
+
+ // ------------------- ZIP archive reading/writing
+@@ -609,68 +609,68 @@ typedef enum
+
+ // Inits a ZIP archive reader.
+ // These functions read and validate the archive's central directory.
+-mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags);
+-mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags);
++static mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags);
++static mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags);
+
+ #ifndef MINIZ_NO_STDIO
+-mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags);
++static mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags);
+ #endif
+
+ // Returns the total number of files in the archive.
+-mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip);
++static mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip);
+
+ // Returns detailed information about an archive file entry.
+-mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat);
++static mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat);
+
+ // Determines if an archive file entry is a directory entry.
+-mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index);
+-mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index);
++static mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index);
++static mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index);
+
+ // Retrieves the filename of an archive file entry.
+ // Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename.
+-mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
++static mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
+
+ // Attempts to locates a file in the archive's central directory.
+ // Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH
+ // Returns -1 if the file cannot be found.
+-int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
++static int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
+
+ // Extracts a archive file to a memory buffer using no memory allocation.
+-mz_bool mz_zip_reader_extract_to_mem_no_alloc(mz_zip_archive *pZip, mz_uint file_index, void *pBuf, size_t buf_size, mz_uint flags, void *pUser_read_buf, size_t user_read_buf_size);
+-mz_b
This message was truncated. Download the full message here.
W
W
Wiktor ?elazny wrote on 22 Aug 2022 11:36
[PATCH 2/2] gnu: Add docxbox.
(address . 57337@debbugs.gnu.org)(name . Wiktor ?elazny)(address . wzelazny@vurv.cz)
20220822093651.31574-2-wz@freeshell.de
From: Wiktor ?elazny <wzelazny@vurv.cz>

* gnu/packages/textutils.scm (docxbox): New variable.
---
gnu/packages/textutils.scm | 73 ++++++++++++++++++++++++++++++++++++--
1 file changed, 71 insertions(+), 2 deletions(-)

Toggle diff (104 lines)
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 7898d520f0..41a75c727d 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -18,7 +18,7 @@
;;; Copyright © 2018 Meiyo Peng <meiyo.peng@gmail.com>
;;; Copyright © 2019 Yoshinori Arai <kumagusu08@gmail.com>
;;; Copyright © 2019 M?d?lin Ionel Patra?cu <madalinionel.patrascu@mdc-berlin.de>
-;;; Copyright © 2019 Wiktor ?elazny <wzelazny@vurv.cz>
+;;; Copyright © 2019, 2022 Wiktor ?elazny <wzelazny@vurv.cz>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Jean-Baptiste Volatier <jbv@pm.me>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
@@ -58,6 +58,7 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages gcc)
#:use-module (gnu packages golang)
#:use-module (gnu packages gettext)
@@ -73,7 +74,8 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages ruby)
#:use-module (gnu packages slang)
#:use-module (gnu packages syncthing)
- #:use-module (gnu packages web))
+ #:use-module (gnu packages web)
+ #:use-module (gnu packages xml))
(define-public dos2unix
(package
@@ -1502,3 +1504,70 @@ (define-public ack
easily specify file types, match highlighting, Perl-Compatible Regular
Expressions, and being faster to type than grep.")
(license license:artistic2.0)))
+
+(define-public docxbox
+ (package
+ (name "docxbox")
+ (version "0.0.5")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/gyselroth/docxbox/archive/refs/tags/"
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "19ik3jhyyk26bj8x2adaxwwj8l4sg1h2kf2d0hw43yhsqki176cb"))
+ (modules '((guix build utils)))
+ (snippet '(begin
+ (for-each delete-file-recursively
+ '("bin" "vendor/json" "vendor/miniz-cpp"
+ "vendor/tinyxml2")) #t))))
+ (build-system cmake-build-system)
+ ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module
+ (inputs `(("json-modern-cxx-source" ,(package-source json-modern-cxx))
+ ("miniz-cpp-source" ,(package-source miniz-cpp))
+ ("tinyxml2-source" ,(package-source tinyxml2))))
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-after 'unpack 'unpack-json-modern-cxx
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "vendor/json-modern-cxx")
+ (copy-recursively (assoc-ref inputs
+ "json-modern-cxx-source")
+ "vendor/json") #t))
+ (add-after 'unpack 'unpack-miniz-cpp
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "vendor/miniz-cpp")
+ (copy-recursively (assoc-ref inputs "miniz-cpp-source")
+ "vendor/miniz-cpp") #t))
+ (add-after 'unpack 'unpack-tinyxml2
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "vendor/tinyxml2")
+ (copy-recursively (assoc-ref inputs "tinyxml2-source")
+ "vendor/tinyxml2") #t))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/usr/bin")))
+ (install-file "bin/linux/docxbox" bin)))))
+ #:configure-flags (let* ((out (assoc-ref %outputs "out")))
+ '("-DCMAKE_CXX_FLAGS=-fpermissive -Wno-error"))
+ ;; Tests depend on a bundled binary in bin/linux/, and even with the
+ ;; binary in place, I could not get them to run. To my understanding,
+ ;; the setup() function in test/functional/_helper.bash is supposed to
+ ;; copy the binary to the test suite directory. However, this does not
+ ;; seem to happen when invoking ./test.sh (make check is not
+ ;; supported), and the script complains about the missing binary in the
+ ;; directory. The fix could be to copy the binary built by the Guix
+ ;; daemon to the test suite directory before invoking ./test.sh, but
+ ;; this is beyond my skills.
+ #:tests? #f))
+ (home-page "https://github.com/gyselroth/docxbox/")
+ (synopsis "CLI tool for MS Word DOCX templating and analysis")
+ (description
+ "@command{docxbox} enables direct and convenient inspection and
+manipulation of XML and media files making up a DOCX file. The
+capabilities include batch editing, unpacking and indentation for manual
+editing in a text editor and subsequent unindentation and repacking,
+operations on metadata, and diffing")
+ (license license:expat)))
--
2.37.2
L
L
Ludovic Courtès wrote on 8 Sep 2022 14:44
Re: bug#57337: [PATCH 0/2] Add docxbox
(name . Wiktor ?elazny)(address . wz@freeshell.de)(address . 57337@debbugs.gnu.org)
877d2ehw89.fsf@gnu.org
Hi,

Wiktor ?elazny <wz@freeshell.de> skribis:

Toggle quote (7 lines)
> The docxbox patch is probably not ready for applying, yet (but it should
> be close). This is my first attempt at “unvendoring”. The thing builds
> and seems to work. The problem is that etc/ld.so.cache gets created. I
> have no idea where it comes from, but I suspect that it shouldn’t be
> there, as it’s easy to imagine a conflict if multiple packages with
> etc/ld.so.cache are being installed.

That’s OK: every package gets this file; see
for background.

Toggle quote (10 lines)
> Then, there are linter messages:
>
> /home/<USER>/guix/guix-git/gnu/packages/textutils.scm:1512:12: docxbox@0.0.5: the source file name should contain the package name
>
> Adding the
>
> (file-name (git-file-name name version))
>
> line removes the warning, but breaks the build.

Weird, how so? The name shouldn’t have any impact on the build process.
Could you investigate a bit?

Toggle quote (6 lines)
> /home/<USER>/guix/guix-git/gnu/packages/textutils.scm:1512:12: docxbox@0.0.5: the source URI should not be an autogenerated tarball
>
> I’m guessing this refers to GitHub Automatic Releases feature.
> Unfortunately, there are no other releases to choose from in that
> repository.

In that case, use ‘git-fetch’ instead of referring to the generated
tarball.

Toggle quote (7 lines)
> Finally, there’s the question related to the MS Word being proprietary
> software. I don’t think there should be controversies here, as docxbox
> is about interacting with the docx format, rather than the software
> itself. And the format itself is standardized. Perhaps the synopsis
> the package should avoid mentioning MS Word. I borrowed it from the
> docxbox repository.

It’s OK to mention Word to say that the tool allows you to read its
files.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 8 Sep 2022 14:46
(name . Wiktor ?elazny)(address . wz@freeshell.de)
8735d2hw51.fsf_-_@gnu.org
Wiktor ?elazny <wz@freeshell.de> skribis:

Toggle quote (4 lines)
> From: Wiktor ?elazny <wzelazny@vurv.cz>
>
> * gnu/packages/cpp.scm (miniz-cpp): New variable.

[...]

Toggle quote (59 lines)
> +++ b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
> @@ -0,0 +1,2734 @@
> +commit 64f974213ac16f78c008bd148c8a2a07e902f148
> +Author: Kay Stenschke <info@stenschke.com>
> +Date: Mon Apr 27 12:13:34 2020 +0200
> +
> + Fixed duplicated symbols
> +
> + Using miniz-cpp from multiple translation units caused linker error.
> + Done: marked declarations as static for correct linking from multiple translation units.
> +
> +diff --git a/zip_file.hpp b/zip_file.hpp
> +index c324f70..3aff33c 100644
> +--- a/zip_file.hpp
> ++++ b/zip_file.hpp
> +@@ -226,12 +226,12 @@
> + //#define MINIZ_NO_MALLOC
> +
> + #if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
> +- // TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
> ++// TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
> + #define MINIZ_NO_TIME
> + #endif
> +
> + #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
> +- #include <time.h>
> ++#include <time.h>
> + #endif
> +
> + #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
> +@@ -272,15 +272,15 @@ extern "C" {
> + typedef unsigned long mz_ulong;
> +
> + // mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap.
> +-void mz_free(void *p);
> ++static void mz_free(void *p);
> +
> + #define MZ_ADLER32_INIT (1)
> + // mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL.
> +-mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
> ++static mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
> +
> + #define MZ_CRC32_INIT (0)
> + // mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL.
> +-mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
> ++static mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
> +
> + // Compression strategies.
> + enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 };
> +@@ -343,7 +343,7 @@ typedef struct mz_stream_s
> + typedef mz_stream *mz_streamp;
> +
> + // Returns the version string of miniz.c.
> +-const char *mz_version(void);
> ++static const char *mz_version(void);
> +
> + // mz_deflateInit() initializes a compressor with default options:
> + // Parameters:

[...]

Toggle quote (48 lines)
> ++#define Z_NO_FLUSH MZ_NO_FLUSH
> ++#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
> ++#define Z_SYNC_FLUSH MZ_SYNC_FLUSH
> ++#define Z_FULL_FLUSH MZ_FULL_FLUSH
> ++#define Z_FINISH MZ_FINISH
> ++#define Z_BLOCK MZ_BLOCK
> ++#define Z_OK MZ_OK
> ++#define Z_STREAM_END MZ_STREAM_END
> ++#define Z_NEED_DICT MZ_NEED_DICT
> ++#define Z_ERRNO MZ_ERRNO
> ++#define Z_STREAM_ERROR MZ_STREAM_ERROR
> ++#define Z_DATA_ERROR MZ_DATA_ERROR
> ++#define Z_MEM_ERROR MZ_MEM_ERROR
> ++#define Z_BUF_ERROR MZ_BUF_ERROR
> ++#define Z_VERSION_ERROR MZ_VERSION_ERROR
> ++#define Z_PARAM_ERROR MZ_PARAM_ERROR
> ++#define Z_NO_COMPRESSION MZ_NO_COMPRESSION
> ++#define Z_BEST_SPEED MZ_BEST_SPEED
> ++#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
> ++#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
> ++#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
> ++#define Z_FILTERED MZ_FILTERED
> ++#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
> ++#define Z_RLE MZ_RLE
> ++#define Z_FIXED MZ_FIXED
> ++#define Z_DEFLATED MZ_DEFLATED
> ++#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
> ++#define alloc_func mz_alloc_func
> ++#define free_func mz_free_func
> ++#define internal_state mz_internal_state
> ++#define z_stream mz_stream
> ++#define deflateInit mz_deflateInit
> ++#define deflateInit2 mz_deflateInit2
> ++#define deflateReset mz_deflateReset
> ++#define deflate mz_deflate
> ++#define deflateEnd mz_deflateEnd
> ++#define deflateBound mz_deflateBound
> ++#define compress mz_compress
> ++#define compress2 mz_compress2
> ++#define compressBound mz_compressBound
> ++#define inflateInit mz_inflateInit
> ++#define inflateInit2 mz_inflateInit2
> ++#define inflate mz_inflate
> ++#define inflateEnd mz_inflateEnd
> ++#define uncompress mz_uncompress
> ++#define crc32 mz_crc32
> ++#define adler32 mz_adler32

It would seem that the code uses a bundled copy of zlib, which is why it
needs to rename things. Do I get it right?

If so, it would be best to remove the bundled zlib and instead add zlib
as an input.

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 8 Sep 2022 14:49
(name . Wiktor ?elazny)(address . wz@freeshell.de)
87y1uughf8.fsf_-_@gnu.org
Wiktor ?elazny <wz@freeshell.de> skribis:

Toggle quote (4 lines)
> From: Wiktor ?elazny <wzelazny@vurv.cz>
>
> * gnu/packages/textutils.scm (docxbox): New variable.

[...]

Toggle quote (5 lines)
> + (snippet '(begin
> + (for-each delete-file-recursively
> + '("bin" "vendor/json" "vendor/miniz-cpp"
> + "vendor/tinyxml2")) #t))))

You can remove the trailing #t, it’s no longer necessary.

Toggle quote (6 lines)
> + (build-system cmake-build-system)
> + ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module
> + (inputs `(("json-modern-cxx-source" ,(package-source json-modern-cxx))
> + ("miniz-cpp-source" ,(package-source miniz-cpp))
> + ("tinyxml2-source" ,(package-source tinyxml2))))

I’d suggest using the new style, which is to refer to those right in the
code, like so:

(arguments
(list #:phases #~(modify-phases …
(invoke "tar" "xf" #$(package-source whatever)))))

However, it would be best if, instead of re-building those three
libraries, docxbox would instead link against the .so provided by their
respective packages.

Toggle quote (2 lines)
> + (synopsis "CLI tool for MS Word DOCX templating and analysis")

s/CLI/Command-line/ (in general, avoid acronyms)

s/DOCX/@file{.docx}/ I would say.

Could you send updated patches?

Thanks,
Ludo’.
W
W
Wiktor ?elazny wrote on 23 Sep 2022 19:46
(name . Ludovic Courtès)(address . ludo@gnu.org)
20220923174640.2rw2o35yubdwohkg@nibiowz
On Thu, Sep 08, 2022 at 02:46:02PM +0200, Ludovic Courtès wrote:
Toggle quote (11 lines)
> Wiktor ?elazny <wz@freeshell.de> skribis:
>
> > * gnu/packages/cpp.scm (miniz-cpp): New variable.
>
> [...]
>
> > +++ b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
>
> It would seem that the code uses a bundled copy of zlib, which is why it
> needs to rename things. Do I get it right?

Hi Ludo,

No, it does not appear to include zlib.

W?
-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEvcl0zdnJun12Glc9xzWoxqtgedUFAmMt8QBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE
Qzk3NENERDlDOUJBN0Q3NjFBNTczREM3MzVBOEM2QUI2MDc5RDUACgkQxzWoxqtg
edU8Pg//WCRSzl4M2fZ9Gt8KfmR/+NOOrhBMXRSeqfbtLwINPjDpM4cq2nDmW8Di
AmI3dq0yOw03hpsuR6VCmHDzxuhaMjVxILuiQrzKRUAbwB4O/30NcFxbx0jclFgd
cNVrtgl0LavX72hVI5RpGAFUMqXprto2SycaSzd7ZqZVWMB9oWKnPFN/JomyWL4I
dtEDkhGRR5XtszLkh9UD6z8VEz9dYDrnvBFIIqTQ7Q1gnS5kt5cQpazdLERi0o2i
iKHcAkhdi6OeeWB9ROmMnPskS9O3JG9hAOxTfvRkEoPM8IEkDmEabox7MB2BxAHT
xorWJvsMIxtvhb/UsjD69rdSZ/62VOAvuDYlY4/U/ECbssepOM9IHi9UyRXAq0E2
6ohvFU+//CFI1q6RuGgQ9tofxN3ET/W2CrONoxwzwGwiNx3YymJTLY5sd2a6ObqD
UsrWUe7jO+pVc8tCA2fwSIM8PX/DF6YEPPslKZWwdlebgz+zPJ0gxQmT/PfM2agt
g/Qb/ha13N2nWsu7SbYd9uxi2VtjN0oxMbsdYaE11jp4oAGsrFWCwxK/VEn6NXWR
BPz3UfUG/y5GOuYa00XaYFIgBMuykySm/X3SFvCJuF3MBG8P9OmYutQ8BXYWR1HL
acCNOcEAdcoQCk/GxyTovIh8ClOZCuM7tyqdTcYoS2yoixyPwCQ=
=WNA4
-----END PGP SIGNATURE-----


W
W
Wiktor ?elazny wrote on 23 Sep 2022 20:04
(name . Ludovic Courtès)(address . ludo@gnu.org)
20220923180417.amezzkmy6mkto26f@nibiowz
On Thu, Sep 08, 2022 at 02:49:15PM +0200, Ludovic Courtès wrote:
Toggle quote (6 lines)
> Wiktor ?elazny <wz@freeshell.de> skribis:
>
> > * gnu/packages/textutils.scm (docxbox): New variable.
>
> Could you send updated patches?

I will see what I can do about this one.

W?
-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEvcl0zdnJun12Glc9xzWoxqtgedUFAmMt9SFfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE
Qzk3NENERDlDOUJBN0Q3NjFBNTczREM3MzVBOEM2QUI2MDc5RDUACgkQxzWoxqtg
edUBLQ//fr3Z/wZfku5lOJ4coqdQ64cO5tTTeOu2AvlDD+gDV2Vqaunna5fyZ0LY
KM1kDTYJY+jzbf3YungyHCm9opXxlEk+MOfSOWy2YItjq97DKvRZHGEhneWf7/po
YM6WRqBXLA7ZHHVKFARgTuMJxHvEjpr4382HLDllT3OUyNTm0cuwIFE4zMP6uSLx
tqaFuwGZn7bXI+ftiVMSteoi7+0s/euK32nh9kna/D9Niq5D37JOUzlROcqCnTtM
9cYjO0/fVElZ1hPD33NcdQuHYE6y1vm8O+uZbxDLwDs6NTN8Xoy9TBOAqrChEQmJ
ZoGcxJc2pOQ9I7QXc9CDQfnZuMbtjplTRrv+2JTq8GgGItOwJ1ypjuFiCYMKoO5P
sfxKTYl2kK+IlGwNKkyKKrUyETItDHII6+7zWOC9x7kanqkSJJSuFsmAPyj1NpZi
6rERZzDGsLTpr4tBld/82ruhDARLCjt5fNkJVj1vbuKqWuCUwgWN+JueWqb/KpD9
nHltY6HZG1NRt3SXBO1e7gv1W64PQL+kcXOIuRecMR9apJp8rnej2WVcC6RXQJyG
dJvBrQBiSYHvvquQkEJVxqb6FR6igBn9cujYElGhBeogTM4WlALs5RJNDFUuKSpW
phmeINCjHgfM2eKaSwHUMsYc82em4kZpE5a8WEyEvHhwC+GfrME=
=EdDN
-----END PGP SIGNATURE-----


W
W
Wiktor ?elazny wrote on 23 Sep 2022 20:21
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 57337@debbugs.gnu.org)
20220923182121.t5gu7phfbbay4xj6@nibiowz
On Thu, Sep 08, 2022 at 02:44:06PM +0200, Ludovic Courtès wrote:
Toggle quote (10 lines)
>
> Wiktor ?elazny <wz@freeshell.de> skribis:
>
> > The problem is that etc/ld.so.cache gets created. I
> > have no idea where it comes from,
>
> That’s OK: every package gets this file; see
> <https://guix.gnu.org/en/blog/2021/taming-the-stat-storm-with-a-loader-cache/>
> for background.

Very informative, thank you.

Toggle quote (8 lines)
> > Adding the
> >
> > (file-name (git-file-name name version))
> >
> > line removes the warning, but breaks the build.
>
> Could you investigate a bit?

This may be tough. But maybe the problem will go away by itself once the
package definition is rewritten.

Toggle quote (2 lines)
> use ‘git-fetch’ instead of referring to the generated tarball.

OK!

Have a nice weekend,

W?
-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEvcl0zdnJun12Glc9xzWoxqtgedUFAmMt+PxfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE
Qzk3NENERDlDOUJBN0Q3NjFBNTczREM3MzVBOEM2QUI2MDc5RDUACgkQxzWoxqtg
edWLwg/+I7h2VcHApJjUhlMWksuEzFYrSJaQEJ1h/Bieq2tiNHk3lUXBAYOtqoLs
9QY48kLeZfw0bZGbllfrs3MrHQKa/VMZAoCMGOeiKVZR9k+CkytDXLPF0az5mzQD
DeUJcc3dGNtuqwiS/siRY55O5x+diCpVFW5EJ3JSYjiDCUBzRbamkmyoEGMmLrQJ
GttvZalfHHbZwdPPBx2HaZTCiHtxZwCq5s7xwN4BjC33BaLyX4p1ouy0VxpXU+LV
p+Jo/FeUgPwj+phNbal45Es3v++jHK4gAZuMsEi9zDp7ChiPPYNzLUFy0YZNfOIg
yR+4klUshlgWWrRDNGO0GlI68UCg/MfslJ2HFHmVYnwr7+hQ3K7qO1068/G7Yz42
6Toy3tSpSYtbHXjZ/CvMJfYR+3N3JWLsbHkfQhbc3vm7H1L7Phwy/yUTDenYZYgX
nOQ1ve2oqXLn/dEAND+V41oUPDlsZ/eu8j8hjfhrgJHSu6aPKb78oXYHjEc19qJb
JAvzOA6ok1UpxJbUBdJdaJRKcMs7bpmeRkkYQYuw0QaTw9wCSpFrU7Su577VKKFy
9Qvr6a1enD6XBjro1isILr+3BW2zrcBohZOznlSclq5Oz9OuCtbX8zSyfrhNfIrI
RuFEF3S2t7I/KxF58cnw3CZmZsCD4Lm1s6/0R15vHkXCmLOPs4o=
=U43S
-----END PGP SIGNATURE-----


W
W
Wiktor ?elazny wrote on 26 Dec 2022 15:57
[v2 0/2] Add docxbox
(address . 57337@debbugs.gnu.org)(address . ludo@gnu.org)
20221226145732.1237-1-wz@freeshell.de
From: wzel <wzel@users.noreply.github.com>

Hi there,

Some pending issues:

1. For miniz-cpp, I tried and failed

(arguments
'(#:install-plan
#~'(("zip_file.hpp" "include/")
("README.md" #$(string-append "share/doc/" name "-" version "/"))
("examples" #$(string-append "share/doc/" name "-" version "/")))))

, as this results in unknown gexp variable error.

2. For docxbox, I had to keep (package-source tinyxml2). This is
because, as I understand it, docxbox does not link to the compiled
library, and given my zero cmake experience I have no idea how to modify
the build process so that it does. Instead, it does what is described in

TinyXML-2 is designed to be easy and fast to learn. It is one header
and one cpp file. Simply add these to your project and off you go.

3. For docxbox, (file-name (git-file-name name version)) is not crashing
the build, anymore, but strangely during build --rounds=2 --check I
noticed four rounds taking place instead of two.

Thanks for taking a look,

W?

Wiktor ?elazny (2):
gnu: Add miniz-cpp.
gnu: Add docxbox.

gnu/local.mk | 1 +
gnu/packages/cpp.scm | 35 +
.../miniz-cpp-fixed-duplicated-symbols.patch | 2734 +++++++++++++++++
gnu/packages/textutils.scm | 76 +-
4 files changed, 2845 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch


base-commit: c50cd1bbece27097456242f246f89c053e7cc1a2
--
2.38.1
W
W
Wiktor ?elazny wrote on 26 Dec 2022 15:57
[v2 1/2] gnu: Add miniz-cpp.
(address . 57337@debbugs.gnu.org)(address . ludo@gnu.org)
20221226145732.1237-2-wz@freeshell.de
* gnu/packages/cpp.scm (miniz-cpp): New variable.
---
gnu/local.mk | 1 +
gnu/packages/cpp.scm | 35 +
.../miniz-cpp-fixed-duplicated-symbols.patch | 2734 +++++++++++++++++
3 files changed, 2770 insertions(+)
create mode 100644 gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch

Toggle diff (394 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index 034131b5f8..6ace9bb404 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1548,6 +1548,7 @@ dist_patch_DATA = \
%D%/packages/patches/mingw-w64-reproducible-gendef.patch \
%D%/packages/patches/minisat-friend-declaration.patch \
%D%/packages/patches/minisat-install.patch \
+ %D%/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch \
%D%/packages/patches/mit-krb5-hurd.patch \
%D%/packages/patches/mixxx-link-qtscriptbytearray-qtscript.patch \
%D%/packages/patches/mixxx-system-googletest-benchmark.patch \
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index a3df706f43..2cb82a25a6 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2231,3 +2231,38 @@ (define-public safeint
addition and subtraction for all combinations of signed and unsigned 32-bit and
64-bit integers.")
(license license:expat)))
+
+(define-public miniz-cpp
+ (let ((commit "052335e4f7773368df07b26d2baedb0e6d4dbd38")
+ (revision "1"))
+ (package
+ (name "miniz-cpp")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/tfussell/miniz-cpp")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1y8wzplyq2910fms2l9z1k6xrxb2x4w3gryykqkj11rwpkadw7b9"))
+ (patches (search-patches
+ ;; To be removed once https://github.com/tfussell/miniz-cpp/pull/11
+ ;; gets merged.
+ "miniz-cpp-fixed-duplicated-symbols.patch"))))
+ (build-system copy-build-system)
+ (arguments
+ '(#:install-plan '(("zip_file.hpp" "include/")
+ ("LICENSE.md" "share/doc/miniz-cpp/")
+ ("README.md" "share/doc/miniz-cpp/")
+ ("examples" "share/doc/miniz-cpp/"))))
+ (home-page "https://github.com/tfussell/miniz-cpp/")
+ (synopsis
+ "Cross-platform header-only C++14 library for reading and writing
+ZIP files")
+ (description
+ "@code{miniz-cpp} is a cross-platform header-only library for
+reading and writing ZIP files using a nice simple API similar to Python's
+@command{zipfile}.")
+ (license license:expat))))
diff --git a/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
new file mode 100644
index 0000000000..035f989767
--- /dev/null
+++ b/gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch
@@ -0,0 +1,2734 @@
+commit 64f974213ac16f78c008bd148c8a2a07e902f148
+Author: Kay Stenschke <info@stenschke.com>
+Date: Mon Apr 27 12:13:34 2020 +0200
+
+ Fixed duplicated symbols
+
+ Using miniz-cpp from multiple translation units caused linker error.
+ Done: marked declarations as static for correct linking from multiple translation units.
+
+diff --git a/zip_file.hpp b/zip_file.hpp
+index c324f70..3aff33c 100644
+--- a/zip_file.hpp
++++ b/zip_file.hpp
+@@ -226,12 +226,12 @@
+ //#define MINIZ_NO_MALLOC
+
+ #if defined(__TINYC__) && (defined(__linux) || defined(__linux__))
+- // TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
++// TODO: Work around "error: include file 'sys\utime.h' when compiling with tcc on Linux
+ #define MINIZ_NO_TIME
+ #endif
+
+ #if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
+- #include <time.h>
++#include <time.h>
+ #endif
+
+ #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__)
+@@ -272,15 +272,15 @@ extern "C" {
+ typedef unsigned long mz_ulong;
+
+ // mz_free() internally uses the MZ_FREE() macro (which by default calls free() unless you've modified the MZ_MALLOC macro) to release a block allocated from the heap.
+-void mz_free(void *p);
++static void mz_free(void *p);
+
+ #define MZ_ADLER32_INIT (1)
+ // mz_adler32() returns the initial adler-32 value to use when called with ptr==NULL.
+-mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
++static mz_ulong mz_adler32(mz_ulong adler, const unsigned char *ptr, size_t buf_len);
+
+ #define MZ_CRC32_INIT (0)
+ // mz_crc32() returns the initial CRC-32 value to use when called with ptr==NULL.
+-mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
++static mz_ulong mz_crc32(mz_ulong crc, const unsigned char *ptr, size_t buf_len);
+
+ // Compression strategies.
+ enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3, MZ_FIXED = 4 };
+@@ -343,7 +343,7 @@ typedef struct mz_stream_s
+ typedef mz_stream *mz_streamp;
+
+ // Returns the version string of miniz.c.
+-const char *mz_version(void);
++static const char *mz_version(void);
+
+ // mz_deflateInit() initializes a compressor with default options:
+ // Parameters:
+@@ -356,17 +356,17 @@ const char *mz_version(void);
+ // MZ_STREAM_ERROR if the stream is bogus.
+ // MZ_PARAM_ERROR if the input parameters are bogus.
+ // MZ_MEM_ERROR on out of memory.
+-int mz_deflateInit(mz_streamp pStream, int level);
++static int mz_deflateInit(mz_streamp pStream, int level);
+
+ // mz_deflateInit2() is like mz_deflate(), except with more control:
+ // Additional parameters:
+ // method must be MZ_DEFLATED
+ // window_bits must be MZ_DEFAULT_WINDOW_BITS (to wrap the deflate stream with zlib header/adler-32 footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate/no header or footer)
+ // mem_level must be between [1, 9] (it's checked but ignored by miniz.c)
+-int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
++static int mz_deflateInit2(mz_streamp pStream, int level, int method, int window_bits, int mem_level, int strategy);
+
+ // Quickly resets a compressor without having to reallocate anything. Same as calling mz_deflateEnd() followed by mz_deflateInit()/mz_deflateInit2().
+-int mz_deflateReset(mz_streamp pStream);
++static int mz_deflateReset(mz_streamp pStream);
+
+ // mz_deflate() compresses the input to output, consuming as much of the input and producing as much output as possible.
+ // Parameters:
+@@ -378,31 +378,31 @@ int mz_deflateReset(mz_streamp pStream);
+ // MZ_STREAM_ERROR if the stream is bogus.
+ // MZ_PARAM_ERROR if one of the parameters is invalid.
+ // MZ_BUF_ERROR if no forward progress is possible because the input and/or output buffers are empty. (Fill up the input buffer or free up some output space and try again.)
+-int mz_deflate(mz_streamp pStream, int flush);
++static int mz_deflate(mz_streamp pStream, int flush);
+
+ // mz_deflateEnd() deinitializes a compressor:
+ // Return values:
+ // MZ_OK on success.
+ // MZ_STREAM_ERROR if the stream is bogus.
+-int mz_deflateEnd(mz_streamp pStream);
++static int mz_deflateEnd(mz_streamp pStream);
+
+ // mz_deflateBound() returns a (very) conservative upper bound on the amount of data that could be generated by deflate(), assuming flush is set to only MZ_NO_FLUSH or MZ_FINISH.
+-mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
++static mz_ulong mz_deflateBound(mz_streamp pStream, mz_ulong source_len);
+
+ // Single-call compression functions mz_compress() and mz_compress2():
+ // Returns MZ_OK on success, or one of the error codes from mz_deflate() on failure.
+-int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
+-int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
++static int mz_compress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
++static int mz_compress2(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len, int level);
+
+ // mz_compressBound() returns a (very) conservative upper bound on the amount of data that could be generated by calling mz_compress().
+-mz_ulong mz_compressBound(mz_ulong source_len);
++static mz_ulong mz_compressBound(mz_ulong source_len);
+
+ // Initializes a decompressor.
+-int mz_inflateInit(mz_streamp pStream);
++static int mz_inflateInit(mz_streamp pStream);
+
+ // mz_inflateInit2() is like mz_inflateInit() with an additional option that controls the window size and whether or not the stream has been wrapped with a zlib header/footer:
+ // window_bits must be MZ_DEFAULT_WINDOW_BITS (to parse zlib header/footer) or -MZ_DEFAULT_WINDOW_BITS (raw deflate).
+-int mz_inflateInit2(mz_streamp pStream, int window_bits);
++static int mz_inflateInit2(mz_streamp pStream, int window_bits);
+
+ // Decompresses the input stream to the output, consuming only as much of the input as needed, and writing as much to the output as possible.
+ // Parameters:
+@@ -418,91 +418,91 @@ int mz_inflateInit2(mz_streamp pStream, int window_bits);
+ // MZ_PARAM_ERROR if one of the parameters is invalid.
+ // MZ_BUF_ERROR if no forward progress is possible because the input buffer is empty but the inflater needs more input to continue, or if the output buffer is not large enough. Call mz_inflate() again
+ // with more input data, or with more room in the output buffer (except when using single call decompression, described above).
+-int mz_inflate(mz_streamp pStream, int flush);
++static int mz_inflate(mz_streamp pStream, int flush);
+
+ // Deinitializes a decompressor.
+-int mz_inflateEnd(mz_streamp pStream);
++static int mz_inflateEnd(mz_streamp pStream);
+
+ // Single-call decompression.
+ // Returns MZ_OK on success, or one of the error codes from mz_inflate() on failure.
+-int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
++static int mz_uncompress(unsigned char *pDest, mz_ulong *pDest_len, const unsigned char *pSource, mz_ulong source_len);
+
+ // Returns a string description of the specified error code, or NULL if the error code is invalid.
+-const char *mz_error(int err);
++static const char *mz_error(int err);
+
+ // Redefine zlib-compatible names to miniz equivalents, so miniz.c can be used as a drop-in replacement for the subset of zlib that miniz.c supports.
+ // Define MINIZ_NO_ZLIB_COMPATIBLE_NAMES to disable zlib-compatibility if you use zlib in the same project.
+ #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
+- typedef unsigned char Byte;
+- typedef unsigned int uInt;
+- typedef mz_ulong uLong;
+- typedef Byte Bytef;
+- typedef uInt uIntf;
+- typedef char charf;
+- typedef int intf;
+- typedef void *voidpf;
+- typedef uLong uLongf;
+- typedef void *voidp;
+- typedef void *const voidpc;
+- #define Z_NULL 0
+- #define Z_NO_FLUSH MZ_NO_FLUSH
+- #define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
+- #define Z_SYNC_FLUSH MZ_SYNC_FLUSH
+- #define Z_FULL_FLUSH MZ_FULL_FLUSH
+- #define Z_FINISH MZ_FINISH
+- #define Z_BLOCK MZ_BLOCK
+- #define Z_OK MZ_OK
+- #define Z_STREAM_END MZ_STREAM_END
+- #define Z_NEED_DICT MZ_NEED_DICT
+- #define Z_ERRNO MZ_ERRNO
+- #define Z_STREAM_ERROR MZ_STREAM_ERROR
+- #define Z_DATA_ERROR MZ_DATA_ERROR
+- #define Z_MEM_ERROR MZ_MEM_ERROR
+- #define Z_BUF_ERROR MZ_BUF_ERROR
+- #define Z_VERSION_ERROR MZ_VERSION_ERROR
+- #define Z_PARAM_ERROR MZ_PARAM_ERROR
+- #define Z_NO_COMPRESSION MZ_NO_COMPRESSION
+- #define Z_BEST_SPEED MZ_BEST_SPEED
+- #define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
+- #define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
+- #define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
+- #define Z_FILTERED MZ_FILTERED
+- #define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
+- #define Z_RLE MZ_RLE
+- #define Z_FIXED MZ_FIXED
+- #define Z_DEFLATED MZ_DEFLATED
+- #define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
+- #define alloc_func mz_alloc_func
+- #define free_func mz_free_func
+- #define internal_state mz_internal_state
+- #define z_stream mz_stream
+- #define deflateInit mz_deflateInit
+- #define deflateInit2 mz_deflateInit2
+- #define deflateReset mz_deflateReset
+- #define deflate mz_deflate
+- #define deflateEnd mz_deflateEnd
+- #define deflateBound mz_deflateBound
+- #define compress mz_compress
+- #define compress2 mz_compress2
+- #define compressBound mz_compressBound
+- #define inflateInit mz_inflateInit
+- #define inflateInit2 mz_inflateInit2
+- #define inflate mz_inflate
+- #define inflateEnd mz_inflateEnd
+- #define uncompress mz_uncompress
+- #define crc32 mz_crc32
+- #define adler32 mz_adler32
+- #define MAX_WBITS 15
+- #define MAX_MEM_LEVEL 9
+- #define zError mz_error
+- #define ZLIB_VERSION MZ_VERSION
+- #define ZLIB_VERNUM MZ_VERNUM
+- #define ZLIB_VER_MAJOR MZ_VER_MAJOR
+- #define ZLIB_VER_MINOR MZ_VER_MINOR
+- #define ZLIB_VER_REVISION MZ_VER_REVISION
+- #define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
+- #define zlibVersion mz_version
+- #define zlib_version mz_version()
++typedef unsigned char Byte;
++typedef unsigned int uInt;
++typedef mz_ulong uLong;
++typedef Byte Bytef;
++typedef uInt uIntf;
++typedef char charf;
++typedef int intf;
++typedef void *voidpf;
++typedef uLong uLongf;
++typedef void *voidp;
++typedef void *const voidpc;
++#define Z_NULL 0
++#define Z_NO_FLUSH MZ_NO_FLUSH
++#define Z_PARTIAL_FLUSH MZ_PARTIAL_FLUSH
++#define Z_SYNC_FLUSH MZ_SYNC_FLUSH
++#define Z_FULL_FLUSH MZ_FULL_FLUSH
++#define Z_FINISH MZ_FINISH
++#define Z_BLOCK MZ_BLOCK
++#define Z_OK MZ_OK
++#define Z_STREAM_END MZ_STREAM_END
++#define Z_NEED_DICT MZ_NEED_DICT
++#define Z_ERRNO MZ_ERRNO
++#define Z_STREAM_ERROR MZ_STREAM_ERROR
++#define Z_DATA_ERROR MZ_DATA_ERROR
++#define Z_MEM_ERROR MZ_MEM_ERROR
++#define Z_BUF_ERROR MZ_BUF_ERROR
++#define Z_VERSION_ERROR MZ_VERSION_ERROR
++#define Z_PARAM_ERROR MZ_PARAM_ERROR
++#define Z_NO_COMPRESSION MZ_NO_COMPRESSION
++#define Z_BEST_SPEED MZ_BEST_SPEED
++#define Z_BEST_COMPRESSION MZ_BEST_COMPRESSION
++#define Z_DEFAULT_COMPRESSION MZ_DEFAULT_COMPRESSION
++#define Z_DEFAULT_STRATEGY MZ_DEFAULT_STRATEGY
++#define Z_FILTERED MZ_FILTERED
++#define Z_HUFFMAN_ONLY MZ_HUFFMAN_ONLY
++#define Z_RLE MZ_RLE
++#define Z_FIXED MZ_FIXED
++#define Z_DEFLATED MZ_DEFLATED
++#define Z_DEFAULT_WINDOW_BITS MZ_DEFAULT_WINDOW_BITS
++#define alloc_func mz_alloc_func
++#define free_func mz_free_func
++#define internal_state mz_internal_state
++#define z_stream mz_stream
++#define deflateInit mz_deflateInit
++#define deflateInit2 mz_deflateInit2
++#define deflateReset mz_deflateReset
++#define deflate mz_deflate
++#define deflateEnd mz_deflateEnd
++#define deflateBound mz_deflateBound
++#define compress mz_compress
++#define compress2 mz_compress2
++#define compressBound mz_compressBound
++#define inflateInit mz_inflateInit
++#define inflateInit2 mz_inflateInit2
++#define inflate mz_inflate
++#define inflateEnd mz_inflateEnd
++#define uncompress mz_uncompress
++#define crc32 mz_crc32
++#define adler32 mz_adler32
++#define MAX_WBITS 15
++#define MAX_MEM_LEVEL 9
++#define zError mz_error
++#define ZLIB_VERSION MZ_VERSION
++#define ZLIB_VERNUM MZ_VERNUM
++#define ZLIB_VER_MAJOR MZ_VER_MAJOR
++#define ZLIB_VER_MINOR MZ_VER_MINOR
++#define ZLIB_VER_REVISION MZ_VER_REVISION
++#define ZLIB_VER_SUBREVISION MZ_VER_SUBREVISION
++#define zlibVersion mz_version
++#define zlib_version mz_version()
+ #endif // #ifndef MINIZ_NO_ZLIB_COMPATIBLE_NAMES
+
+ #endif // MINIZ_NO_ZLIB_APIS
+@@ -523,9 +523,9 @@ typedef int mz_bool;
+
+ // An attempt to work around MSVC's spammy "warning C4127: conditional expression is constant" message.
+ #ifdef _MSC_VER
+- #define MZ_MACRO_END while (0, 0)
++#define MZ_MACRO_END while (0, 0)
+ #else
+- #define MZ_MACRO_END while (0)
++#define MZ_MACRO_END while (0)
+ #endif
+
+ // ------------------- ZIP archive reading/writing
+@@ -609,68 +609,68 @@ typedef enum
+
+ // Inits a ZIP archive reader.
+ // These functions read and validate the archive's central directory.
+-mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags);
+-mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags);
++static mz_bool mz_zip_reader_init(mz_zip_archive *pZip, mz_uint64 size, mz_uint32 flags);
++static mz_bool mz_zip_reader_init_mem(mz_zip_archive *pZip, const void *pMem, size_t size, mz_uint32 flags);
+
+ #ifndef MINIZ_NO_STDIO
+-mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags);
++static mz_bool mz_zip_reader_init_file(mz_zip_archive *pZip, const char *pFilename, mz_uint32 flags);
+ #endif
+
+ // Returns the total number of files in the archive.
+-mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip);
++static mz_uint mz_zip_reader_get_num_files(mz_zip_archive *pZip);
+
+ // Returns detailed information about an archive file entry.
+-mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat);
++static mz_bool mz_zip_reader_file_stat(mz_zip_archive *pZip, mz_uint file_index, mz_zip_archive_file_stat *pStat);
+
+ // Determines if an archive file entry is a directory entry.
+-mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index);
+-mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index);
++static mz_bool mz_zip_reader_is_file_a_directory(mz_zip_archive *pZip, mz_uint file_index);
++static mz_bool mz_zip_reader_is_file_encrypted(mz_zip_archive *pZip, mz_uint file_index);
+
+ // Retrieves the filename of an archive file entry.
+ // Returns the number of bytes written to pFilename, or if filename_buf_size is 0 this function returns the number of bytes needed to fully store the filename.
+-mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
++static mz_uint mz_zip_reader_get_filename(mz_zip_archive *pZip, mz_uint file_index, char *pFilename, mz_uint filename_buf_size);
+
+ // Attempts to locates a file in the archive's central directory.
+ // Valid flags: MZ_ZIP_FLAG_CASE_SENSITIVE, MZ_ZIP_FLAG_IGNORE_PATH
+ // Returns -1 if the file cannot be found.
+-int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pName, const char *pComment, mz_uint flags);
++static int mz_zip_reader_locate_file(mz_zip_archive *pZip, const char *pNam
This message was truncated. Download the full message here.
W
W
Wiktor ?elazny wrote on 26 Dec 2022 15:57
[v2 2/2] gnu: Add docxbox.
(address . 57337@debbugs.gnu.org)(address . ludo@gnu.org)
20221226145732.1237-3-wz@freeshell.de
* gnu/packages/textutils.scm (docxbox): New variable.
---
gnu/packages/textutils.scm | 76 +++++++++++++++++++++++++++++++++++++-
1 file changed, 75 insertions(+), 1 deletion(-)

Toggle diff (100 lines)
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 151add964e..6c3cb2695b 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -58,6 +58,7 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages gcc)
#:use-module (gnu packages golang)
#:use-module (gnu packages gettext)
@@ -74,7 +75,8 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages ruby)
#:use-module (gnu packages slang)
#:use-module (gnu packages syncthing)
- #:use-module (gnu packages web))
+ #:use-module (gnu packages web)
+ #:use-module (gnu packages xml))
(define-public dos2unix
(package
@@ -1522,3 +1524,75 @@ (define-public ack
easily specify file types, match highlighting, Perl-Compatible Regular
Expressions, and being faster to type than grep.")
(license license:artistic2.0)))
+
+(define-public docxbox
+ (let ((commit "7c09cfdfd055fedf72676250eae8f03bb8ef7ed5")
+ (revision "1"))
+ (package
+ (name "docxbox")
+ (version (git-version "0.0.5" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/gyselroth/docxbox")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0irccm5siy7k6kjnrmm9pxc4cmc3l30377kqpp6vd6y21nk7yc4w"))
+ (modules '((guix build utils)))
+ (snippet '(begin
+ (for-each delete-file-recursively
+ '("bin" "vendor/json" "vendor/miniz-cpp"
+ "vendor/tinyxml2"))))))
+ (build-system cmake-build-system)
+ ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module
+ (inputs `(("json-modern-cxx" ,json-modern-cxx)
+ ("miniz-cpp" ,miniz-cpp)
+ ("tinyxml2-source" ,(package-source tinyxml2))))
+ (arguments
+ `(#:phases (modify-phases %standard-phases
+ (add-after 'unpack 'unvendor
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ (("vendor/miniz-cpp/zip_file.hpp")
+ ""))
+ (with-directory-excursion "docxbox"
+ (substitute* (find-files "." "\\.(cc|h)$")
+ (("#include <vendor/json/single_include/")
+ "#include <"))
+ (substitute* (find-files "." "\\.hpp$")
+ (("#include <vendor/miniz-cpp/")
+ "#include <")))))
+ (add-after 'unpack 'unpack-tinyxml2
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "vendor/tinyxml2")
+ (copy-recursively (assoc-ref inputs "tinyxml2-source")
+ "vendor/tinyxml2")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin")))
+ (install-file "bin/linux/docxbox" bin)))))
+ #:configure-flags (let* ((out (assoc-ref %outputs "out")))
+ '("-DCMAKE_CXX_FLAGS=-fpermissive -Wno-error"))
+ ;; Tests depend on a bundled binary in bin/linux/, and even with the
+ ;; binary in place, I could not get them to run. To my understanding,
+ ;; the setup() function in test/functional/_helper.bash is supposed to
+ ;; copy the binary to the test suite directory. However, this does not
+ ;; seem to happen when invoking ./test.sh (make check is not
+ ;; supported), and the script complains about the missing binary in the
+ ;; directory. The fix could be to copy the binary built by the Guix
+ ;; daemon to the test suite directory before invoking ./test.sh, but
+ ;; this is beyond my skills.
+ #:tests? #f))
+ (home-page "https://github.com/gyselroth/docxbox/")
+ (synopsis "Command-line tool for MS Word @file{.docx} templating and
+analysis")
+ (description
+ "@command{docxbox} enables direct and convenient inspection and
+manipulation of XML and media files making up a @file{.docx} file. The
+capabilities include batch editing, unpacking and indentation for manual
+editing in a text editor and subsequent unindentation and repacking,
+operations on metadata, and diffing")
+ (license license:expat))))
--
2.38.1
L
L
Ludovic Courtès wrote on 25 Jan 2023 23:17
Re: [v2 1/2] gnu: Add miniz-cpp.
(name . Wiktor ?elazny)(address . wz@freeshell.de)(address . 57337@debbugs.gnu.org)
87mt66s1ht.fsf@gnu.org
Hi Wiktor,

Apologies for the delay.

Wiktor ?elazny <wz@freeshell.de> skribis:

Toggle quote (8 lines)
> * gnu/packages/cpp.scm (miniz-cpp): New variable.
> ---
> gnu/local.mk | 1 +
> gnu/packages/cpp.scm | 35 +
> .../miniz-cpp-fixed-duplicated-symbols.patch | 2734 +++++++++++++++++
> 3 files changed, 2770 insertions(+)
> create mode 100644 gnu/packages/patches/miniz-cpp-fixed-duplicated-symbols.patch

That’s a pretty big patch, and we don’t usually take that big a patch
downstream, but…

Toggle quote (5 lines)
> + (patches (search-patches
> + ;; To be removed once https://github.com/tfussell/miniz-cpp/pull/11
> + ;; gets merged.
> + "miniz-cpp-fixed-duplicated-symbols.patch"))))

Looking at the GitHub issue, it seems the solution could be merge soon.

How about (1) pinging upstream asking whether they could merge it, and
(2) referring to the commit of this pull request in the package
definition in the meantime, with a comment explaining why?

Thanks in advance,
Ludo’.
L
L
Ludovic Courtès wrote on 25 Jan 2023 23:21
Re: [v2 2/2] gnu: Add docxbox.
(name . Wiktor ?elazny)(address . wz@freeshell.de)(address . 57337@debbugs.gnu.org)
87fsbys1bi.fsf@gnu.org
Wiktor ?elazny <wz@freeshell.de> skribis:

Toggle quote (2 lines)
> * gnu/packages/textutils.scm (docxbox): New variable.

[...]

Toggle quote (5 lines)
> + (snippet '(begin
> + (for-each delete-file-recursively
> + '("bin" "vendor/json" "vendor/miniz-cpp"
> + "vendor/tinyxml2"))))))

No need for ‘begin’.

Toggle quote (6 lines)
> + (build-system cmake-build-system)
> + ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module
> + (inputs `(("json-modern-cxx" ,json-modern-cxx)
> + ("miniz-cpp" ,miniz-cpp)
> + ("tinyxml2-source" ,(package-source tinyxml2))))

You can write:

(inputs (list json-modern-cxx miniz-cpp))

and…

Toggle quote (20 lines)
> + (arguments
> + `(#:phases (modify-phases %standard-phases
> + (add-after 'unpack 'unvendor
> + (lambda* (#:key inputs #:allow-other-keys)
> + (substitute* "CMakeLists.txt"
> + (("vendor/miniz-cpp/zip_file.hpp")
> + ""))
> + (with-directory-excursion "docxbox"
> + (substitute* (find-files "." "\\.(cc|h)$")
> + (("#include <vendor/json/single_include/")
> + "#include <"))
> + (substitute* (find-files "." "\\.hpp$")
> + (("#include <vendor/miniz-cpp/")
> + "#include <")))))
> + (add-after 'unpack 'unpack-tinyxml2
> + (lambda* (#:key inputs #:allow-other-keys)
> + (mkdir-p "vendor/tinyxml2")
> + (copy-recursively (assoc-ref inputs "tinyxml2-source")
> + "vendor/tinyxml2")))

… this:

(arguments
(list #:phases
#~(modify-phases …
(copy-recursively #$(package-source tinyxml2) …)
…)))

It would be best if it could depend on TinyXML2 directly, rather than
rebuilding it as part of the build process, but I supposed that’s
trickier so we can leave that for later.

Could you send an updated patch, together with the miniz-cpp one?

Thanks in advance!

Ludo’.
W
W
Wiktor ?elazny wrote on 28 Jan 2023 20:50
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 57337@debbugs.gnu.org)
20230128195020.qzdwznzhpnk33buz@guixwz2
On Wed, Jan 25, 2023 at 11:21:05PM +0100, Ludovic Courtès wrote:

Toggle quote (2 lines)
> Could you send an updated patch, together with the miniz-cpp one?

Hi Ludo,

Thanks for reviewing the updated patches. I will work on the
improvements that you’re proposing.

Best regards,

W?
-----BEGIN PGP SIGNATURE-----

iQKTBAABCgB9FiEEvcl0zdnJun12Glc9xzWoxqtgedUFAmPVfG1fFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEJE
Qzk3NENERDlDOUJBN0Q3NjFBNTczREM3MzVBOEM2QUI2MDc5RDUACgkQxzWoxqtg
edXdJhAAgQukF059CBYh8TVkECQa8hnVGGXnJN1GeZlAqRDmPIrgMWSyXvWA2pKa
L3IZvo8P/9kbXwqjJawvsViBKJdmOORJanAMn5y7F2tcILGhpkBbDK8/XV39ZS2W
Q1/BmzQfK1BXpgjbMnzIb79JdPg8dCjfFQiaTM5k4jhg6JJCWlwSIkM5tZIK/EdC
YPSlD6U7OP1edJL/zIBwGOn7Ct6zUIbHsdB5f0Si5d5t9u1gXJZ5sGpnFNeua5Ex
ovCbFGZbP0eT4aBZBHBaO8o8eVpeckCkJopgn27VryPaPrnSHOyHIxxcL87+gTRm
PV63f61iWFP3DlWB42dBuY6AQndBD/RQS3elqN7kQJGUEohuFNfC/dWYZvVBBh6G
aTp91/w5/w9HbCi1Ys0FBfCskXu8Yv+6lxHg5ZqYs51+oXYQzs+yhH8kAQd0pmuX
2XBU2fSZcpNv6lyiZOzn+oFxlHuDbGItZY3XTeZq0Gmqi+J8JZjd+b7B6jxUjYMF
AqyJvLU4I5xlQSq0Pyk+KXKqT1MN/jkk+l+UXG9wnpFpHmIxSEwwcCgFreepCc5C
PEifh7nZyhrt6+hl7gXtrrpKyztnE59vqVvR03WwLaT6bZ3+h4gPNNo5SxqKcd52
RZ9Q5tD80zOnWcNN2pentFh5j9L74Ot0OtxCuja/cojXCSyUKVk=
=Qrpw
-----END PGP SIGNATURE-----


W
W
Wiktor ?elazny wrote on 5 Feb 2023 21:18
[PATCH v3 1/2] gnu: Add miniz-cpp.
(address . 57337@debbugs.gnu.org)(address . ludo@gnu.org)
20230205201833.24156-1-wz@freeshell.de
* gnu/packages/cpp.scm (miniz-cpp): New variable.
---
gnu/packages/cpp.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Toggle diff (47 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 6fa4c0f7a0..61a9aa37c2 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2427,3 +2427,38 @@ (define-public ftxui
@item No dependencies.
@end itemize")
(license license:expat)))
+
+(define-public miniz-cpp
+ (let ((commit "64f974213ac16f78c008bd148c8a2a07e902f148")
+ (revision "1"))
+ (package
+ (name "miniz-cpp")
+ (version (git-version "0.0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ ;; A fork repository that includes a patch necessary to get docxbox
+ ;; to compile. The patch is too big to be included in Guix. To be
+ ;; replaced with https://github.com/tfussell/miniz-cpp once
+ ;; https://github.com/tfussell/miniz-cpp/pull/11 gets merged.
+ (url "https://github.com/kstenschke/miniz-cpp")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1qm88545kch91dz3cbgl2cbkg6wjas3h399hm5c2pbqi8jycz6vy"))))
+ (build-system copy-build-system)
+ (arguments
+ '(#:install-plan '(("zip_file.hpp" "include/")
+ ("LICENSE.md" "share/doc/miniz-cpp/")
+ ("README.md" "share/doc/miniz-cpp/")
+ ("examples" "share/doc/miniz-cpp/"))))
+ (home-page "https://github.com/tfussell/miniz-cpp/")
+ (synopsis
+ "Cross-platform header-only C++14 library for reading and writing
+ZIP files")
+ (description
+ "@code{miniz-cpp} is a cross-platform header-only library for
+reading and writing ZIP files using a nice simple API similar to Python's
+@command{zipfile}.")
+ (license license:expat))))

base-commit: 4b9e1e84585270a40cec485046ce15387405d256
--
2.39.1
W
W
Wiktor ?elazny wrote on 5 Feb 2023 21:18
[PATCH v3 2/2] gnu: Add docxbox.
(address . 57337@debbugs.gnu.org)(address . ludo@gnu.org)
20230205201833.24156-2-wz@freeshell.de
* gnu/packages/textutils.scm (docxbox): New variable.
---
gnu/packages/textutils.scm | 73 +++++++++++++++++++++++++++++++++++++-
1 file changed, 72 insertions(+), 1 deletion(-)

Toggle diff (97 lines)
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index 151add964e..b75b54e9f4 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -58,6 +58,7 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages gcc)
#:use-module (gnu packages golang)
#:use-module (gnu packages gettext)
@@ -74,7 +75,8 @@ (define-module (gnu packages textutils)
#:use-module (gnu packages ruby)
#:use-module (gnu packages slang)
#:use-module (gnu packages syncthing)
- #:use-module (gnu packages web))
+ #:use-module (gnu packages web)
+ #:use-module (gnu packages xml))
(define-public dos2unix
(package
@@ -1522,3 +1524,72 @@ (define-public ack
easily specify file types, match highlighting, Perl-Compatible Regular
Expressions, and being faster to type than grep.")
(license license:artistic2.0)))
+
+(define-public docxbox
+ (let ((commit "7c09cfdfd055fedf72676250eae8f03bb8ef7ed5")
+ (revision "1"))
+ (package
+ (name "docxbox")
+ (version (git-version "0.0.5" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/gyselroth/docxbox")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0irccm5siy7k6kjnrmm9pxc4cmc3l30377kqpp6vd6y21nk7yc4w"))
+ (modules '((guix build utils)))
+ (snippet '(for-each delete-file-recursively
+ '("bin" "vendor/json" "vendor/miniz-cpp"
+ "vendor/tinyxml2")))))
+ (build-system cmake-build-system)
+ ;; (native-inputs (list bats)) ; Enable after fixing tests, use bash module
+ (inputs (list json-modern-cxx miniz-cpp))
+ (arguments
+ (list #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'unvendor
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "CMakeLists.txt"
+ (("vendor/miniz-cpp/zip_file.hpp")
+ ""))
+ (with-directory-excursion "docxbox"
+ (substitute* (find-files "." "\\.(cc|h)$")
+ (("#include <vendor/json/single_include/")
+ "#include <"))
+ (substitute* (find-files "." "\\.hpp$")
+ (("#include <vendor/miniz-cpp/")
+ "#include <")))))
+ (add-after 'unpack 'unpack-tinyxml2
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "vendor/tinyxml2")
+ (copy-recursively #$(package-source tinyxml2)
+ "vendor/tinyxml2")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin")))
+ (install-file "bin/linux/docxbox" bin)))))
+ #:configure-flags #~(let* ((out (assoc-ref %outputs "out")))
+ '("-DCMAKE_CXX_FLAGS=-fpermissive -Wno-error"))
+ ;; Tests depend on a bundled binary in bin/linux/, and even with the
+ ;; binary in place, I could not get them to run. To my understanding,
+ ;; the setup() function in test/functional/_helper.bash is supposed to
+ ;; copy the binary to the test suite directory. However, this does not
+ ;; seem to happen when invoking ./test.sh (make check is not
+ ;; supported), and the script complains about the missing binary in the
+ ;; directory. The fix could be to copy the binary built by the Guix
+ ;; daemon to the test suite directory before invoking ./test.sh, but
+ ;; this is beyond my skills.
+ #:tests? #f))
+ (home-page "https://github.com/gyselroth/docxbox/")
+ (synopsis "Command-line tool for MS Word @file{.docx} templating and
+analysis")
+ (description
+ "@command{docxbox} enables direct and convenient inspection and
+manipulation of XML and media files making up a @file{.docx} file. The
+capabilities include batch editing, unpacking and indentation for manual
+editing in a text editor and subsequent unindentation and repacking,
+operations on metadata, and diffing")
+ (license license:expat))))
--
2.39.1
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 57337@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 57337
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch