The stack.sh script can indeed be modified to process RAW files.
Concerning the fading light, I think it would be possible to make a two-step stacking, where the first step is used to analyse the images, compute the individual histogram and then guess the optimal exposure factor to align all histograms together. Maybe somebody knows about some documented technique to do this?