diff options
6 files changed, 109 insertions, 13 deletions
diff --git a/graphics/gowall/Makefile b/graphics/gowall/Makefile index c8f1d1aa390a..45665b23b724 100644 --- a/graphics/gowall/Makefile +++ b/graphics/gowall/Makefile @@ -1,7 +1,6 @@ PORTNAME= gowall DISTVERSIONPREFIX= v -DISTVERSION= 0.2.1 -PORTREVISION= 1 +DISTVERSION= 0.2.3 CATEGORIES= graphics MAINTAINER= nxjoseph@protonmail.com @@ -11,17 +10,44 @@ WWW= https://github.com/Achno/gowall LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE +LIB_DEPENDS= libffi.so:devel/libffi \ + libmupdf.so:graphics/mupdf RUN_DEPENDS= xdg-open:devel/xdg-utils -USES= go:1.22,modules +USES= go:modules -GO_MODULE= github.com/Achno/gowall +GO_MODULE= github.com/Achno/${PORTNAME} +CGO_LDFLAGS+= -lmupdf -lffi -PLIST_FILES= bin/gowall +# utils/error.go:15:18: non-constant format string in call to ... +TESTING_UNSAFE= yes -OPTIONS_DEFINE= PREVIEW -OPTIONS_DEFAULT= PREVIEW -PREVIEW_DESC= Enable image preview support using chafa +PLIST_FILES= bin/${PORTNAME} + +OPTIONS_DEFAULT= PNGQUANT PREVIEW UPSCALE +OPTIONS_GROUP= COMPRESSION FEATURES OCR +OPTIONS_GROUP_COMPRESSION= PNGQUANT +OPTIONS_GROUP_FEATURES= PREVIEW UPSCALE +OPTIONS_GROUP_OCR= TESSERACT + +PNGQUANT_DESC= Install pngquant PNG image compression method +PREVIEW_DESC= Install chafa for image previewing support in terminal +TESSERACT_DESC= Install Tesseract OCR Engine for extracting text from an image or pdf +UPSCALE_DESC= Install upscaler for upscaling and enhancing images + +PNGQUANT_RUN_DEPENDS= pngquant:graphics/pngquant PREVIEW_RUN_DEPENDS= chafa:graphics/chafa +TESSERACT_RUN_DEPENDS= tesseract:graphics/tesseract +UPSCALE_RUN_DEPENDS= upscaler:graphics/upscaler + +post-patch: + @${REINPLACE_CMD} -e '23s,([^()]*),("${LOCALBASE}/bin"),g' \ + ${WRKSRC}/internal/image/upscale.go + +.include <bsd.port.options.mk> + +.if ${ARCH} == "i386" +EXTRA_PATCHES= ${PATCHDIR}/i386/extra-patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go +.endif .include <bsd.port.mk> diff --git a/graphics/gowall/distinfo b/graphics/gowall/distinfo index 7e77db9590b9..6f9636659c15 100644 --- a/graphics/gowall/distinfo +++ b/graphics/gowall/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1744489937 -SHA256 (go/graphics_gowall/gowall-v0.2.1/v0.2.1.mod) = 9db8b7d9dd21d67a66903acadccb4a0aa2c0d3713c3097be5fd8798da7c21804 -SIZE (go/graphics_gowall/gowall-v0.2.1/v0.2.1.mod) = 515 -SHA256 (go/graphics_gowall/gowall-v0.2.1/v0.2.1.zip) = 4deb2c1b61e31f88dcead48a2f4a31fb4b43ba66085990d60c566c9c78121a2c -SIZE (go/graphics_gowall/gowall-v0.2.1/v0.2.1.zip) = 3359975 +TIMESTAMP = 1760285357 +SHA256 (go/graphics_gowall/gowall-v0.2.3/v0.2.3.mod) = 7a4f2e628182dc4e3bec87f4f1fef9f399fa8d744220297b7b17dfe6835f338c +SIZE (go/graphics_gowall/gowall-v0.2.3/v0.2.3.mod) = 2289 +SHA256 (go/graphics_gowall/gowall-v0.2.3/v0.2.3.zip) = 3bdff68aad21129c387d7720fc5f7474fd89b8e20d514e10141dae20e6873342 +SIZE (go/graphics_gowall/gowall-v0.2.3/v0.2.3.zip) = 3410684 diff --git a/graphics/gowall/files/i386/extra-patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go b/graphics/gowall/files/i386/extra-patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go new file mode 100644 index 000000000000..0391135e5926 --- /dev/null +++ b/graphics/gowall/files/i386/extra-patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go @@ -0,0 +1,25 @@ +===> Building gowall from . +# github.com/gen2brain/go-fitz +vendor/github.com/gen2brain/go-fitz/fitz_cgo.go:100:79: cannot use _Ctype_store(MaxStore) (value of uint32 type _Ctype_store) as _Ctype_size_t value in argument to (_Cfunc_fz_new_context_imp) +vendor/github.com/gen2brain/go-fitz/fitz_cgo.go:133:79: cannot use _Ctype_store(MaxStore) (value of uint32 type _Ctype_store) as _Ctype_size_t value in argument to (_Cfunc_fz_new_context_imp) + +--- vendor/github.com/gen2brain/go-fitz/fitz_cgo.go.orig 2025-10-13 13:52:34 UTC ++++ vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +@@ -97,7 +97,7 @@ func New(filename string) (f *Document, err error) { + return + } + +- f.ctx = (*C.struct_fz_context)(unsafe.Pointer(C.fz_new_context_imp(nil, nil, C.store(MaxStore), C.fz_version))) ++ f.ctx = (*C.struct_fz_context)(unsafe.Pointer(C.fz_new_context_imp(nil, nil, C.size_t(MaxStore), C.fz_version))) + if f.ctx == nil { + err = ErrCreateContext + return +@@ -130,7 +130,7 @@ func NewFromMemory(b []byte) (f *Document, err error) + } + f = &Document{} + +- f.ctx = (*C.struct_fz_context)(unsafe.Pointer(C.fz_new_context_imp(nil, nil, C.store(MaxStore), C.fz_version))) ++ f.ctx = (*C.struct_fz_context)(unsafe.Pointer(C.fz_new_context_imp(nil, nil, C.size_t(MaxStore), C.fz_version))) + if f.ctx == nil { + err = ErrCreateContext + return diff --git a/graphics/gowall/files/patch-internal_backends_compression_png_setup.go b/graphics/gowall/files/patch-internal_backends_compression_png_setup.go new file mode 100644 index 000000000000..ff6a552b412c --- /dev/null +++ b/graphics/gowall/files/patch-internal_backends_compression_png_setup.go @@ -0,0 +1,10 @@ +--- internal/backends/compression/png/setup.go.orig 2025-10-12 17:20:54 UTC ++++ internal/backends/compression/png/setup.go +@@ -76,6 +76,7 @@ func CheckPngquantInstalled() (string, error) { + "linux": config.PngquantBinaryName, + "windows": config.PngquantBinaryName + ".exe", + "darwin": config.PngquantBinaryName, ++ "freebsd": config.PngquantBinaryName, + } + + destFolder := filepath.Join(config.GowallConfig.OutputFolder, "compression", "pngquant") diff --git a/graphics/gowall/files/patch-internal_image_upscale.go b/graphics/gowall/files/patch-internal_image_upscale.go new file mode 100644 index 000000000000..ab402d78c440 --- /dev/null +++ b/graphics/gowall/files/patch-internal_image_upscale.go @@ -0,0 +1,19 @@ +--- internal/image/upscale.go.orig 1979-11-30 00:00:00 UTC ++++ internal/image/upscale.go +@@ -7,7 +7,7 @@ import ( + "os/exec" + "path/filepath" + +- "github.com/Achno/gowall/config" ++ // "github.com/Achno/gowall/config" + imageio "github.com/Achno/gowall/internal/image_io" + types "github.com/Achno/gowall/internal/types" + "github.com/Achno/gowall/internal/upscaler" +@@ -35,6 +35,7 @@ func (p *UpscaleProcessor) Process(img image.Image, th + "windows": "realesrgan-ncnn-vulkan.exe", + "darwin": "realesrgan-ncnn-vulkan", + "linux": "realesrgan-ncnn-vulkan", ++ "freebsd": "realesrgan-ncnn-vulkan", + } + + binary, err := utils.FindBinary(binaryNames, destFolder) diff --git a/graphics/gowall/files/patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go b/graphics/gowall/files/patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go new file mode 100644 index 000000000000..3aa616f47c78 --- /dev/null +++ b/graphics/gowall/files/patch-vendor_github.com_gen2brain_go-fitz_fitz__cgo.go @@ -0,0 +1,16 @@ +===> Building gowall from . +# github.com/gen2brain/go-fitz +vendor/github.com/gen2brain/go-fitz/fitz_cgo.go:546:103: cannot use _Ctype_int(len(buf)) (value of int32 type _Ctype_int) as _Ctype_size_t value in variable declaration +*** Error code 1 + +--- vendor/github.com/gen2brain/go-fitz/fitz_cgo.go.orig 2025-10-12 16:34:24 UTC ++++ vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +@@ -543,7 +543,7 @@ func (f *Document) Metadata() map[string]string { + defer C.free(unsafe.Pointer(ckey)) + + buf := make([]byte, 256) +- C.fz_lookup_metadata(f.ctx, f.doc, ckey, (*C.char)(unsafe.Pointer(&buf[0])), C.int(len(buf))) ++ C.fz_lookup_metadata(f.ctx, f.doc, ckey, (*C.char)(unsafe.Pointer(&buf[0])), C.size_t(len(buf))) + + return string(buf) + } |