Utils::InreplaceError exception when building from source

I just tried to build glib from source. But:

$ brew reinstall --build-from-source glib
...
==> meson --prefix=/usr/local/Cellar/glib/2.64.1 -Diconv=auto -Dgio_module_dir=/usr/local/lib/gio/modules -Dbsymbolic_functions=false -Ddtrace=false ..
==> ninja -v
==> ninja install -v
Error: An exception occurred within a child process:
  Utils::InreplaceError: inreplace failed
/usr/local/Cellar/glib/2.64.1/lib/pkgconfig/glib-2.0.pc:
  expected replacement of "Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include" with "Cflags: -I${includedir}/glib-2.0 -I${libdir}/glib-2.0/include -I/usr/local/opt/gettext/include"

What is going wrong here? This isn’t a modified formula or anything. Just the vanilla one from homebrew-core.

This is on macOS 10.13.

I’ve seen this in other pull requests, it’s possibly a faulty meson update.

Is there something I can do about it? I was told that I have to submit a PR:

But if I can’t build it, I don’t know how to proceed :-/

https://github.com/Homebrew/homebrew-core/pull/52369 someone already made a PR to fix it. I guess you’ll have to wait for that to be merged.