  We use the Monte Carlo particle physics code FLUKA (Fluktuierende Kaskade) to
calculate $\gamma$-ray spectra expected from solar flare energetic ion
distributions. The FLUKA code includes robust physics-based models for
electromagnetic, hadronic and nuclear interactions, sufficiently detailed for
it to be a useful tool for calculating nuclear de-excitation, positron
annihilation and neutron capture line fluxes and shapes, as well as $\approx \;
{\rm GeV}$ continuum radiation from pion decay products. We show nuclear
de-excitation $\gamma$-ray line model spectra from a range of assumed primary
accelerated ion distributions and find them to be in good agreement with those
found using the code of Murphy et al. (2009). We also show full $\gamma$-ray
model spectra which exhibit all the typical structures of $\gamma$-ray spectra
observed in solar flares. From these model spectra we build templates which are
incorporated into the software package Objective Spectral Executive (OSPEX) and
used to fit the combined Fermi Gamma-ray Burst Monitor (GBM)/Large Area
Telescope (LAT) spectrum of the 2010 June 12 solar flare, providing a
statistically acceptable result. To the best of our knowledge, the fit carried
out with the FLUKA templates for the full $\gamma$-ray spectrum can be regarded
as the first attempt to use a single code to implement a self-consistent
treatment of the several spectral components in the photon energy range from
$\approx 100$s ${\rm keV}$ to $\approx 100$s ${\rm MeV}$.
