Override or customize an existing package

Is there an easy, or well-known way to customize an existing package in a way that doesn't require directly modifying the package itself? I've always just made a copy of the package into a new feed and renamed the package to something unique but I feel that isn't a very portable way to customize a package.

If you are talking about modifying it for your own use, the easiest thing is to add patches to your local repo.

Those patches can modify the upstream sources for you.

See example e.g. transmission

Hey hnyman, thanks for replying. No, I'm talking about completely replacing a package with one from my own feed. More specifically, I'm looking to swap out hostapd with my own highly customized one. Customization would include modifying the package source version, setting custom build flags, enabling features that are disabled by default. Most of these things would require modifying the feed Makefile so a patch won't work.

Well, then you just modify your local copy of the package Makefiles and related files.

(If you want to keep also the original one in the same repo, you will likely run into dependency challenge, if you start renaming packages etc.)