# How create binary from ports?



## Spity (Jan 7, 2021)

I installed librsvg2 -2.50 from ports. How can I create a binary and use it in a clean install and not wait 2 hours for compilation?


----------



## SirDice (Jan 7, 2021)

Use ports-mgmt/poudriere or ports-mgmt/synth to build packages. Or for simple one-offs you could use `make package`. See ports(7).


----------



## Spity (Jan 7, 2021)

and how do I install the file generated with make package?


----------



## SirDice (Jan 7, 2021)

Read ports(7):

```
package	      Make a binary package for	the port.  The port will be
		      installed	if it has not already been.  The package is a
		      .tbz file	that you can use to install the	port on	other
		      machines with pkg-add(8).	 If the	directory specified by
		      PACKAGES does not	exist, the package will	be put into
		      the current directory.  See PKGREPOSITORY	and PKGFILE.
```


----------



## Minbari (Jan 7, 2021)

```
# make package  - to create a package from a port
# cd /work/pkg
# pkg add pkg_name
# cd ../.. && make clean
```


----------



## scottro (Jan 7, 2021)

I don't even think you have to change to the port directory. I usually make a package of a working drm before upgrading, and I do it from my home directory. But I use pkg create, rather than make package.  There may be advantages to make package that I don't know about, as I just use it with dwm as I have a custom configuration that I want to keep. 

For various options and such you can look at `pkg help create`


----------



## Spity (Jan 7, 2021)

I am new to FreeBSD, I come from Gentoo. I am a bit lost. So any help is welcome.  The gnome 3 icons are giving me trouble.


----------



## SirDice (Jan 7, 2021)

scottro said:


> But I use pkg create, rather than make package.


`make package` actually runs pkg-create(8) to create the package.


----------



## SirDice (Jan 7, 2021)

Spity said:


> I am new to FreeBSD, I come from Gentoo. I am a bit lost. So any help is welcome. The gnome 3 icons are giving me trouble.


Unless you change one of the options of the port (or its dependencies) there's really no reason to build things from ports. If there's an issue with a package it's usually because that issue is in the port too. And more often than not, the issues are caused by bugs in the original sources. Packages are always built from ports, even the packages from the official repositories (that's what the build servers do, all day long: https://pkg-status.freebsd.org/). The only difference is that the official packages are always built with the port's default options set.

There is a difference between quarterly and latest packages. The RELEASE versions are set to use the quarterly packages by default. The quarterly branches are branched off from HEAD aka 'latest' once every three months. In those three month periods the quarterly branch only gets security or stability updates. HEAD or 'latest' is continuously updated and changed. Everything is updated on a daily basis.

If you want to switch your packages to latest, create a /usr/local/etc/pkg/repos/FreeBSD.conf:

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}
```

Some people (like me) build and use their own package repositories. You can easily do this with ports-mgmt/poudriere (also used on the FreeBSD build servers) or ports-mgmt/synth (used by DragonFlyBSD). This has several advantages at the cost of a lot of time and resources. But you get to set all your own default settings (different default MySQL or PHP version for example) and options. The official package servers build quite fast but the repositories are always going to be a bit "behind" on the ports tree. Changes or updates are going to happen in the ports tree first, so you get the updates as fast as your local system can build them and you're not dependent on the schedule (or availability) of the official repositories.


----------

