gi: support auto patch apply for native build