Install a program from source without fetching entire ports tree

Hello, i want to install a program from source without fetching entire ports tree, for example, as we know, I can search for the existence of a program for example:

Code:
pkg search ufetch

and install it with:

Code:
pkg install ufetch

I want to download / modify / compile / install only that program from FreeBSD source ports without fetching all ports source tree.
 
You might (?) be able to check it out from the Subversion repository, but unless it's a very simple port with no build or run-time dependencies you are likely to have to find & download each dependency as well.
 
With net/svnup, you can choose which category directories you want to download by its configuration file in /etc/local/etc/svnup.conf. However, this will take more time, especially if it has a lot of dependencies which span many categories.

There is a way to do this with portsnap too through its configuration file, but portsnap is being phased out.

Use ports-mgmt/psearch to find ports.
 
The ports tree is just a bunch of Makefiles (and patches, and scripts..).

You might get away with downloading the Makefile and pkg-descr, then do make makesum and make install.
 
There are a few ports without dependencies, e.g. shell scripts. Some are even self-contained in the ports tree (no external files to download (MASTER_SITES=<empty>) & not available via official packages). For ports that are compiled, direct build on the host is not recommended. Use ports-mgmt/synth or ports-mgmt/poudriere to build jailed. Unless you want to change some port's knobs from the defaults, there's no reason to choose ports (build yourself) over packages. If the port you want to build has dependencies, these dependencies have dependencies themselves, etc.pp. ... Thus, you're better off downloading the ports tree; it's ~ 1GB text files, so if space is a concern: it compresses well.
 
I want to download / modify / compile / install only that program from FreeBSD source ports without fetching all ports source tree.

You can do that. sysutils/ufetch is a simple program having only ports-mgmt/pkg as build dependency.

But you need to meet three conditions. ufetch is seeking /usr/ports/Templates/BSD.local.dist, /usr/ports/Mk/bsd.ports.mk and /usr/ports/distfiles. You should have the distfile directory created, and the other directories checked out with svn(lite) before building ufetch. You can also override the /usr/ports directory with PORTSDIR ( ports(7) ) if you prefer the ports directory in a users home directory.

If something is unknown to you in my explanation, please don't hesitate to ask.
 
This would be somewhat equivalent:

Code:
cd /tmp
svnlite co https://svn.freebsd.org/ports/head/sysutils/ufetch
cd ufetch
make fetch
make extract
cd work/ufetch-*
 
Compiling different programs in context an operating system, and at the same keep track of all dependencies, versioning and possible connflicts is not a trivial task. That's why there're large number of BSD-based OS and Linux distro, but only a few number of package managers, such as FreeBSD port system, apt, pacman, etc.
 
You can do that. sysutils/ufetch is a simple program having only ports-mgmt/pkg as build dependency.

But you need to meet three conditions. ufetch is seeking /usr/ports/Templates/BSD.local.dist, /usr/ports/Mk/bsd.ports.mk and /usr/ports/distfiles. You should have the distfile directory created, and the other directories checked out with svn(lite) before building ufetch. You can also override the /usr/ports directory with PORTSDIR ( ports(7) ) if you prefer the ports directory in a users home directory.

If something is unknown to you in my explanation, please don't hesitate to ask.



Thanks for the answers, I'm reading and testing the variants that you suggest, could you indicate me how to make the svnlite check out of the file /usr/ports/Templates/BSD.local.dist and the file /usr/ports/Mk/bsd.ports.mk? because it would be the basic requirement to apply the step that SirDice indicates because without it an error appears trying to locate those files.

A random example with tty-clock
Code:
make fetch
make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
make: Fatal errors encountered -- cannot continue
make: stopped in /tmp/tty-clock
 
You can't check out files individually, only directories. For Templates and Mk please execute:
Code:
svnlite co https://svn.freebsd.org/ports/head/Templates /usr/ports/Templates
svnlite co https://svn.freebsd.org/ports/head/Mk /usr/ports/Mk

It Works. ?

However, it seems that with more complex software it will be necessary to have the ports tree downloaded. So it is better to have space and a good partitioning plan to have the resources to compile from the sources. The scenario would be for small boxes or limited resources. With minimal tty and/or Xorg based applications this does work. Thanks a lot to all of you for helping me. ??
 
Back
Top