# General packaging question



## justinb (Sep 26, 2010)

OK, I'm sure this is a noob question, but here goes anyway. I have an application, call it foo-5.7 and I have it packaged as foo-5.7.tbz such that if it were untarred from / it'd install what it needs. What I'd like is to create an actual package out of it so I can distribute it. So far I've read a lot of "make a port" responses to general questions, but this seems such a trivial task it would seem that there's a way to just create a package from the tbz (or from the untarred tree, which contains etc and usr directories). Any pointers would be appreciated.


----------



## wblock@ (Sep 26, 2010)

A package is the result of building a port.  It's not just the files, but the package information like where files have been installed so the package can be uninstalled without leaving stray files.  The way you make a package is just 'make package' in the directory of that port, so you really need the port first.  The Porter's Handbook shows both the quick and slow ways to make a port.  If it's something you've written, it should be easy to port.


----------



## justinb (Sep 26, 2010)

wblock said:
			
		

> A package is the result of building a port.  It's not just the files, but the package information like where files have been installed so the package can be uninstalled without leaving stray files.  The way you make a package is just 'make package' in the directory of that port, so you really need the port first.  The Porter's Handbook shows both the quick and slow ways to make a port.  If it's something you've written, it should be easy to port.



Thanks. Seems to me, though, that I could simply do this:


```
cd foo-5.7 && find etc usr > flist && tar -cjf foo-5.7.tbz etc usr
pkg_create -p `pwd` -d foo-5.7.tbz -c foo-5.7.tbz -f flist foo-5.7.tbz
```

What's wrong with that approach?


----------



## gordon@ (Sep 26, 2010)

Personally, I find a proper Makefile (which takes about 5-10 minutes to properly author) is better in the long run. I like just typing make package and being done with it. That way when you come back 6 months later, you don't have to try to figure out the magic incantations to create the package.


----------



## wblock@ (Sep 26, 2010)

justinb said:
			
		

> Thanks. Seems to me, though, that I could simply do this:
> 
> 
> ```
> ...



-d and -c look wrong, but that's fixable.  Try it.  My feeling is that this is one of those quick hacks to save time that actually end up being more work and taking longer, but maybe not.


----------



## phoenix (Sep 26, 2010)

In the long run, especially if there are any dependencies involved, using the ports tree is the best bet.  Binary packages are based off ports.


----------

