The self-gravity problem is slightly tricky. The reason is that integrating the self-force for an infinitely thin ring (the obvious way of doing it) actually diverges!
Divergence of ring force
If we consider the gravitational force on the point $(R,0)$ of the ring along the x-axis, it is the integral $$F = \int_0^{2\pi} G\rho^2 \frac{R(1-\cos(\theta))}{(2R\sin(\theta/2))^{3}}d\theta.$$ Simplifying, and using an integral table or symbolic math program, gives: $$F=\frac{G\rho^2}{2R^2}\left[\ln\left(\frac{\sin(\theta/4)}{\cos(\theta/4)}\right)\right]_0^{2\pi}$$ ...which is divergent! The reason seems to be that as we consider the contribution of ever more nearby points their total force diverges as $1/\theta^2$ but the cosine of the angle decreases slower than $\theta^2$, so the contribution diverges.
Numerical method
Apparently we need to calculate the force as a proper triple integral, which is a chore and hard to do analytically. The basic approach would be to start with the potential of a thin ring (this does converge!) which is $$U(x,z)=\frac{GM}{\pi R}\sqrt{\frac{R}{x}m}K(m)$$ where $m=\frac{4xR}{(x+R)^2+z^2)}$ and $K(m)=\int_0^{\pi/2}\frac{dt}{\sqrt{1-m \sin^2 t}}$ is the complete elliptical integral of the first kind (assuming the ring has radius $R$, mass $M$). Now we can integrate this across the shape of the ring (whether a torus or a cylinder) and get a potential both inside and outside the shape. Once we have that, we can then take the radial derivative of the potential to calculate the force on each mass element, and get the total radial force along the section as $F=\int_S \frac{dU}{dx} dA$. One can also differentiate the ring potential first to get a force contribution and try to numerically integrate the forces, but the expressions are even more messy.
Here is what I get for a torus:
(The arrows show the gradient of the potential, the local gravitational force; the blue circle denotes the surface of the torus.)
Note how the outer part of the torus feels a force inwards towards the centre: since this region is slightly larger than the inner part that has an outward-directed force, it will produce a net inward force towards the symmetry axis that is the net self-gravity force. As the major radius increases the field will become more symmetric and the net force lesser: the self-gravity will mostly try to squeeze the torus into a thinner torus than try to reduce the major axis. For small major axis torii there will be a fairly significant force trying to deform them into an egg-shaped cross-section. The square cross-section case is somewhat similar.
So, how does the self-gravity force behave? If we keep the minor radius of the torus and the density constant and only increase the major radius we find that there is a size that has maximal inward force: as the torus gets larger there is more mass but the distance to the rest of the mass decreases faster and most self-gravity is inward towards the torus interior rather than the axis.
For a major radius of 1 AU and minor radius 1000 km I get a net force of $2.95\cdot 10^{15} \rho$ N per meter. So if we build the counterweight out of water ice and assume all force is projected straight in on the rotating part, I get a pressure of $1.47\cdot 10^{12}$ Pascal. Still, I wouldn't trust this result too firmly since there is a good chance that my numerics is off here.
Approximate internal potential
The paper linked above comes up with a quadratic approximation for the internal potential, $$U(\eta,\zeta)\approx\frac{GM}{2\pi R}\left [ c+a_1\eta+a_2\eta^2+b_2\zeta^2\right ]$$ where $\eta,\zeta$ are coordinates inside the cross-section treating it as a unit circle. $a_1=1+\ln(r/8R)$. If we take the derivative to get the force we get $F=-\frac{dU}{dx}=-\frac{dU}{d\eta}=-\frac{M}{2\pi R}(a_1+2a_2\eta)$. Integrating this to get the net force along one cross-section $$F_{net}=-\frac{GM}{2\pi R} \int_{-1}^1 \sqrt{1-\eta^2} (a_1+2a_2\eta) d\eta =$$ $$=-\frac{M}{12\pi R}\left[\sqrt{1-\eta^2}(3a_1\eta + 4a_2(\eta^2-1)) + 3a_1\sin^{-1}\eta \right]_{-1}^1=$$ $$=-\frac{GMa_1}{4 R}=-\frac{GM}{4R}\left(1+\ln\left(\frac{r}{8R}\right)\right).$$
This deviates from my numeric simulation a fair bit; I am not entirely sure I trust this. (Also, note that $M$ changes with $R$ as $M=2\pi^2Rr^2\rho$)
Virial approximation
Another approach, which is approximate but maybe more tractable is to use the virial theorem. It states that twice the average kinetic energy of a system is equal to the average potential energy: $2\langle T \rangle = -\langle U \rangle $. This does not always hold, but let us use this as a heuristic approximation.
First, ignoring self-gravity: if we have a rotating ring with mass $m_r$ and velocity $v$, and a static counterweight with mass $m_c$, then $T=(1/2)m_rv^2$ and $U=-GM(m_r+m_c)/R$. So $$m_c = \left(\frac{R v^2}{GM} - 1\right )m_r.$$
If we want a 1 G centripetal acceleration for $R=1$ AU we need $v=\sqrt{gR}\approx 1.21\cdot 10^6$ m/s, and get $m_c = 1,654 m_r$.
Adding a self-gravity potential gives $$m_c = \frac{\frac{R v^2}{GM} - 1}{\frac{RU_{self}}{GM}+1}m_r.$$
The bigger it is, the lighter the counterweight can to be. To halve the counterweight the self-gravity potential needs to be equal to the potential from the sun: unless the counterweight is very heavy it will not matter much for the ringworld. But that is likely expected.
In summary: stabilizing ringworlds by passive counterweights is a neat way of avoiding the need for super-strong materials. Instead you will pay in terms of raw material (but mere rock or ice works since it is only under compressive load) and ensuring a really low friction levitation of the moving ring against the counterweight. I suspect a lot of dynamic control will be needed to avoid instabilities in this configuration, but you would need them anyway for keeping the ringworld aligned with the sun.