Table of Content
Where to Discuss?

Preface

Goal: One Example Case of Ports

Table of Content


1: Issue

I need to leverage BSD knowledge from using binary pkg to source based ports using already installed GhostBSD, without installing FreeBSD.

Although I’m using GhostBSD. I’m sure this also works in TrueOS and Trident.

I hope that this example could help other BSD beginner like me, understanding the process of installing package using ports.

Example Candidate

I examined a few packages to be a candidate for an example case, from irssi, ncurse, ncdu, etc. After a while, I decided that ncmpcpp is suitable for this example.

  • ncmpcpp: It has many dependency, so I can do recursive config.

  • ncurses: I do not want to risk th system by delete a base package.

  • ncdu: No config dialog. to simple.

  • irssi: Already in other tutorial.

I decide to use ncmpcpp

Prerequisite

Almost all commands below require root privileges. You can either login as root or run each command using sudo.

Reading

Official documentation of FreeBSD:


2: Setting up Ports

Fresh install GhostBSD provide empty /usr/ports. We need to setup the directory using portsnap.

Portsnap

You only need to know two commands.

First thing first. Fill the directory.

$ portsnap fetch extract

Portsnap: fetch extract

And later

$ portsnap fetch update

Portsnap: fetch update

Now the ports directory is ready to be served.


3: Ncmpcpp Ports (Your Example Case)

Common Tutorial

Ncmpcpp ports lies on /usr/ports/audio/ncmpcpp directory. Most tutorial is usually ask to just go there, and run this command:

$ make install clean

As a beginner, I won’t argue the official documentation. The fact is, this is just an ordinary Makefile. The make command might sufficient to compile. However, we either need to make install or make package to build package.

Dependencies

But I rather have different approach for this example case. We need to know, how many config that we need to setup. It means, we need to know the dependency of the main package.

$ make all-depends-list

make: all-depends-list

Now we can see a bunch of package, that also required to be build.


4: Prepare

Config

make install will shown up config dialog if necessary.

If you want, you can reconfigure by showing up config dialog, before doing any compilation.

$ make config

make: config

Recursive Config

Config dialog that shown up after one compilation, to other compilation. The issue with this is, you have to wait for the compilation to be done.

The soultion is to cofigure all, before any compilation. You can achieve this with config-recursive.

$ make config-recursive

This will show you each dependency package that need to be configured. A lot of dialogs actually.

make: recursive: config: fftw3

make: recursive: config: gettext

make: recursive: config: libconv

make: recursive: config: ncurses

make: recursive: config: perl5

make: recursive: config: pkg

After this you can install all package, leave your computer with compilation jobs, while you are doing your other important task, such as chatting to friend or having a nap time.


5: Install Process

Installation process can be very long or very short depend of the package.

$ make install

This ncmpppc is a common case that typically show below process in sequence:

make: install: begin

make: install: check

make: install: compile

make: install: finished

You can also use only make package without install, if you want to build package without installing.

$ make package

6: Post Install

Uninstall

You can uninstall the package:

$ make deinstall

make: deinstall

Or you can install the package again.

$ make install

But this time, there is no need for any compilation.

make: install

Cleanup

As in most tutorial we need to clean up.

$ make clean

make: clean

Distfiles

Actually, there are more to be cleaned up. Consider have a look at this /usr/ports/distfiles/ directory:

/usr/ports/distfiles/

We can also clean this up with:

$ make distclean

make: distclean

After having a lot ports build. There usually many packages in this directory.


7: Run

At last time to run the application. This time using user privilege. Or quit from root login if you are using su.

$ ncmpcpp

ncmppcpp: running

Sounds in ncmpcpp works as charmed.


Conclusion

There are three things that amaze me with BSD. The ZFS, Jail, Ports. We have already discussed about ports here.

A little note about my motive.

The fact that installing and running GhostBSD, is as easy Ubuntu and Manjaro, is a little annoying. I always thought that BSD is as hard Gentoo Portage. All I think about is ports.

Since, I do not have time to switch from pkg to ports due to load of works, or even installing FreeBSD from the start. All I can do is try ports just for one case. One example. And I hope that this example could help other BSD beginner like me, understanding the process of installing package using ports.

Although I’m using GhostBSD. I’m sure this also works in TrueOS and Trident.

More Reading

Using ports in GhostBSD is fun, actually.

I just think I need to read this porters-handbook/ later. And this Less Known pkg(8) Features.

Finally

Thank you for reading.