  We compute the perturbative component of the fragmentation function of the
$b$ quark to the best of the present theoretical knowledge. The fixed-order
calculation to order $\alpha_s^2$ of the fragmentation function at the initial
scale is matched with soft-emission logarithm resummation to
next-to-next-to-leading logarithmic accuracy, so that order-$\alpha_s^2$
corrections are accounted for exactly, and logarithmically enhanced
contributions from loops of $b$ quarks are included. This requires the
calculation of the Mellin transform of the order-$\alpha_s^2$ result in the
whole complex plane for the Mellin variable, which we provide for the first
time for all the fragmenting partons. Evolution is performed to next-to-next-
to-leading log accuracy, and mixing with the gluon fragmentation function is
taken into account. The perturbative fragmentation functions are made available
via LHAPDF grids.
