Bump liberty, move the UI to liberty-xui.c

This deduplicates code between nncmpp and hex,
while adding functionality.
This commit is contained in:
Přemysl Eric Janouch 2023-06-17 15:50:56 +02:00
parent b87206bb93
commit 00d6c5ede9
Signed by: p
GPG Key ID: A0420B94F92B9493
8 changed files with 406 additions and 389 deletions

View File

@ -20,7 +20,6 @@ include (AddThreads)
find_package (Termo QUIET NO_MODULE)
option (USE_SYSTEM_TERMO
"Don't compile our own termo library, use the system one" ${Termo_FOUND})
if (USE_SYSTEM_TERMO)
if (NOT Termo_FOUND)
message (FATAL_ERROR "System termo library not found")
@ -45,7 +44,6 @@ set (project_libraries ${Unistring_LIBRARIES}
pkg_search_module (lua lua53 lua5.3 lua-5.3 lua>=5.3)
option (WITH_LUA "Enable support for Lua plugins" ${lua_FOUND})
if (WITH_LUA)
if (NOT lua_FOUND)
message (FATAL_ERROR "Lua library not found")
@ -65,6 +63,18 @@ if (WITH_LUA)
endif ()
endif ()
pkg_check_modules (x11 x11 xrender xft fontconfig)
option (WITH_X11 "Build with X11 support" ${x11_FOUND})
if (WITH_X11)
if (NOT x11_FOUND)
message (FATAL_ERROR "Some X11 libraries were not found")
endif ()
list (APPEND project_libraries ${x11_LIBRARIES})
include_directories (${x11_INCLUDE_DIRS})
link_directories (${x11_LIBRARY_DIRS})
endif ()
include_directories (${Unistring_INCLUDE_DIRS}
${Ncursesw_INCLUDE_DIRS} ${Termo_INCLUDE_DIRS})
@ -74,8 +84,6 @@ set (CMAKE_REQUIRED_LIBRARIES ${Ncursesw_LIBRARIES})
CHECK_FUNCTION_EXISTS ("resizeterm" HAVE_RESIZETERM)
# Generate a configuration file
set (HAVE_LUA "${WITH_LUA}")
configure_file (${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_BINARY_DIR}/config.h)
include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
@ -89,6 +97,10 @@ add_threads (${PROJECT_NAME})
include (GNUInstallDirs)
install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
if (WITH_X11)
install (FILES ${PROJECT_NAME}.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
endif ()
# Generate documentation from text markup
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)

View File

@ -1,4 +1,4 @@
Copyright (c) 2016 - 2017, Přemysl Eric Janouch <p@janouch.name>
Copyright (c) 2016 - 2023, Přemysl Eric Janouch <p@janouch.name>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

View File

@ -3,7 +3,7 @@ hex
'hex' is yet another hex viewer. It automatically interprets fields within
files using a set of Lua scripts, colorizing them and showing descriptions on
the side.
the side. It also runs equally well in the terminal, or as an X11 client.
At the moment there aren't that many features and we only have a few decoders.
@ -24,6 +24,7 @@ Building and Running
Build dependencies: CMake, pkg-config, awk, liberty (included),
termo (included), asciidoctor or asciidoc (recommended but optional) +
Runtime dependencies: ncursesw, libunistring, Lua >= 5.3 (for highlighting)
Optional runtime dependencies: x11, xft
$ git clone --recursive https://git.janouch.name/p/hex.git
$ mkdir hex/build

View File

@ -5,7 +5,8 @@
#define PROGRAM_VERSION "${PROJECT_VERSION}"
#cmakedefine HAVE_RESIZETERM
#cmakedefine HAVE_LUA
#cmakedefine WITH_LUA
#cmakedefine WITH_X11
#endif // ! CONFIG_H

View File

@ -38,6 +38,10 @@ _G_=1024M, and _GB_=1000M. The default value is 1G.
*-d*, *--debug*::
Run in debug mode.
*-x*, *--x11*::
Use an X11 interface even when run from a terminal.
Note that the application may be built with this feature disabled.
*-h*, *--help*::
Display a help message and exit.

752
hex.c

File diff suppressed because it is too large Load Diff

9
hex.desktop Normal file
View File

@ -0,0 +1,9 @@
[Desktop Entry]
Type=Application
Name=hex
GenericName=Interpreting hex viewer
Icon=hex
Exec=hex %f
NoDisplay=true
StartupNotify=false
Categories=Utility;

@ -1 +1 @@
Subproject commit 34f86651f6220038c0ee07d3f422a52d9b081f02
Subproject commit d01a1ff0348174f91bb2d3ba53145cc2c9f50a7f