Integrating FEniCS solution up to some point

As a part of a bigger problem there is a first order equation u'(x) = f(x) on [0,1] coupled with integration condition \int_{[0,1]}u(x)dx = 1 which has to be solved in every step. RHS f is a solution of some other equation. This equation can be solved by pure integration but question is how to do that in FEniCS.

As far as I know we can integrate on a whole domain or on subdomains but how can we say something like u(x)=\int_0^xf(s)ds?

Pick points from mesh, define step functions and then integrate product f\cdot\text{step} and later interpolate to starting function space?

Do you maybe know some tutorial about similar problem?