# Creating binary packages without installing



## Shivam Shukla (Feb 22, 2016)

I am experienced in creating packages on Debian machines. There one can create binary packages but on freebsd FreeBSD things are different. In FreeBSD I need to have ports installed first and then I can build binary packages from that.

My package contains a simple compiled program and 2-3 configuration files and I am searching to straight away build binary packages without building ports and then installing them and then building binary from that.

I found few articles related to something called manifest file. But nothing yet at my level of understanding on FreeBSD packaging.

In nutshell I am dumb on FreeBSD packaging and would need some guidance.
Thanks


----------



## uzsolt (Feb 22, 2016)

I think you want to read Porter's Handbook.
If you've any question ask it!


----------



## kpa (Feb 22, 2016)

Binary packages are result of ports building, you can not skip the building part. You can use `make package` on a port in the port directory, the port will be built and a package file created but won't be installed on the system. For example:

`# make -C /usr/ports/devel/pcre package`

After the build has finished the built package can be found at /usr/ports/packages.


----------



## tobik@ (Feb 22, 2016)

I'm assuming we're talking about creating a single package only. If you need to build more packages look into using ports-mgmt/poudriere or ports-mgmt/synth.

The most straightforward way I know of:

Create a port. See the Porter's Handbook if you need help: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/
Run `make package` in the port (this creates a package but does not install it)
The package should now be in work/pkg/


----------



## Shivam Shukla (Feb 22, 2016)

Yeah I am talking about creating a single package.

Also I read at many places about manifest file. I do not know in detail but it looks like control file on Debian.

Also can anyone explain me what http://lastsummer.de/creating-custom-packages-on-freebsd/ and https://blog.des.no/2013/08/creating-pkgng-packages-without-ports/ is trying to talk about. Here as far as my understanding they are claiming to create custom packages without ports.

Please correct me if I am going in wrong direction.


----------



## uzsolt (Feb 22, 2016)

I think to create a port is simpler (and faster) than the ugly workarounds and hacks 
See Quick Porting.


----------



## kpa (Feb 22, 2016)

Shivam Shukla said:


> Also can anyone explain me what http://lastsummer.de/creating-custom-packages-on-freebsd/ and https://blog.des.no/2013/08/creating-pkgng-packages-without-ports/ is trying to talk about. Here as far as my understanding they are claiming to create custom packages without ports.



You can ignore those for now, they are a very advanced work in progress way of creating pkg packages under very specific circumstances that don't apply to general porting for FreeBSD. With the ports(7) system you get all the manifests etc files automatically created by the system and you don't have to worry about them.


----------



## Shivam Shukla (Feb 22, 2016)

Thanks everyone. At present i I am following this approach :-

1) Create ports using quick porting
2) I will create package using make package way after that

I will post here again if i I will face any issue. Thanks for such quick help


----------



## free-and-bsd (Feb 25, 2016)

kpa said:


> You can ignore those for now, they are a very advanced work in progress way of creating pkg packages under very specific circumstances that don't apply to general porting for FreeBSD. With the ports(7) system you get all the manifests etc files automatically created by the system and you don't have to worry about them.


From the `pkg help create` man page I can see a full description of what is accomplished by the authors of those blogs. But still I have one question as to pkgng functionality: from the man pages it seems that listing the files to be included into a package (via plist or MANIFEST) is optional. The same I find in the porter's handbook. Am I to assume that pkg actually makes its own accounting of the files included in the package upon the creation of the package?


----------



## Daniel McRobb (Apr 26, 2016)

No.  'pkg create' run standalone will not automatically include any files from the metadatadir.  You can see this if you put a skeletal +MANIFEST in your metadatadir and then run pkg create.

You need a 'files: {}' section in your +MANIFEST (or a plist, but I prefer to generate just one file that has everything).


----------

