Installing to a home folder using a pkg I'm attempting to create a package using Packages that installs in ~/Applications (because each user can have an instance of the app in question running but it needs a custom port per user as it daemonises and runs like an HTTP server).

I can't work out how this is done. In the Payload section I can only pick from /Applications, /Library and /Users/Shared. I've tried adding a custom folder but without knowing the username ahead of time I don't know what to put in the prompt.

I could use a shell script in the Scripts tab (part of the install requires that anyway), but I'm unclear as to where the binary for the app should be put (I could place it in one of the above paths and then move it but I don't wish to spread build artefacts around the user's system, even for clean builds), or how to refer to its initial location in the script, whether it's via the Payload tab or the Additional Resources section under Scripts.

I'm happy to use a different tool or directly edit scripts (back to the old days;-) any help or insight would be much appreciated.
pkgbuild and productbuild

Try building the package using the newer pkgbuild tool. You can pass --install-location &lt;install-path&gt; as part of the command.

You may also find productbuild useful to know about.

Both tools have detailed manual pages and can handle installation in script determined locations.