Solved [Solved]Offline compilation of ports

c083d4

Member

Reaction score: 1
Messages: 87

Hi. I'd like to know: If I run make inside a port folder, could I then move the port folder to another computer with the same version of FreeBSD and just run make install to install it?
 

worldi

Active Member

Reaction score: 23
Messages: 189

Re: Offline compilation of ports

Well, the installation should work in any case. But since the real question is probably whether the port itself will work the answer is "It depends".

If both machines use the same hardware architecture (e.g. both are amd64) it might work. It will not work if both use the same architecture but different CPUs and you have enabled CPU-specific optimization (either via the port's options or via /etc/make.conf).
 

Carpetsmoker

Daemon

Reaction score: 189
Messages: 1,012

Re: Offline compilation of ports

You can use make fetch-recursive to fetch all the distfiles from teh interwebz, these will be placed in /usr/ports/distfiles, you can copy this directory to another machine, and that machine won't need an internet connection to install ports.

Moving the work directory is possible, I suppose, but unless you're *very* careful & know exactly what you're doing. you'll run into problems.
 

ShelLuser

Son of Beastie

Reaction score: 2,123
Messages: 3,797

Re: Offline compilation of ports

There is an even easier option. Don't forget that once you've build a port you basically created a package which then gets installed on the system. These packages are normally placed in the /usr/ports/packages folder.

So if you want to provide other environments with an easier way to install the same software then all you'd need to do is give them access to this packages folder.

Basically; instead of running # make in a ports directory you'd be running # make package instead, this will tell the system to build a binary package. Personally I'd look into ports-mgmt/portmaster to handle all that.

Then on the new environment you'd either use pkg_add or pkg to install the created software package.
 
OP
c083d4

c083d4

Member

Reaction score: 1
Messages: 87

Re: Offline compilation of ports

Thank you very much!!
 

ajzimme

New Member

Reaction score: 2
Messages: 8

It appears running make package doesn’t put anything at all in /usr/ports/packages for me. Nor do I find anything when scanning entire drive. Furthermore, running make fetch-recursive works but what then? No one has addressed that. Am I supposed to manually go into each package and make install on the offline box? When I go into the port on the offline box it still tries to use the internet to download packages, even though distfiles is populated.
So the pkg install method doesn’t work offline with distfiles, make install doesn’t work with it.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,106
Messages: 39,696

It appears running make package doesn’t put anything at all in /usr/ports/packages for me.
It's saved in the port's work/ directory. Please take note that you're looking at 7 year old information here, things tend to change over time.

Am I supposed to manually go into each package and make install on the offline box?
Please learn the difference between a port and a package. A package is a pre-built port. Ports are built, packages are installed.

When I go into the port on the offline box it still tries to use the internet to download packages, even though distfiles is populated.
Then you likely don't have the correct version in your /usr/ports/distfiles. The distfiles are only downloaded if they don't exist in /usr/ports/distfiles.

So the pkg install method doesn’t work offline with distfiles, make install doesn’t work with it.
Again, don't confuse packages and ports, packages are installed with pkg(8), ports are built from /usr/ports/. Distfiles are the original source distributions and are used by a port to build that particular piece of software. Distfiles are not packages.
 
Top