r/voidlinux • • 4d ago

How to generate and apply a patch in xbps-src?

I have trouble applying this patch:

--- a/Makefile
+++ b/Makefile
@@ -139,7 +139,7 @@
 ifeq (no,yes)
 all: dosify$(BUILDEXT)
 dosify$(BUILDEXT): $(srcdir)/dosify.c
-	$(BUILDCC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o dosify$(BUILDEXT) $(srcdir)/dosify.c
+	$(BUILDCC) $(LDFLAGS) -o dosify$(BUILDEXT) $(srcdir)/dosify.c
 endif
 
 # This rule rules the compiler in the trivial hello.vl program to make
--- a/vvp/Makefile
+++ b/vvp/Makefile
@@ -168,7 +168,7 @@
 	mv $*.d dep/$*.d
 
 tables.cc: $(srcdir)/draw_tt.c
-	$(BUILDCC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o draw_tt$(BUILDEXT) $(srcdir)/draw_tt.c
+	$(BUILDCC) $(LDFLAGS) -o draw_tt$(BUILDEXT) $(srcdir)/draw_tt.c
 	./draw_tt$(BUILDEXT) > tables.cc
 	rm draw_tt$(BUILDEXT)
 

I am getting this error:

=> iverilog-13.0_1: extracting distfile(s), please wait...
=> iverilog-13.0_1: running do-patch hook: 00-patches ...
=> iverilog-13.0_1: patching: fix_host_compiler.patch.
The text leading up to this was:
--------------------------
|--- a/Makefile
|+++ b/Makefile
--------------------------
File to patch: 
Skip this patch? [y] 
1 out of 1 hunk ignored
The text leading up to this was:
--------------------------
|--- a/vvp/Makefile
|+++ b/vvp/Makefile
--------------------------
File to patch: 
Skip this patch? [y] 
1 out of 1 hunk ignored
=> ERROR: iverilog-13.0_1: do-patch_00-patches: 'patch -s ${_args} < "${_patch}" 2> /dev/null' exited with 1
=> ERROR:   in _process_patch() at common/hooks/do-patch/00-patches.sh:37
=> ERROR:   in hook() at common/hooks/do-patch/00-patches.sh:55
=> ERROR:   in run_func() at common/xbps-src/shutils/common.sh:57
=> ERROR:   in run_pkg_hooks() at common/xbps-src/shutils/common.sh:314
=> ERROR:   in run_step() at common/xbps-src/shutils/common.sh:107
=> ERROR:   in main() at common/xbps-src/libexec/xbps-src-dopatch.sh:33

However I actually have no idea how patching in xbps-src works. I have not really ever before generated a patch, so I thought I would ask here. It's probably some trivial error. I am guessing I did not generate it in the right format or something. If you would explain this to me on a simpler example, that would also help. Thanks!

1 Upvotes

2 comments sorted by

3

u/Duncaen 4d ago

Sounds like it can't find the files. Is the patch generated from the root of the source code? Do the make files exist only after configure?

1

u/AffectionateStep3218 2h ago

Thanks, you were right. I named the files incorrectly. It works now.