How to apply a patch to a port
yasu at utahime.org
Tue Oct 22 00:09:27 UTC 2019
From: Clay Daniels <clay.daniels.jr at gmail.com>
Subject: Re: How to apply a patch to a port
Date: Mon, 21 Oct 2019 18:21:19 -0500
>> 1. cd /usr/ports/graphics/drm-current-kmod
> OK, but should my patch file be here, or do I need to make a /files
> subdirectory and put it there?
Patch file should be put somewhere out of ports tree. And you don't
have to create files subdirectory because it will be created at step 6.
>> 2. make patch
>> 3. cd work/kms-drm-2d2852e
>> 4. patch -p 0 -s -i
>> (You may need to change '-p 0' to '-p 1' or '-p 2' or ...)
>> 5. cd ../..
>> 6. make makepatch
>> 7. make clean
>> Then new patch file is created under files subdirectory.
> Then change back to main port directory & run make install (clean) for
> the whole port, right?
And in fact, if you succeeded to apply patch with '-p 0' in step 4,
then you don't have to follow above procedure. Instead take following
1. cd /usr/ports/graphics/drm-current-kmod
2'. mkdir files
3'. cp /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c files
Then 'make install' should work.
The reason that I recommended first procedure is that there are some
different patch formats. If the patch is created by 'diff' or 'svn
diff' then it can be applied with 'patch -p 0'. So you can use second
procedure. But if it is created by 'git diff' or 'git format-patch'
then it need to be applied with 'patch -p 1'. In this case you can't
use second one. I don't know how your patch is created. So I
recommended one that can be used everytime.
More information about the freebsd-questions