with makepkg
you can edit the PKGBUILD before it is run
with an AUR helper
like yay (don’t know about pamac)
you are asked whether you want to edit the PKGBUILD
before the compilation starts
If you need to recompile/update
you’ll have to make your changes to the recipe (the PKGBUILD) again
every time you up the package to a newer version or when it needs to be rebuilt because of changes in the underlying system
(libraries change … new versions of packages that where present when your custom package was built …)