How to create installable app with setuid bit set owned by root
This is just the task suite to a shell script to be packaged with your installer package.  

Just package all your files as you do and then review this script only package. Since there are no files, all the steps in this guide will show you how to craft the post install script. 


https://derflounder.wordpress.com/2012/08/15/creating-payload-free-packages-with-pkgbuild/
http://macinstallers.blogspot.com/2012/07/scripting-in-installer-packages.html
Configure the OS X Server from .pkg postinstall script


The first guide is the densest, so read it and then hit up the next links, then return to the first for when you’re ready to use pkgbuild tool to install and script.