First law and Smarr formula of black hole mechanics in nonlinear gauge theories