From c41c1869ff84ebff17c9fc5f4af2dcd9410ea1b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= <john@ankarstrom.se>
Date: Sat, 17 Jul 2021 22:51:00 +0200
Subject: README: Add information about system patches

---
 README | 57 +++++++++++++++++++++++++++------------------------------
 1 file changed, 27 insertions(+), 30 deletions(-)

diff --git a/README b/README
index a00122f..1c5258d 100644
--- a/README
+++ b/README
@@ -1,25 +1,36 @@
-This folder contains my patches for various pkgsrc packages.
-This README describes how to create and apply them.
+This folder contains my patches for various pkgsrc packages as well
+as the NetBDS distribution. This README describes how to create
+and apply them.
 
-= Modifying a package =
+= pkgsrc patches =
+
+== Modifying a package ==
 
 	cd /usr/pkgsrc/path-to/package
 	make fetch
 	cd /usr/pkgsrc/distfiles
 	tar xf archived-package.tgz
 	cd extracted-package/
+
+At this point, you can either decide to track your changes by
+initializing a Git repository
+
 	git init
+	git commit .
 
-I like tracking my modifications with Git, if only temporarily.
+or by using pkgvi and pkgdiff:
 
-= Generating a patch =
+	pkgvi file.c
+	pkgdiff file.c > ~/patches/path-to/package/patch-name
+
+== Generating a patch from Git ==
 
 	cd /path-to/extracted-package/
 	git diff ... | conv -i
 
 The resulting patch will be placed in ~/patches.
 
-= Applying a patch =
+== Applying a patch ==
 
 Be sure to set the LOCALPATCHES variable in mk.conf:
 
@@ -28,7 +39,7 @@ Be sure to set the LOCALPATCHES variable in mk.conf:
 After that, local patches will be applied automatically, assuming
 they are formatted correctly and placed in the correct directory.
 
-= Undoing patches =
+== Undoing patches ==
 
 In order to undo all patches, you need to extract the original
 files from the downloaded archive.
@@ -48,7 +59,7 @@ files, as multiple patches may have been applied to the same file.
 
 You can use the undopatch script to automate this.
 
-= Rebuilding with new patch =
+== Rebuilding with new patch ==
 
 	undopatch
 	make do-patch
@@ -59,29 +70,15 @@ You can use the undopatch script to automate this.
 
 ---
 
-Below is a selection of various tips.
-
-= Building nvi with Perl support =
+= NetBSD patches =
 
-Make the following modifications to /usr/pkgsrc/editors/nvi/Makefile:
+The usr/ directory contains patches for the NetBSD distribution.
 
-	--- Makefile.old	2021-07-08 12:53:15.538072320 +0200
-	+++ Makefile	2021-07-08 12:54:27.003854632 +0200
-	@@ -19,6 +19,7 @@
-	 GNU_CONFIGURE=		yes
-	 CONFIGURE_SCRIPT=	../dist/configure
-	 CONFIGURE_ARGS+=	--program-transform-name='s,^,n,'
-	+CONFIGURE_ARGS+=	--enable-perlinterp
-	 CONFIGURE_ENV+=		vi_cv_path_shell=${TOOLS_SH}
-	 
-	 .if ${OPSYS} == "NetBSD"
-	@@ -49,4 +50,5 @@
-		aclocal -I m4 && autoheader && autoconf
-	 
-	 .include "../../mk/curses.buildlink3.mk"
-	+.include "../../lang/perl5/buildlink3.mk"
-	 .include "../../mk/bsd.pkg.mk"
+== Applying a patch ==
 
-You may also need to re-generate PLIST:
+	cd /usr/*src/...
+	patch -F3 -Vt <~/patches/usr/*src/.../patch-name
 
-	# make print-PLIST > PLIST
+-F3 increases the fuzz from the default value of 2. -Vt enables
+numbered backups, which avoids overwriting original files when
+applying multiple patches.
-- 
cgit v1.2.3