Add TO_PORT.
Hand-apply ce1c03bfd420c537105525d65f0ce28deb9d0bb5 from master; fix hidden content appearing (#418).
Fix previous.
Hand-apply e7fe121fedc6d837c5bc8ab31e4b36c50497c4cd; allow build of Windows debug version using gdb.