Solved Where does "make package" put the .pkg file?

Hello Forum,
Help me out with this please! On recent releases of FreeBSD (say 12.1-Release), when I do a make package in a ports directory then where do I find the resulting .pkg file? I used to find these together with the packages I downloaded, but now I am unable to locate any package file (regardless of having been downloaded or built).
Do package files now go somewhere under /var/db/pkg? Likely inside one of those .sqlite files? If so, how do I get one particular .pkg file out of there, so that I can copy that to an USB drive, take over to another FreeBSD machine and install that with pkg add the_file_I_just_brought_over.pkg.
 
In the port directory:
make -V WRKDIR
cd in tthe result of previous command
there will be portname.txz file.

More precisely, inside the WRKDIR there is a pkg directory, and the package file is inside that. In my case, ./work/pkg/portname-version.txz.
Thanks for the update! This was very helpful. I was not aware that packages now have a txz extension. Last time I did this was with the old pkg system, at the time packages were gzipped tgz archives, now we obviously use xzipped txz packages. An important change to recognise.
Now I understand why even a find . -name "*.tgz" -type f -ls in the port's directory returned nothing.
 
To save time, instead of picking each build package from it's ../work/pkg directory, you can define a directory to centralize the build packages, so you don't need to dig in work directories.

One way is to create a /usr/ports/packages directory. If that directory exists a copy of the package, besides the one in the work directory, will be placed under /usr/ports/packages/All.

Or you can define a directory of your choosing in /etc/make.conf ( mine is /var/cache/pkg.ports). Detailed info in ports(7), TARGETS package, and ENVIRONMENT PACKAGES, PKGREPOSITORY.

Note: If you ever have the need to create a package of a already installed port, that's simple resolvable, without building a package from ports, use pkg-create(8) ( or pkg help create)
 
To follow up the though, creating packages from installed ports with pkg-create(8), to catch all the run dependencie and dependencies of those dependencies of one specific port, assuming all installed ports are up to date to the ports tree, change into the specific ports directory, run make pretty-print-run-depends-list > <pkgname>-list, edit <pkgname>-list, remove This port requires package(s) ", and at the end " to run. , add ports name to that list, no version number needed, execute pkg create -o /USB_drive `cat <pkgname>-list`
 
Very useful hints.
I don't build software from the ports often. But when I do, the above saves me a lot of time and effort.
 
Back
Top