packages: image-viewers: Add ueberzug++

sioyek
Luis Guilherme Coelho 2024-02-11 19:40:26 -03:00
parent 85a70d8a18
commit c5a65cf249
No known key found for this signature in database
GPG Key ID: 1F2E76ACE3F531C8
3 changed files with 64 additions and 163 deletions

View File

@ -0,0 +1,31 @@
(define-module (radix packages cpp)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages check)
#:use-module (guix packages)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module ((guix licenses) #:prefix license:))
;; Special thanks to Murilo (6a046e63e2ccdd0d9af9364883597b4bb50e3ab9)
(define-public gsl-microsoft
(package
(name "gsl-microsoft")
(version "4.0.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/Microsoft/GSL")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0dgb3rb6x2276d3v7x568m3zhqr67rhk8ynqgm3c304avnmcaw3i"))))
(build-system cmake-build-system)
(native-inputs (list pkg-config))
(inputs (list googletest))
(home-page "https://github.com/saitoha/libsixel")
(synopsis "Guidelines Support Library")
(description "The Guidelines Support Library (GSL) contains functions and
types that are suggested for use by the C++ Core Guidelines maintained by the
Standard C++ Foundation. This repo contains Microsoft's implementation of GSL.")
(license license:expat)))

View File

@ -8,6 +8,7 @@
#:use-module (gnu packages gstreamer) #:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages check)
#:use-module (gnu packages image-processing) #:use-module (gnu packages image-processing)
#:use-module (gnu packages image-viewers) #:use-module (gnu packages image-viewers)
#:use-module (gnu packages imagemagick) #:use-module (gnu packages imagemagick)
@ -28,6 +29,7 @@
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (radix packages cpp)
#:use-module ((guix licenses) #:prefix license:)) #:use-module ((guix licenses) #:prefix license:))
(define-public libsixel (define-public libsixel
@ -57,7 +59,7 @@ graphics, and some converter programs.")
(license:non-copyleft "file:///LICENSE.pnmcolormap") (license:non-copyleft "file:///LICENSE.pnmcolormap")
(license:non-copyleft "file:///LICENSE.mesa"))))) (license:non-copyleft "file:///LICENSE.mesa")))))
;; Currently broken ;; Special thanks to Murilo (6a046e63e2ccdd0d9af9364883597b4bb50e3ab9)
(define-public ueberzug++ (define-public ueberzug++
(package (package
(name "ueberzug++") (name "ueberzug++")
@ -68,59 +70,44 @@ graphics, and some converter programs.")
(uri (git-reference (uri (git-reference
(url "https://github.com/jstkdng/ueberzugpp") (url "https://github.com/jstkdng/ueberzugpp")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(patches (list (local-file "../patches/uerberzug++-cmakelists.patch")))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "1ibpyy7ypj4lk837n24ws6dq4aq6crm0kjx0zcnnrdkjjjj232n8")))) (base32 "1ibpyy7ypj4lk837n24ws6dq4aq6crm0kjx0zcnnrdkjjjj232n8"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
(list #:phases (list #:configure-flags
#~(list "-DENABLE_OPENCV=ON"
"-DENABLE_X11=ON"
"-DENABLE_WAYLAND=OFF")
#:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'absolutize-headers (delete 'check))))
(lambda _
(let ((libxcb-file
(lambda (path)
(string-append "\"" #$libxcb path "\"")))
(nlohmann-json-file
(lambda (path)
(string-append "\"" #$nlohmann-json path "\""))))
(substitute* "src/util/x11.cpp"
(("<xcb/res.h>") (libxcb-file "/include/xcb/res.h")))
#;(substitute*
(list "src/canvas/wayland/config/hyprland.hpp"
"src/canvas/wayland/config/sway.hpp"
"src/canvas/wayland/config/wayfire.hpp"
"src/util/util.cpp"
"src/application.cpp"
"src/flags.cpp")
(("json/json\\.h")
(nlohmann-json-file "/include/nlohmann/json.hpp")))))))))
(native-inputs (native-inputs
(list pkg-config (list cairo
spdlog
gsl
fmt
libxcb
libgsf
orc
fftw
imagemagick
matio
expat
librsvg
lcms
openexr
cairo
pango
libwebp
libexif
imath
poppler
opencv
gobject-introspection
xcb-util-image
cli11 cli11
nlohmann-json)) expat
fftw
fmt
gobject-introspection
gsl-microsoft
imagemagick
imath
lcms
libexif
libgsf
librsvg
libwebp
libxcb
matio
nlohmann-json
opencv
openexr
orc
pango
pkg-config
poppler
spdlog
xcb-util-image))
(inputs (inputs
(list libsixel (list libsixel
vips vips
@ -150,5 +137,3 @@ workspaces
@item Fast image downscaling (through opencv and opencl) @item Fast image downscaling (through opencv and opencl)
@item Cache resized images for faster viewing") @item Cache resized images for faster viewing")
(license license:gpl3))) (license license:gpl3)))
ueberzug++

View File

@ -1,115 +0,0 @@
diff --git a/CMakeLists.txt b/home/radio/a
index 92ff7f2..8b9bf6e 100644
--- a/CMakeLists.txt
+++ b/home/radio/a
@@ -40,7 +40,6 @@ option(ENABLE_OPENCV "Enable OpenCV image processing." ON)
option(ENABLE_TURBOBASE64 "Enable Turbo-Base64 for base64 encoding." OFF)
option(ENABLE_OPENGL "Enable canvas rendering with OpenGL." OFF)
-include(FetchContent)
include(GNUInstallDirs)
include(CheckCXXSymbolExists)
@@ -56,55 +55,6 @@ if (HAVE_STD_EXECUTION_H)
target_compile_definitions(ueberzug PRIVATE HAVE_STD_EXECUTION_H)
endif()
-find_package(Microsoft.GSL CONFIG QUIET)
-if (NOT Microsoft.GSL_FOUND)
- FetchContent_Declare(GSL
- URL https://github.com/microsoft/GSL/archive/refs/tags/v4.0.0.tar.gz
- )
- list(APPEND FC_LIBS GSL)
-endif()
-
-find_package(CLI11 QUIET)
-if(NOT CLI11_FOUND)
- if (FETCHCONTENT_FULLY_DISCONNECTED)
- add_subdirectory("${CMAKE_SOURCE_DIR}/third_party/CLI11")
- else()
- FetchContent_Declare(cli11
- URL https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.3.2.tar.gz
- )
- list(APPEND FC_LIBS cli11)
- endif()
-endif()
-
-find_package(nlohmann_json QUIET)
-if(NOT nlohmann_json_FOUND)
- FetchContent_Declare(nlohmann_json
- URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
- )
- list(APPEND FC_LIBS nlohmann_json)
-endif()
-
-find_package(fmt QUIET)
-if(NOT fmt_FOUND)
- FetchContent_Declare(fmt
- URL https://github.com/fmtlib/fmt/archive/refs/tags/10.1.0.tar.gz
- )
- list(APPEND FC_LIBS fmt)
-endif()
-
-find_package(spdlog QUIET)
-if(NOT spdlog_FOUND)
- set(SPDLOG_FMT_EXTERNAL ON)
- FetchContent_Declare(spdlog
- URL https://github.com/gabime/spdlog/archive/refs/tags/v1.12.0.tar.gz
- )
- list(APPEND FC_LIBS spdlog)
-endif()
-
-if(FC_LIBS)
- FetchContent_MakeAvailable(${FC_LIBS})
-endif()
-
if(ENABLE_OPENGL)
target_compile_definitions(ueberzug PRIVATE ENABLE_OPENGL)
find_package(OpenGL REQUIRED)
@@ -196,23 +146,6 @@ if(ENABLE_OPENCV)
)
endif()
-if(ENABLE_TURBOBASE64)
- add_compile_definitions(ENABLE_TURBOBASE64)
- find_package(turbobase64 QUIET)
- if (NOT turbobase64_FOUND)
- FetchContent_Declare(
- turbobase64
- URL https://github.com/powturbo/Turbo-Base64/archive/refs/tags/2023.08.tar.gz
- )
- FetchContent_Populate(turbobase64)
- add_subdirectory(${turbobase64_SOURCE_DIR} ${turbobase64_BINARY_DIR} EXCLUDE_FROM_ALL)
- list(APPEND UEBERZUG_LIBRARIES base64)
- else()
- add_compile_definitions(WITH_SYSTEM_TURBOBASE64)
- list(APPEND UEBERZUG_LIBRARIES turbo::base64)
- endif()
-endif()
-
set(PROJECT_WARNINGS_CXX
-Wall
-Wextra
@@ -235,22 +168,6 @@ pkg_check_modules(VIPS REQUIRED IMPORTED_TARGET vips-cpp)
pkg_check_modules(SIXEL REQUIRED IMPORTED_TARGET libsixel)
pkg_check_modules(CHAFA REQUIRED IMPORTED_TARGET chafa>=1.6)
-if (APPLE)
- list(APPEND UEBERZUG_SOURCES src/process/apple.cpp)
-
- find_package(range-v3 QUIET)
- if (NOT range-v3_FOUND)
- FetchContent_Declare(range-v3
- URL https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz
- )
- FetchContent_Populate(range-v3)
- add_subdirectory(${range-v3_SOURCE_DIR} ${range-v3_BINARY_DIR} EXCLUDE_FROM_ALL)
- endif()
- list(APPEND UEBERZUG_LIBRARIES range-v3)
-else()
- list(APPEND UEBERZUG_SOURCES src/process/linux.cpp)
-endif()
-
configure_file("include/version.hpp.in" version.hpp)
configure_file("docs/ueberzugpp.1.in" ueberzugpp.1)