# Free Pascal package guidelines

This page explains on how to write PKGBUILDs for software built with the Free Pascal Compiler (FPC). There currently exists two options for building software of Linux, as well as a handful of options for building software on other targets using FPC cross compilers:

#### Arch Linux

- fpc is available in the official Arch community repository and provides a compiler targetting only your host CPU (i686 or x86_64).
- fpc-multilibAUR[broken link: archived in aur-mirror] is available from the Arch User Repository which provides an x86_64 host compiler targetting both i686 and x86_64 CPU Linuxes. This will also provide the ppcross386AUR[broken link: archived in aur-mirror] FPC compiler driver package.

#### Cross compilers

- fpc-arm-android-rtlAUR[broken link: archived in aur-mirror] for ARM-based Android (beta)
- fpc-arm-linux-rtlAUR[broken link: archived in aur-mirror] for ARM-based Linux
- fpc-arm-wince-rtlAUR[broken link: archived in aur-mirror] for MS Windows CE
- fpc-i386-android-rtlAUR[broken link: archived in aur-mirror] for 32-bit Intel based Android (beta)
- fpc-i386-freebsd-rtlAUR[broken link: archived in aur-mirror] for 32-bit Intel FreeBSD
- fpc-i386-win32-rtlAUR[broken link: archived in aur-mirror] for 32-bit MS Windows
- fpc-powerpc-linux-rtlAUR[broken link: archived in aur-mirror] for 32-bit PowerPC-based Linux
- fpc-sparc-linux-rtlAUR[broken link: archived in aur-mirror] for SPARC-based Linux
- fpc-x86_64-win64-rtlAUR[broken link: archived in aur-mirror] for 64-bit MS Windows

## Free Pascal

### Package naming

The project name alone is usually sufficient. However, in the case of cross-compiling, the package should be prefixed with `fpc32-` when targetting i686 Linux from multilib and named in the format of `fpc-cpu-system-pkgname` when targetting non-Arch Linux systems.

### Helpful snippets

- Determine FPC's version and the CPU and OS of the units to output:

    _unitdir=`fpc -iSP`-`fpc -iSO`
    _fpcver=`fpc -iV`

### Packaging

Please adhere to the following when making an FPC-based package:

- always add fpc to either `makedepends` or `depends`
- always put all compiled units (*.a, *.compiled, *.o, *.ppu, *.res, *.rst) under `/usr/lib/fpc/$_fpcver/units/$arch-linux`
- add `staticlibs` to `options` if installing an import library

#### Cross compiling

- always add the corresponding cross compiler package mentioned above (`fpc-cpu-system-rtl` or fpc-multilibAUR[broken link: archived in aur-mirror] for multilib) to `depends`
- always add `!strip` to `options` for non-Unix-based systems
- always put all compiled units (*.a, *.compiled, *.o, *.ppu, *.res, *.rst) under `/usr/lib/fpc/$_fpcver/units/$_unitdir` (or if multilib, `/usr/lib/fpc/$_fpcver/units/i386-linux`)
- always use `any` (`x86_64` if multilib) as the architecture
- add `staticlibs` to `options` if installing an import library

Category:

- Package development

Hidden category:

- Pages with broken package links