Statics and dynamics of infinite-dimensional liquids and glasses: a parallel and compact derivation