The PortaLinux Project

The PortaLinux Ports/Build System Documentation (Alpha Release)


The PortaLinux Ports System is the main way to install packages on a PortaLinux system. It remotely fetches packages from a package repository, just like any other package manager, but it compiles the packages from scratch just like Arch's AUR, Gentoo's Portage and FreeBSD ports (which is what pl-ports is named after).

The PortaLinux Build System for the 0.12 release is also based on a modified version of the Ports System. Hybrid versions of packages can be created that work on both implementations of the Ports System

PortaLinux's implementation of the ports system works very similarly to macOS's Homebrew package manager.

Main Ports Repo


The official PortaLinux Project Ports Repo is the main repo that will be used within Ports. It is currently self-hosted by me, Cinnamon, the founder of the project.

The repo is subdivided into two subrepos: the core subrepo and the extras subrepo

The core subrepo only stores packages used within the stock PortaLinux root filesystem, while the extras store programs and libraries that are very useful for app development and deployment, such as wlroots, mesa, gtk, qt, sdl, etc.

Package Creation


PortaLinux Ports packages are gzip-compressed tape archives (tar.gz). There are multiple types of files that can be put in a package, with some of them being required. There are 3 types of Ports packages and the files they package:

properties.plml


This is the main metadata of the package. All packages require this file to be considered valid packages. It contains the name of the package, the version of the package, the author of the package and a link to the source tarball. It optionally also includes configure and compile flags for either the root filesystem or the Build System toolchain, but these will be ignored if a data.tar is detected. Here is an example:

        
          [general]
          name = "package" # Name of package (Required)
          version = "1.0.0" # Version of package (Required)
          author = "CinnamonWolfy" # Author name (Optional for compilation, but required for packages submitted to the project)
          url = "https://example.com/package/package-1.0.0-src.tar.gz" # Source Download URL (Required)
          
          [rootfs]
          configure-flags = "--prefix=/opt --enable-experimental-features" # Configuration Flags (Technically optional, but required for most packages, since no package installs to /opt by default)
          compile-flags = "-O3 -march=native" # Compilation Flags (Completely optional)
          
          [toolchain]
          configure-flags = "--prefix=~/cross --enable-experimental-features" # Configuration Flags (Technically optional, but required for all toolchain packages)
          compile-flags = "-O3 -march=native" # Compilation Flags (Completely optional)
        
      

build.rb


This is the build script in a Full Ports Package. It can be made to work for either the root filesystem or the Build System toolchain (proper API will be documented at some point soon). For now, here is an example that works on only the root filesystem while I cook a more appropriate example to replace this one:

        
          require 'common-ports.rb'
          
          class Package
            extend PLPorts::BasePackage
            
            def self.build()
              PLPorts::Common.shellRun("./configure #{@pkgConfigFlags} CFLAGS=#{@pkgCompileFlags}")
              PLPorts::Common.shellRun("make build")
            end
            
            def self.install()
              PLPorts::Common.shellRun("make install")
            end
          end
        
      

data.tar


This is a precompiled archive. This file only contains files that are basically ready to be dumped into whatever folder the Ports implementation installs to by default. This is mainly used for bootstrapping the Ports System on a stock root filesystem, as well as installing the stock etc files in the root filesystem.