Chapter 26. Porting pkgsrc

Table of Contents

26.1. Porting pkgsrc to a new operating system
26.2. Adding support for a new compiler

The pkgsrc system has already been ported to many operating systems, hardware architectures and compilers. This chapter explains the necessary steps to make pkgsrc even more portable.

26.1. Porting pkgsrc to a new operating system

To port pkgsrc to a new operating system (called MyOS in this example), you need to touch the following files:


This file contains some basic definitions, for example the name of the C compiler.


Insert code that defines the variables OPSYS, OS_VERSION, LOWER_OS_VERSION, LOWER_VENDOR, MACHINE_ARCH, OBJECT_FMT, APPEND_ELF, and the other variables that appear in this file.


This file contains the platform-specific definitions that are used by pkgsrc. Start by copying one of the other files and edit it to your needs.


This file contains a list of directories, together with their permission bits and ownership. These directories will be created automatically with every package that explicitly sets USE_MTREE. This feature will be removed.


Just copy one of the pre-existing x11.dist files to your MyOS.x11.dist.


On some operating systems, the tools that are provided with the base system are not good enough for pkgsrc. For example, there are many versions of sed(1) that have a narrow limit on the line length they can process. Therefore pkgsrc brings its own tools, which can be enabled here.


This file defines the paths to all the tools that are needed by one or the other package in pkgsrc, as well as by pkgsrc itself. Find out where these tools are on your platform and add them.

Now, you should be able to build some basic packages, like lang/perl5, shells/bash.

26.2. Adding support for a new compiler