I'm curious if it is possible to formulate cup products and prove that they exist in a general way which would subsume a lot of examples: e.g. group cohomology, sheaf cohomology for sheaves on topological spaces, quasicoherent sheaf cohomology, things like etale cohomology where we look at sheaves on more general sites, etc.
In the sources I've looked at (e.g. Cassels-Fröhlich, Lang's Topics in Cohomology of Groups), the existence of cup products is proven in terms of cochains, Čech cohomology, etc., even when more abstract definitions and uniqueness theorems are given.
What I'm looking for is something like this: Let $\mathscr{A}$ is an abelian category with a symmetric monoidal structure $\otimes$ such that $(\mathscr{A}, \otimes)$ satisfies certain conditions (e.g. enough injectives, existence of $\mathrm{Hom}$-objects, whatever other features are common in practice) and $\{H^i\}$ is a universal $\delta$ functor from $\mathscr{A}$ to another abelian symmetric monoidal category $\mathscr{B}$ (assuming whatever we want for $\mathscr{B}$, even $\mathscr{B} = \mathbf{Ab}$, the category of abelian groups). If $\phi \colon H^0(M) \otimes H^0(N) \rightarrow H^0(M \otimes N)$ is an additive bi-functor, then there is a unique sequence of additive bi-functors $\Phi^{p,q} \colon H^p(M) \otimes H^q(N) \rightarrow H^{p+q}(M \otimes N)$ such that:
- $$\Phi^{0,0} = \phi$$
- $\Phi$ is a "map of $\delta$-functors separately in $M$ and $N$": if \begin{equation}\tag{1} \label{s1} 0 \rightarrow{A'} \rightarrow A \rightarrow A'' \rightarrow 0 \end{equation} is an exact sequence in $\mathscr{A}$ with \begin{equation} \tag{2}\label{s2} 0 \rightarrow A' \otimes B \rightarrow A \otimes B \rightarrow A'' \otimes B \rightarrow 0 \end{equation} still exact, then $\Phi^{p +1 ,q} \circ (\delta_1 \otimes H^0(\mathrm{id}_B)) = \delta_2 \circ \Phi^{p+1, q}$. Here, $\delta_1 \colon H^p(A'') \rightarrow H^{p+1}(A')$ and $\delta_2 \colon H^p(A'' \otimes B) \rightarrow H^{p+1}(A' \otimes B)$ are the maps provided by the $\delta$-functor structure on $H$ via the sequences (\ref{s1}), (\ref{s2}). Similarly, if we swap the roles of $A$ and $B$, we require that $\Phi^{p +1 ,q} \circ (\delta_1 \otimes H^0(\mathrm{id}_B)) = (-1)^{p} (\delta_2 \circ \Phi^{p+1, q})$.
The answers to this question shed some light on this matter: Suppose we are in a setting where $H^0(M) = \mathrm{Hom}(O, M)$ for some object $O$ of $\mathscr{A}$ (e.g. group cohomology where we can take $O = \mathbf{Z}$, sheaf cohomology where we can take $O = \mathscr{O}_X$, etc.) Then $H^p(M) = \mathrm{Ext}^p(O, M)$, so we should get a pairing $H^p(O) \otimes H^p(O) \rightarrow H^{p+q}(O)$ induced by the 'composition' mapping $\mathrm{Hom}(O, O) \otimes \mathrm{Hom}(O, O) \rightarrow \mathrm{Hom}(O,O)$. I'm not sure exactly how to prove this part in general either, but I've at least seen it discussed in terms of classes of extensions of modules (I'm not sure how generally the result that $\mathrm{Ext}$ describes extension classes holds). This also doesn't allow general group objects, and I'm not sure how to do the extension.
The above question also discusses a more homotopical/$\infty$-categorical way to think about cup products, but I'm not familiar enough in that language to really get what's going on: I'd much prefer an argument working in ordinary abelian categories.