From: David Elsing <david.elsing@posteo.net>
To: 71787@debbugs.gnu.org
Cc: David Elsing <david.elsing@posteo.net>
Subject: [bug#71787] [PATCH 03/12] gnu: Add extract.
Date: Wed, 26 Jun 2024 19:26:56 +0000 [thread overview]
Message-ID: <20240626192717.12818-3-david.elsing@posteo.net> (raw)
In-Reply-To: <20240626192505.12401-1-david.elsing@posteo.net>
* gnu/packages/ghostscript.scm (extract): New variable.
* gnu/packages/patches/extract-shared-library.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---
gnu/local.mk | 1 +
gnu/packages/ghostscript.scm | 47 +++++++++++++++
| 59 +++++++++++++++++++
3 files changed, 107 insertions(+)
create mode 100644 gnu/packages/patches/extract-shared-library.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 282cf30f7f..2fc14e68fe 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1178,6 +1178,7 @@ dist_patch_DATA = \
%D%/packages/patches/eudev-rules-directory.patch \
%D%/packages/patches/exercism-disable-self-update.patch \
%D%/packages/patches/extempore-unbundle-external-dependencies.patch \
+ %D%/packages/patches/extract-shared-library.patch \
%D%/packages/patches/extundelete-e2fsprogs-1.44.patch \
%D%/packages/patches/fail2ban-0.11.2_CVE-2021-32749.patch \
%D%/packages/patches/fail2ban-0.11.2_fix-setuptools-drop-2to3.patch \
diff --git a/gnu/packages/ghostscript.scm b/gnu/packages/ghostscript.scm
index 5f0e2cf3c4..2e24904fd4 100644
--- a/gnu/packages/ghostscript.scm
+++ b/gnu/packages/ghostscript.scm
@@ -30,6 +30,7 @@
(define-module (gnu packages ghostscript)
#:use-module (gnu packages)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages c)
#:use-module (gnu packages compression)
#:use-module (gnu packages cups)
#:use-module (gnu packages fontutils)
@@ -94,6 +95,52 @@ (define-public lcms2mt
(GhostScript fork)")
(home-page "https://www.ghostscript.com/")))
+(define-public extract
+ (package
+ (name "extract")
+ (version "10.03.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "git://git.ghostscript.com/extract.git")
+ (commit (string-append "ghostpdl-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "17mb96xpsbr26q2l3kahmi3f1mcqzn7n1q1783f40155lrkk88q9"))
+ (snippet
+ '(for-each
+ delete-file
+ '("src/docx_template.c" "src/docx_template.h"
+ "src/odt_template.c" "src/odt_template.h"
+ "src/memento.h" "src/memento.c")))
+ (patches (search-patches "extract-shared-library.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:test-target "test"
+ #:make-flags
+ `(list
+ "build=debug-opt"
+ "flags_compile=-MMD -MP -Iinclude -Isrc -fPIC"
+ (string-append "CC=" ,(cc-for-target))
+ (string-append "CXX=" ,(cxx-for-target)))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure) ; no configure script
+ (replace 'install
+ (lambda _
+ (install-file "libextract.so" (string-append #$output "/lib"))
+ (copy-recursively
+ "include" (string-append #$output "/include")))))))
+ (inputs (list memento zlib))
+ (native-inputs (list python unzip))
+ (home-page "https://git.ghostscript.com/?p=extract.git")
+ (synopsis "Document content extraction library")
+ (description "extract is a library for exstracting dox, odt, html and text
+files from documents.")
+ (license license:agpl3+)))
+
(define-public libpaper
(package
(name "libpaper")
--git a/gnu/packages/patches/extract-shared-library.patch b/gnu/packages/patches/extract-shared-library.patch
new file mode 100644
index 0000000000..b2ab37dcc6
--- /dev/null
+++ b/gnu/packages/patches/extract-shared-library.patch
@@ -0,0 +1,59 @@
+Adjust the Makefile to build a shared library.
+
+diff --git a/Makefile b/Makefile
+index e8933ea..5cf503c 100644
+--- a/Makefile
++++ b/Makefile
+@@ -130,6 +130,7 @@ endif
+ $(warning gs=$(gs))
+ endif
+
++build: libextract.so $(exe_dep) $(exe_buffer_test_dep) $(exe_misc_test_dep) $(exe_ziptest_dep)
+
+ # Default target - run all tests.
+ #
+@@ -294,7 +295,7 @@ test/generated/%.pdf.mutool.text.diff: test/generated/%.pdf.mutool.text test/%.p
+ # Main executable.
+ #
+ exe = src/build/extract-$(build).exe
+-exe_src = \
++lib_src = \
+ src/alloc.c \
+ src/astring.c \
+ src/boxer.c \
+@@ -302,10 +303,10 @@ exe_src = \
+ src/document.c \
+ src/docx.c \
+ src/docx_template.c \
+- src/extract-exe.c \
+ src/extract.c \
+ src/html.c \
+ src/join.c \
++ src/json.c \
+ src/mem.c \
+ src/odt.c \
+ src/odt_template.c \
+@@ -318,16 +319,18 @@ exe_src = \
+
+
+ ifeq ($(build),memento)
+- exe_src += src/memento.c
++ lib_src += src/memento.c
+ ifeq ($(uname),Linux)
+ flags_compile += -D HAVE_LIBDL
+ flags_link += -L $(libbacktrace) -l backtrace -l dl
+ endif
+ endif
+-exe_obj := $(exe_src)
+-exe_obj := $(patsubst src/%.c, src/build/%.c-$(build).o, $(exe_obj))
+-exe_obj := $(patsubst src/%.cpp, src/build/%.cpp-$(build).o, $(exe_obj))
+-exe_dep = $(exe_obj:.o=.d)
++lib_obj := $(lib_src)
++lib_obj := $(patsubst src/%.c, src/build/%.c-$(build).o, $(lib_obj))
++lib_obj := $(patsubst src/%.cpp, src/build/%.cpp-$(build).o, $(lib_obj))
++lib_dep = $(lib_obj:.o=.d)
++libextract.so: $(lib_obj)
++ $(CXX) $(flags_link) $^ -lz -lm -shared -o $@
+ exe: $(exe)
+ $(exe): $(exe_obj)
+ $(CXX) $(flags_link) -o $@ $^ -lz -lm
--
2.45.1
next prev parent reply other threads:[~2024-06-26 19:28 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 19:24 [bug#71787] [PATCH 00/12] Update and unbundle ghostscript and mupdf David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 01/12] gnu: Add lcms2mt David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 02/12] gnu: Add memento David Elsing
2024-06-26 19:26 ` David Elsing [this message]
2024-06-26 19:26 ` [bug#71787] [PATCH 04/12] gnu: ijs: Remove unneeded files and build shared library David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 05/12] gnu: ghostscript: Unbundle dependencies and remove non-free parts David Elsing
2024-06-26 19:26 ` [bug#71787] [PATCH 06/12] gnu: Add ghostscript/tesseract David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 07/12] gnu: mupdf: Update to 1.24.4 and unbundle remaining dependencies David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 08/12] gnu: Add mupdf/tesseract David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 09/12] gnu: Add python-pymupdf David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 10/12] gnu: Add python-svglib David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 11/12] gnu: Add python-rst2pdf David Elsing
2024-06-26 19:27 ` [bug#71787] [PATCH 12/12] gnu: Add ghostscript-documentation David Elsing
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240626192717.12818-3-david.elsing@posteo.net \
--to=david.elsing@posteo.net \
--cc=71787@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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).