Adding fixes and tweaks to make PHT compile on OpenELEC