makepkg-optimize

makepkg-optimizeAUR is a collection of supplemental tidy, buildenv, and executable scripts for pacman which provide macros for several kinds of optimization in the build() and package() stages.

Note: As with any package in the Arch User Repository, makepkg-optimizeAUR has no official support. You should read, and you may post comments on its AUR page.

Installation

Install makepkg-optimizeAUR and, to make available optimizations requiring them, install backends: openmp, , , svgoAUR, and .

Configuration

makepkg-optimizeAUR generates a redundant configuration file, , from your current makepkg.conf(5) configuration.

This file lists supplementary COMPILE FLAGS, BUILD ENVIRONMENT options, GLOBAL PACKAGE OPTIONS, PACKAGE OUTPUT options, and COMPRESSION DEFAULTS, all of which are disabled by default.

Build an optimized package

Warning: Some packages may fail to build with certain optimizations and over-optimization may cause problems for some programs--such as decreased performance and segmentation faults.

After selecting your preferred optimizations, pass the configuration file when building:

$ makepkg -c --config /etc/makepkg-optimize.conf

Build an optimized package in a clean chroot

Alternatively, can be used to build optimized packages within a chroot.

Chroot setup

After setting up a chroot, a few additional steps are needed.

Install makepkg-optimize and backends

First, install some of the backends for the optimization macros to the base chroot:

$ arch-nspawn "$CHROOT"/root pacman -S openmp upx optipng polly

Then download and build makepkg-optimizeAUR and svgoAUR.

To install them in the base chroot, copy their package files into it and install them, e.g.:

# cp svgo-1.2.2-2-any.pkg.tar.xz "$CHROOT"/root/root/
$ arch-nspawn "$CHROOT"/root pacman -U /root/svgo-1.2.2-2-any.pkg.tar.xz

Build a package

First, edit and select your preferred optimizations.

When building, pass the configuration file to :

$ makechrootpkg -c -r "$CHROOT" -- -c --config /etc/makepkg-optimize.conf
Building with PGO

The option for enables either generation or application of profiles, depending on if this is the first or second build of the package with this flag enabled. Clean chroot building complicates this because the software is run outside of the chroot to generate profiles, but the profiles need to be applied from inside the chroot when recompiling later. The solution is to bridge the three filesystems with a bind mounted folder.

Create a PGO cache

Create and bind a folder to store profiles:

# mkdir -m 777 {"$CHROOT"/{root,"$USER"},}/mnt/pgo
# mount -o bind {,"$CHROOT"/root}/mnt/pgo
# mount -o bind "$CHROOT"/{root,"$USER"}/mnt/pgo

Edit and set PROFDEST=/mnt/pgo.

Profile a program

Build, then install the package and test-run its executables.

After thoroughly utilizing the software, close it, then rebuild and reinstall its package.

gollark: He totally is.
gollark: Explain.
gollark: Or me mentioning andrew.
gollark: Try searching for things from andrew mentioning me or things I might have said.
gollark: Again, timestamp needed?
This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.