Package Details: makepkg-optimize 18-1

Git Clone URL: (read-only, click to copy)
Package Base: makepkg-optimize
Description: Supplemental build and packaging optimizations for makepkg
Upstream URL:
Licenses: GPL
Submitter: quequotion
Maintainer: quequotion
Last Packager: quequotion
Votes: 9
Popularity: 0.46
First Submitted: 2016-03-20 15:08
Last Updated: 2019-11-24 02:04

Pinned Comments

quequotion commented on 2019-02-27 07:49

makepkg-optimize is a collection of libmakepkg tidy, buildenv, and executable extensions, and a supplement to pacman-git. These enable various optimization routines for building and packaging such as upx compression, profile guided optimization, link time optimization, polyhedral model optimization, etc..

Note: Over-optimization is a thing, and it is not good.

See the wiki article for details.

Note to packagers: makepkg-optmize's macros may be enabled or disabled in options() as well!

Latest Comments

1 2 3 4 5 Next › Last »

brikler commented on 2020-01-07 17:33

@quequotion always outputs "warning, not compressing... this message should appear when 'application/x-executable', 'application/x-dosexec', 'application/x-sharedlib' should be compressed and the system are using more x-sharedlib then other types… so it's probably a x-sharedlib to compress

[tom@donar ~]$ file --brief --mime-type /usr/bin/* | grep application/x-sharedlib | wc
   1109    1109   26616
[tom@donar ~]$ file --brief --mime-type /usr/bin/* | grep application/x-executable | wc
    427     427   10675
[tom@donar ~]$ file --brief --mime-type /usr/bin/* | grep application/x-sharedlib | wc
   1109    1109   26616
[tom@donar ~]$ file --brief --mime-type /usr/lib/* | grep application/x-executable | wc
      1       1      25

quequotion commented on 2019-12-15 06:10


I wonder if stripping even works on a compressed binary..

The scripts should be executed in alphanumerical order (this is why became; should be happening before anyway..

I'll look into it.

EDIT: I have been unable to compress any binaries in any packages with upx, as makepkg-optimize always outputs "warning, not compressing..." even when I deleted that code from I experienced an alternate reality in which no changes to had any effect on the execution of and I am at a loss to explain that.

brikler commented on 2019-12-13 11:58

  -> Compressing binaries with UPX...
  -> Stripping unneeded symbols from binaries and libraries...

imo should the binaries be stripped before they will be compressed because less to compress when stripped, right?

quequotion commented on 2019-11-24 15:59


I've made two updates since, changing how old used profiles are handled. I suspect this was the weak point: the old conditions allowed for a scenario in which both a directory for generated profiles and an old directory of used profiles may exist simultaneously at build time--in which case pgo would silently fail to utilize the generated profiles and build an unoptimized package. Now, if a folder for newly generated files exists, and a folder of old used profiles also exists, the old used profiles will be deleted and the previously generated profiles will be used to optimize.

Perhaps it has been the case that I always deleted the old profiles by hand, so it had not been a problem for me before.

bartus commented on 2019-11-24 13:06

This patch seems redundant (works the same before and after, for me). You should just stick to a single convention for conditionals ([[ is ~25% faster than [ on my system). Also you should consider using shellcheck to sanitize you scripts ( use with care - sometimes it missreport intended behaviors as errors), especially expanding multiple variables in a procedure call without quotes and ${} syntax.

quequotion commented on 2019-11-15 08:47


You're right. I'll try to make that change soon. 'auto' hasn't been around long; I hadn't gotten the memo.


Are you referring to this? It is indeed possible to specify makepkg-optimize's options in /etc/makepkg.conf, but I recommended using the provided /etc/makepkg-optimize.conf and specifying the config file to when building (--config /etc/makepkg-optimize.conf). I do this so that running makepkg or makechrootpkg (without any flags) on a PKGBUILD makes "standard" (unoptimized) packages. It's less hassle than editing makepkg.conf for every build (not all packages work with all optimizations and sometimes I need a 'clean' build for comparison).

By the way, it makes my day every time I see a new name in these comments! Good to know people are actually using makepkg-optimize!

brikler commented on 2019-11-14 16:22

@blackout i know how to optimize but somebody don't know about and this was a hint because the linker can also run in parallel processes with -flto=auto

-flto=auto can replace ltoflags+="=$(getconf _NPROCESSORS_ONLN) in

blackout commented on 2019-11-14 15:08

@brikler you have to understand the package. check makeflags.conf

after installation you have to check the makepkg.conf and you have the optimizations commented out. so you can replace your original file with the optimizations.


brikler commented on 2019-11-09 10:23

if found this options perhaps it is interesting for makepkg-optimize?

If you specify the optional n, the optimization and code generation done at link time is executed in parallel using n parallel jobs by utilizing an installed make program. The environment variable MAKE may be used to override the program used.

You can also specify -flto=jobserver to use GNU make’s job server mode to determine the number of parallel jobs. This is useful when the Makefile calling GCC is already executing in parallel. You must prepend a ‘+’ to the command recipe in the parent Makefile for this to work. This option likely only works if MAKE is GNU make. Even without the option value, GCC tries to automatically detect a running GNU make’s job server.

Use -flto=auto to use GNU make’s job server, if available, or otherwise fall back to autodetection of the number of CPU threads present in your system.

bartus commented on 2019-11-01 09:05

@quequotion: I saw this first in Alads commit that strips parallel off of aur-srcver particular this line showing wait -n usage.