mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-04-07 03:10:15 -04:00
dev-util/tinyxxd: update 9999
fixes hunk failure for the patch, also better testing because it now also does the data compare tests with vim's xxd Signed-off-by: ingenarel (NeoJesus) <ingenarel_neojesus@disroot.org>
This commit is contained in:
85
dev-util/tinyxxd/files/tinyxxd-1.3.11-fixes.patch
Normal file
85
dev-util/tinyxxd/files/tinyxxd-1.3.11-fixes.patch
Normal file
@@ -0,0 +1,85 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 65b372c..e8f6903 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -1,17 +1,6 @@
|
||||
.PHONY: clean fmt install profile test uninstall
|
||||
|
||||
-OPTFLAGS ?= -O2 -finline-functions
|
||||
-WARNFLAGS ?= -Wall -Wextra -Wpedantic -Wshadow -Werror -Wfatal-errors -Wconversion -Wsign-conversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
|
||||
-CFLAGS ?= -std=c11 -pipe -fPIC $(OPTFLAGS) $(WARNFLAGS)
|
||||
-
|
||||
-UNAME_S := $(shell uname -s)
|
||||
-ifeq ($(UNAME_S),Darwin)
|
||||
- CFLAGS += -fstack-protector-strong -D_GNU_SOURCE
|
||||
-else ifeq ($(OS),Windows_NT)
|
||||
- CFLAGS += -D_WIN32
|
||||
-else
|
||||
- CFLAGS += -fstack-protector-strong -D_GNU_SOURCE -fno-plt -Wl,-z,now -D_FORTIFY_SOURCE=3
|
||||
-endif
|
||||
+CFLAGS += -std=c11 -D_GNU_SOURCE $(LDFLAGS)
|
||||
|
||||
PREFIX ?= /usr
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
@@ -28,9 +17,6 @@ tinyxxd: main.c
|
||||
tinyxxd_debug: main.c
|
||||
$(CC) $(CFLAGS) -g -o $@ $<
|
||||
|
||||
-tinyxxd_asan: main.c
|
||||
- $(CC) $(CFLAGS) -g -fsanitize=address,undefined -o $@ $<
|
||||
-
|
||||
profile: tinyxxd_debug
|
||||
dd if=/dev/random of=sample.bin bs=1M count=1
|
||||
valgrind --dump-instr=yes --collect-jumps=yes --tool=callgrind ./tinyxxd_debug sample.bin
|
||||
@@ -48,7 +34,7 @@ benchfull:
|
||||
fmt: main.c
|
||||
clang-format -style=WebKit -i main.c
|
||||
|
||||
-test: xxd tinyxxd_asan
|
||||
+test:
|
||||
@echo 'Preparing tests...'
|
||||
@echo -n 'This is a test file' > sample.bin
|
||||
@printf '\x00\x09\x0a\x0d\x20\x41\x7e\x7f\x80\xff' > colorbytes.bin
|
||||
@@ -77,15 +63,14 @@ test: xxd tinyxxd_asan
|
||||
@$(MAKE) run_test CMD='-o 0x100 sample.bin' DESC='Display offset +0x100'
|
||||
@$(MAKE) run_test CMD='-i -C sample.bin' DESC='C include capitalized'
|
||||
@$(MAKE) run_test CMD='-i -n myvar sample.bin' DESC='C include custom name'
|
||||
- @$(MAKE) run_test CMD='-i -b sample.bin' DESC='C include binary format'
|
||||
- @$(MAKE) verify_conversion_test
|
||||
+ @$(MAKE) run_test CMD='-i -b sample.bin' DESC='C include binary format' @$(MAKE) verify_conversion_test
|
||||
@rm -f -- *.hex sample.bin colorbytes.bin ebcdicbytes.bin tinyxxd_output.txt xxd_output.txt
|
||||
@echo 'All tests complete.'
|
||||
|
||||
run_test:
|
||||
@echo "Running test: $(DESC)"
|
||||
- @./tinyxxd_asan $(CMD) > tinyxxd_output.txt
|
||||
- @./xxd $(CMD) > xxd_output.txt
|
||||
+ @./tinyxxd $(CMD) > tinyxxd_output.txt
|
||||
+ @xxd $(CMD) > xxd_output.txt
|
||||
@if diff -q tinyxxd_output.txt xxd_output.txt > /dev/null; then \
|
||||
echo 'Test passed'; \
|
||||
else \
|
||||
@@ -95,8 +80,8 @@ run_test:
|
||||
|
||||
verify_conversion_test:
|
||||
@echo "Running conversion and verification test..."
|
||||
- @./tinyxxd_asan sample.bin > sample_tinyxxd.bin
|
||||
- @./tinyxxd_asan -r sample_tinyxxd.bin > sample_restored.bin
|
||||
+ @./tinyxxd sample.bin > sample_tinyxxd.bin
|
||||
+ @./tinyxxd -r sample_tinyxxd.bin > sample_restored.bin
|
||||
@if diff -q sample.bin sample_restored.bin > /dev/null; then \
|
||||
echo -e "\033[0;32mConversion and verification test passed\033[0m"; \
|
||||
else \
|
||||
@@ -128,12 +113,6 @@ fuzz: tinyxxd_fuzz
|
||||
@dd if=/dev/urandom of=input_dir/sample.bin count=1 bs=128
|
||||
afl-fuzz -i input_dir -o fuzz_output -- ./tinyxxd_fuzz @@
|
||||
|
||||
-testfiles/xxd.c:
|
||||
- cd testfiles && curl -sOL "https://raw.githubusercontent.com/vim/vim/master/src/xxd/xxd.c"
|
||||
-
|
||||
-xxd: testfiles/xxd.c
|
||||
- $(CC) -std=c11 -pipe -D_GNU_SOURCE $(OPTFLAGS) -o $@ $<
|
||||
-
|
||||
install: tinyxxd
|
||||
install -D -m 755 tinyxxd "$(DESTDIR)$(BINDIR)/tinyxxd"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit edo toolchain-funcs
|
||||
inherit toolchain-funcs
|
||||
|
||||
DESCRIPTION="Drop-in replacement and standalone version of xxd"
|
||||
HOMEPAGE="https://github.com/xyproto/tinyxxd"
|
||||
@@ -19,16 +19,19 @@ LICENSE="|| ( GPL-2 MIT )"
|
||||
|
||||
SLOT="0"
|
||||
|
||||
IUSE="xxd"
|
||||
IUSE="xxd test"
|
||||
REQUIRED_USE="test? ( !xxd )"
|
||||
RESTRICT="!test? ( test )"
|
||||
|
||||
RDEPEND="
|
||||
xxd? (
|
||||
!<app-editors/vim-core-9.1.1652-r1
|
||||
!dev-util/xxd
|
||||
)
|
||||
test? ( dev-util/xxd )
|
||||
"
|
||||
|
||||
PATCHES=( "${FILESDIR}"/${PN}-1.3.7-fix-flags.patch )
|
||||
PATCHES=( "${FILESDIR}/${PN}-1.3.11-fixes.patch" )
|
||||
|
||||
src_compile() {
|
||||
export CFLAGS LDFLAGS
|
||||
@@ -36,11 +39,6 @@ src_compile() {
|
||||
emake
|
||||
}
|
||||
|
||||
src_test() {
|
||||
edo ./testfiles/test13.sh
|
||||
edo ./testfiles/test14.sh
|
||||
}
|
||||
|
||||
src_install(){
|
||||
emake DESTDIR="${D}" PREFIX="${EPREFIX}"/usr install
|
||||
if use xxd; then
|
||||
|
||||
Reference in New Issue
Block a user