We use dpatch for patch handling inside our package(s). Please see /usr/share/doc/dpatch/README.source.gz (if you have installed dpatch) for documentation about dpatch.