Let's say you want to use a 3rd party or your own patch for Apache, Exim, etc before to compile a software by custombuild script on a Directadmin server and here is a way for you to go.
For example, if you'd like to patch apache with your own patch, run the following code:
cd /usr/local/directadmin/custombuild mkdir -p custom/ap2 cp -p configure/ap2/configure.apache custom/ap2/configure.apache mkdir patches/custom/
Save your patch into /usr/local/directadmin/custombuild/patches/custom/apache.patch
vi /usr/local/directadmin/custombuild/patches/custom/apache.patch
Now edit custom/ap2/configure.apache and add the following before "./configure":
patch="/usr/local/directadmin/custombuild/patches/custom/apache.patch"; if [ -f ${patch} ]; then patch -p1 < ${patch}; fi;
That's it. Every time you build apache, your own patch will get applied.
P.S. Thanks to smtalk for this idea.