Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2019 09:08:14 +0900 (JST)
From:      Yasuhiro KIMURA <yasu@utahime.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to apply a patch to a port
Message-ID:  <20191022.090814.157299176887147047.yasu@utahime.org>
In-Reply-To: <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com>
References:  <CAGLDxTW8VCjfKGAEp9b1gn_==XsxRjSizvRbiw%2BTkzRgt49hDA@mail.gmail.com> <20191022.053926.1076439053946694541.yasu@utahime.org> <9ac08912-0415-0830-9381-6df157fe6ab1@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
From: Clay Daniels <clay.daniels.jr@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
>> /path/to/patch/patch-linuxkpi_gplv2_src_linux__page.c
>>     (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?

Yes.

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
steps.

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.

---
Yasuhiro KIMURA



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191022.090814.157299176887147047.yasu>