aboutsummaryrefslogtreecommitdiff
path: root/README
blob: 88399b19da63e183cc397380f5ba4abdc1258788 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
This folder contains my patches for various pkgsrc packages.
This README describes how to create and apply them.

= Modifying a package =

	cd /usr/pkgsrc/path-to/package
	make fetch
	cd /usr/pkgsrc/distfiles
	tar xf archived-package.tgz
	cd extracted-package/
	git init

I like tracking my modifications with Git, if only temporarily.

= Generating a patch =

	cd /path-to/extracted-package/
	git diff ... | conv -i

The resulting patch will be placed in ~/patches.

= Applying a patch =

Be sure to set the LOCALPATCHES variable in mk.conf:

	echo LOCALPATCHES = $HOME/patches >> /etc/mk.conf

After that, local patches will be applied automatically, assuming
they are formatted correctly and placed in the correct directory.

= Undoing patches =

In order to undo all patches, you need to extract the original
files from the downloaded archive.

	cd /usr/pkgsrc/path-to/package
	w=/usr/pkgsrc/distfiles/$(sed -n '/.*(\(.*\)).*/{s//\1/;p;q}' distinfo)
	cd $(dirname $w)
	tar xf $w
	cd -
	find . -name '*.orig' | while read f; do
		f=${f%.orig}
		cp $w/${f#./work/} $f
	done

It is not reliable to restore the original files using the .orig
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 =

	undopatch
	make do-patch
	make do-build
	make replace

---

Below is a selection of various tips.

= Building nvi with Perl support =

Make the following modifications to /usr/pkgsrc/editors/nvi/Makefile:

	--- 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"

You may also need to re-generate PLIST:

	# make print-PLIST > PLIST