Build ebuild package manually
Which fails to emerge. Applying own patch.
With reference: https://www.gentoo.org/doc/en/handbook/2004.2/handbook-x86.xml?part=3&chap=6
ebuild(1) always requires .ebuild file as first argument, and action as second argument. Here's an example of how to build app-admin/syslog-ng manually.
Fetch tarball
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild fetch
Extract tarball
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild unpack
Extracted directory could found at /var/tmp/portage/app-admin/syslog-ng-3.4.2. Now apply patches you need.
Compile(make)
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild compile
Install to temporarily location
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild install
This is not "real" installation actually. You can find files under /var/tmp/portage/app-admin/syslog-ng-3.4.2/image/; which will be installed under $PREFIX(normally /usr) in next step.
Install
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild qmerge
qmerge will execute install operation and merge build into portage tree. Package will marked as "installed" after this step has finished.
Cleaning
ebuild /usr/portage/app-admin/syslog-ng/syslog-ng-3.4.2.ebuild clean
clean will remove temporarily dirs/files(i.e. /var/tmp/portage/app-admin/syslog-ng-3.4.2). But this step could omitted. These files will be removed automatically in the feature.