I wanted to see how pkgsrc works on aarch64 Linux Manjaro since it is a very mature framework that is very portable and supported by many architectures – pkgsrc (package source) is a package management system for Unix-like operating systems. It was forked from the FreeBSD ports collection in 1997 as the primary package management system for NetBSD.
Full pkgsrc package index is available for browsing here https://www.pkgsrc.se/
One might question why use pkgsrc on Arch based Manjaro, since the pacman package repository is very good on its own. I see alternative pkgsrc as a good automated build framework that offers a way to produce independent build environment /usr/pkg that does not interfere with the current Linux distribution in any way (all libraries are statically built)
I have used the latest Manjaro for Pinebookpro and standard recommended tools as mentioned here https://wiki.netbsd.org/pkgsrc/how_to_use_pkgsrc_on_linux/
- gcc (and libstdc++) (pacman -S base-devel)
- ncurses (pacman -S ncurses)
- zlib (pacman -S zlib)
- openssl (pacman -S openssl)
Next we make sure we have at least 10 GB of disk space (i have used 20 GB for pkgsrc) to place the pkgsrc environment.
We have a choice to use either the stable quarterly branches of pkgsrc or the bleeding edge (current) which contains the latest pieces of software, but can be unstable in certain situations and times of sync. If one decides to experiment with the current, like me, you can always get help from the wonderful NetBSD/pkgsrc community on their mailing lists https://www.netbsd.org/mailinglists/
Downloading pkgsrc-current
# cd /usr # ftp ftp.netbsd.org login as anonymous (ftp) ftp> pass (I need to enter passive because of my network) ftp> cd pub ftp> cd current ftp> get pkgsrc.tar.xz After it downloads, exit FTP session ftp> exit # unxz pkgsrc.tar.xz # tar -xvf pkgsrc.tar After if finishes extracting we can delete pkgsrc.tar # rm pkgsrc.tar
Next we will bootsrap pkgsrc on our Manjaro Linux aarch64 so that we can start building packages
# cd /usr/pkgsrc/bootstrap # ./bootstrap
This will take about 10 minutes to finish, and once done we are almost ready to start building packages. There will be a new system independent environment created by default in /usr/pkg (if once wishes to change the location and customize, one can do so by reading the pkgsrc documentation) The pkg directory structure is as follows
/usr/pkg/bin /usr/pkg/etc /usr/pkg/include /usr/pkg/info /usr/pkg/lib /usr/pkg/libexec /usr/pkg/man /usr/pkg/pkgdb /usr/pkg/pkgdb.refcount /usr/pkg/sbin /usr/pkg/share
All the pkg executable binaries are stored in /usr/pkg/bin and this should be taken into an account if setting up a new binary executable paths.
There is a caveat in Linux Manjaro aarch64 pkgsrc build which results on the dreaded message during certain packages builds (readline, gettext-tools,python … and others)
[builds should fail with compiler cannot create executables]
In order to fix this on Manjaro aarch64 I have edited the following file in /usr/pkgsrc
/usr/pkgsrc/mk/termcap.builtin.mk
And replaced all BUILTIN_LIBNAME.termcap= values with curses Diff and the modified file is available here http://45.76.81.249/pkgsrc/aarch64-linux/
Now we are ready to build pkgsrc packages on the Manjaro aarch64 Pinebook ! Packages are normally built like this
# cd /usr/pkgsrc/security/bcrypt # /usr/pkg/bin/bmake install clean clean-depends Once the build finishes the gzipped package tarball will land in /usr/pkgsrc/packages/All and the binaries will get installed to # /usr/pkg/bin/bcrypt
It is advisable to read the full pkgsrc documentation before running this
As of writing I have managed to successfully compiled a few packages and uploaded them here http://45.76.81.249/pkgsrc/aarch64-linux/All I will update this with more packages if anybody wants to experiment.
My first test was to see if Doom3 (pkgsrc/games/dhewm3) builds and runs on Manjaro aarch64 , and it does (although its not usgin the panfrost drivers for now)
Binary packages can be installed as follows https://www.netbsd.org/docs/pkgsrc/using.html#installing-binary-packages
Installing binary packages
In the directory from the last section, there is a subdirectory called All/
, which contains all the binary packages that are available for the platform, excluding those that may not be distributed via FTP or CDROM (depending on which medium you are using).
To install packages directly from an FTP or HTTP server, run the following commands in a Bourne-compatible shell (be sure to su to root first):
#
PATH="/usr/pkg/sbin:$PATH"
#
PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages"
#
PKG_PATH="$PKG_PATH/OPSYS/ARCH/VERSIONS/All/"
#
export PATH PKG_PATH
Instead of URLs, you can also use local paths, for example if you are installing from a set of CDROMs, DVDs or an NFS-mounted repository. If you want to install packages from multiple sources, you can separate them by a semicolon in PKG_PATH
.
After these preparations, installing a package is very easy:
#
pkg_add libreoffice
#
pkg_add ap24-php71-*
Note that any prerequisite packages needed to run the package in question will be installed, too, assuming they are present where you install from.
Adding packages might install vulnerable packages. Thus you should run pkg_admin audit regularly, especially after installing new packages, and verify that the vulnerabilities are acceptable for your configuration.
After you’ve installed packages, be sure to have /usr/pkg/bin
and /usr/pkg/sbin
in your PATH
so you can actually start the just installed program.