read about installation of OpenFOAM-dev from Source Repository
patch requires commit 85f043040b169bf0510f4408066387d343c25502
clone repository and checkout commit
git clone https://github.com/OpenFOAM/OpenFOAM-dev.git
cd OpenFOAM-dev
git checkout 85f043040b169bf0510f4408066387d343c25502
copy patch to OpenFOAM-dev and apply the patches
git am *.patch
proceed with OpenFOAM installation instructions