We need to build Mac packages on the fly and it would be convenient if there is a way to create the same on Windows or Linux platform instead of using PackageMaker on Mac.
Nope, you can't. You could do a scripted ssh login and fire it off using osascript so you can automate the whole build from somewhere else, but you can only build for a Mac on a Mac.
You could do all the builds on a Mac, though. It's much easier that way around.
I don't agree that this is impossible. You could certainly do all the things PackageMaker does on OSX on another OS. It's just a matter of creating these files:
Contents/
Archive.bom
Archive.pax.gz
Info.plist
PkgInfo
Resources/
TokenDefinitions.plist
package_version
en.lproj/
Description.plist
The .plist files can easily be created in Python with plistlib which is now standard in Python. The .bom and .pax.gz are a bit trickier but the rest are all text files.
The .gz part of the .pax.gz file means it is compressed with gzip. This is available on Windows and Linux.
According to the pax man page a pax file can actually be in several different archive formats including cpio and tar, also easy to do in Linux or Windows. PackageMaker seems to create compressed cpio files, at least on 10.6.
The .bom file is a list of all the files in the package and their sizes. It is probably the hardest part to create outside of OSX. BOM stands for Bill Of Materials and comes from the NextSTEP operating system. I haven't been able to find much information about the BOM format but here are some clues: NextSTEP bom man page, OSX bom man page
Edit: I've now implemented a version of lsbom which I've placed in the public domain. The code can be found in Subversion here: https://cauldrondevelopment.com/svn/osxbom/trunk
Perhaps someone can also implement mkbom and then there will be a complete solution. See the header file bom.h in the above code for a somewhat complete description of the BOM file format.
Edit 2: A working version of mkbom has now been implemented and can be found here: https://github.com/hogliux/bomutils
along with a detailed tutorial on how to create an installer on linux: http://hogliux.github.io/bomutils/tutorial.html
Also see the question how-to-build-native-mac-os-x-installer-on-a-non-mac-platform.