{"id":13799509,"url":"https://github.com/ptr1337/makepkg-optimize","last_synced_at":"2025-10-24T05:01:48.875Z","repository":{"id":119299086,"uuid":"442918086","full_name":"ptr1337/makepkg-optimize","owner":"ptr1337","description":"Some useful additons for makepkg for archlinux","archived":false,"fork":false,"pushed_at":"2022-08-02T19:05:03.000Z","size":126,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-02T08:11:21.489Z","etag":null,"topics":["aocc","archlinux","bolt","clang","gcc","makepkg","optimization","pgo"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ptr1337.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-12-29T23:48:27.000Z","updated_at":"2024-10-07T14:40:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"61e3c571-24a8-44e5-9a4a-e3be0661788f","html_url":"https://github.com/ptr1337/makepkg-optimize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptr1337%2Fmakepkg-optimize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptr1337%2Fmakepkg-optimize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptr1337%2Fmakepkg-optimize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ptr1337%2Fmakepkg-optimize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ptr1337","download_url":"https://codeload.github.com/ptr1337/makepkg-optimize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960295,"owners_count":19559240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aocc","archlinux","bolt","clang","gcc","makepkg","optimization","pgo"],"created_at":"2024-08-04T00:01:03.473Z","updated_at":"2025-10-24T05:01:48.808Z","avatar_url":"https://github.com/ptr1337.png","language":"Shell","funding_links":[],"categories":["Other projects"],"sub_categories":["Other"],"readme":"# makepkg-optimize\n\nmakepkg-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.\n\n## Installation\n\nInstall makepkg-optimize-mold(https://aur.archlinux.org/packages/makepkg-optimize-mold/) and, to make optimizations available, install their backends: openmp, upx, optipng, svgo and mold\n\n## Configuration\n\nmakepkg-optimize generates a redundant configuration file, /etc/makepkg-optimize.conf, from your current makepkg.conf configuration.\n\nThis file lists supplementary COMPILE FLAGS, BUILD ENVIRONMENT options, GLOBAL PACKAGE OPTIONS, PACKAGE OUTPUT options, and COMPRESSION DEFAULTS, all of which are disabled by default.\n\nSome packages may fail to build with certain optimizations and over-optimization may cause problems for some programs--such as decreased performance and segmentation faults.\n\n## Build an optimized package\n\nAfter selecting your preferred optimizations, pass the configuration file when building:\n\n- makepkg -c --config /etc/makepkg-optimize.conf\n\n### Profile-guided optimization\n\nNote: Profile-guided optimization requires that a package be built and installed twice. The first phase initiates profile generation in $PROFDEST/pkgbase.gen; the second moves them to $PROFDEST/pkgbase.used and applies them\n\n## Build an optimized package in a clean chroot\n\nAlternatively, makepkg-optimize can be used to build optimized packages within a chroot.\n\n## Create a PGO cache ====\n\nTo use PGO, create a folder in the same place, inside and outside of the chroot, to store [https://gcc.gnu.org/onlinedocs/gcc/Gcov-Data-Files.html profiles]:\n\n- mkdir -m 777 {\"$CHROOT\"/{root,\"$USER\"},}/mnt/pgo\n\nThen edit CHROOT/root/etc/makepkg-optimize.conf and set PROFDEST=/mnt/pgo.\n\n## Building with PGO\n\nAfter the first building phase, bind the PGO cache:\n\n- mount -o bind {,\"CHROOT\"/root}/mnt/pgo\n\n- mount -o bind \"$CHROOT\"/{root,\"$USER\"}/mnt/pgo\n\nTip: Use fstab to bind these folders at boot.\n\n## Using buildcache\n\nYou can use buildcache if you replace in /usr/share/makepkg/buildenv/compiler.sh with the compiler.sh.in in the repo.\nThen you need to exec the buildcache.sh for setting the symlinks.\n\n## Using custom llvm toolchain\n\nJust place your toolchain into ~/Documents/llvm , that it looks then like this:\n```\nls ~/Documents/llvm\ndrwxr-xr-x - ptr1337 23 Jun 13:25  bin\ndrwxr-xr-x - ptr1337 23 Jun 13:25  include\ndrwxr-xr-x - ptr1337 23 Jun 13:25  lib\ndrwxr-xr-x - ptr1337 23 Jun 13:25  share\n```\nAfter that enable as buildoption options=(bolt) and it will use the toolchain\n\n## Building packages with relocations for the ability to bolt them\n\nIf compiling with clang, simply add as buildoption 'relocs' and it will add 'LDFLAGS+=\"--emit-relocs\"'\nIf compiling with gcc your target package, add as options 'relocsgcc' these will add -fno-reorder-functions since gcc enables these as default which results into a not bolt able binary\n\n## Using a different linker (lld/mold)\n\nSimply add as option 'lld' or 'mold' and it will add the regarding -fuse-ld='linker'. OM\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptr1337%2Fmakepkg-optimize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fptr1337%2Fmakepkg-optimize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fptr1337%2Fmakepkg-optimize/lists"}