serf: pass build variables

Fixes #21434.