twinkle: fix build (fixes #3673)

Pulled patches from Debian and hacked around linking errors.
I'm able to ring my mobile phone now.
However, on exit the process is stuck and needs kill -9.

CC: maintainer @MarcWeber.