[pacman-dev] stripping binaries in makepkg
Jonathan Conder
jonno.conder+arch at gmail.com
Mon Sep 27 05:41:45 EDT 2010
On 27/09/10 18:03, Allan McRae wrote:
> On 23/09/10 15:08, Dan McGee wrote:
>> On Wed, Sep 22, 2010 at 11:55 PM, Sven-Hendrik
>> Haase<sh at lutzhaase.com> wrote:
>>> I'd also like an answer to this. Why not do away with the individual
>>> directories? Locating the binaries even in a fairly large package will
>>> be fairly quick in any case.
>>>
>>> -- Sven-Hendrik
>>>
>>>
>>
>> Commit 721ceee1e2c9b18425d84cf39f6541b2f04072b3 might offer some
>> insight, and then there is the original code from the git import:
>>
>> +# strip binaries
>> +if [ "$NOSTRIP" = "0" ]; then
>> + msg "Stripping debugging symbols from libraries..."
>> + find pkg/{,usr,usr/local,opt/*}/lib -type f -not -name "*.dll"
>> -not -name "*.exe" \
>> + -exec /usr/bin/strip --strip-debug '{}' \; 2>&1 \
>> + | grep -v "No such file" | grep -v "format not
>> recognized"
>> + msg "Stripping symbols from binaries..."
>> + find pkg/{,usr,usr/local,opt/*}/{bin,sbin} -type f -not -name
>> "*.dll" -not -name "*.exe" \
>> + -exec /usr/bin/strip '{}' \; 2>&1 \
>> + | grep -v "No such file" | grep -v "format not
>> recognized"
>> +fi
>>
>> This leads me to believe stripping *.exe or *.dll files is bad news,
>> and since we don't hardcode that anymore, we also limit where we
>> traverse in the package filesystem.
>>
>
> This should not be an issue now as we do more testing on file types
> before stripping. makepkg will not touch .dll files and .exe ones are
> probably cross-compiled and should have !strip in their PKGBUILD anyway.
>
>
> So... with that in mind I did some testing on this.
>
> For the "gcc-snapshot" package in the AUR, the time taken by the
> current stripping is 9 sec. Adjusting the strip to look at all files
> takes that to 9.3 sec. So even with the addition of running "file" on
> all headers etc, the majority of the time seems to be taken with the
> strip command.
>
> Another example, python 3 takes ~28 sec with the current method and
> ~29 when testing all files.
>
> Lets take a very extreme example - glest-data, a 110M arch=any
> package. That takes 0.01 sec with the current method and 9 sec when
> checking every file. That is about as extreme as possible...
>
>
> My conclusion? For most binary packages, the time taken in the
> stripping step is mainly used for the actual stripping of files and
> not testing which files to strip. I think this justifies removing the
> STRIP_DIRS variable from makepkg. For large architecture independent
> packages where the difference from this change is noticeable, the
> packager should add !strip to their PKGBUILD.
>
> Sound OK?
>
> Allan
>
Why not set !strip automatically for arch=any packages?
More information about the pacman-dev
mailing list