Chain rule in Maxima



Is there a way to conduce Maxima to solve an application of the chain
rule to the composition of an abstract function and a concrete
function? E.g. I'd like 'g(x):=x^2$ diff(f(g(x)),x);' to produce
'(df/dg)(2x)'. Right now it only produces 'd(f(x^2))/dx'.

Using 'g(x):=x^2$ depends(f,g,g,x)$ diff(f,x);' kind of works. I get
'(df/dg)(dg/dx)', but I'd like 'dg/dx' to be solved.