Unless you are familiar with cross-compiling or debian chroot I would not recommend compiling yourself.
But: J. Dierkse kindly hosts TVH spk packages for Synology NAS on his homepage.
If you want to go that way, look up the Synology wiki / forums on how to add community sources.
Then add:
http://syno.dierkse.nl/
as community source in the package manager of your DSM.
Once you have done that, you will find two(!) TVHeadend packages there:
1) 4.0.x series, i.e. the latest "stable/beta". I think 4.0.5 is the most recent one on J. Dierkse's server.
2) 4.1.x series, i.e. the current master branch. 4.1.988 is most recent for now, but those get typically updated every weekend or every other weekend
What you might want to consider though, is that the current master branch (4.1.x) will probably turn into a new stable/beta 4.2.0 "soonish", so if your system is still working, I would probably wait for that and start over with a new clean install then.