Patching a Package Makfile?

I need to update the LuaJIT package. Specifically, I need to alter the OPENWRT Makefile for the package to allow for mips64 support. I've created a patch to do this, but is there a place to keep it that automatically is run prior to the make menuconfig? Obviously, the feeds/packages/lang/luajit/patches is there, but it is called and applied during the compile itself.

Below is the patch file

-- Makefile
+++ Makefile
@@ -24,14 +24,14 @@
  CATEGORY:=Languages
  TITLE:=LuaJIT
  URL:=https://www.luajit.org
- DEPENDS:=@(i386||x86_64||arm||armeb||aarch64||powerpc||mips||mipsel)
+ DEPENDS:=@(i386||x86_64||arm||armeb||aarch64||powerpc||mips||mipsel||mips64)
 endef
 
 define Package/luajit/description
  LuaJIT is a Just-In-Time (JIT) compiler for the Lua programming language. *** Requires GCC Multilib on host system to build! ***
 endef
 
-ifeq ($(HOST_ARCH),x86_64)
+ifeq ($(HOST_ARCH),$(filter $(HOST_ARCH),x86_64 mips64))
   ifeq ($(CONFIG_ARCH_64BIT),)
     HOST_BITS := -m32
   endif

The Makefile can't be patched by the patches folders of packages.

If you patch it manually, it should be there until you update the feeds.

Why not adding it permanent with a github pr to the according Makefile at the openwrt packages repo?

Or you can also open an issue there and ask a maintainer to do it.

In general, if you want to patch feeds, then clone the repos for those feeds onto your local drive and update feeds.conf to point to these instead of to the remote repos. Something like this:

src-git packages file:///opt/openwrt/feeds/packages;openwrt-19.07
src-git luci file:///opt/openwrt/feeds/luci;openwrt-19.07
src-git routing file:///opt/openwrt/feeds/routing;openwrt-19.07
src-git telephony file:///opt/openwrt/feeds/telephony;openwrt-19.07

This is a better solution, as if you do it this way then you can also fetch and merge upstream changes with your custom repo.