You should have mentioned the OS you're using. Presumably it's Solaris.
Sun has a very good set of documentation on its packaging system in the online docs at sun.com, so the best thing to do is RTFM. A package can be created with an install script that does an untar.
However, in a way, a pkg file is itself a sort of "tar", so you're actually not going to gain a lot by doing that. It would be easier to untar the file before building the package and supply the untar'ed directories to the package builder. That way you'll save yourself the trouble of working up an installer script and the package manager can more cleanly remove the package if you ever need to.
An IDE is no substitute for an Intelligent Developer.
I created a prototype file and a pkginfo file and added i pkginfo=./pkginfo to the prototype file.
and when I'm trying to execute pkgmk -r 'pwd'
It shows error for like no object found though the file is there and not taking any path which has a whitespace in it or any file with whitespace in the name.
how to avoid this. I cant change the paths or file names.