Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Apr 2014 08:58:11 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        Baptiste Daroussin <bapt@FreeBSD.org>
Cc:        svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org
Subject:   Stripping of binaries (Was: Re: svn commit: r350052 - head/Mk)
Message-ID:  <20140404085811.GA19897@FreeBSD.org>
In-Reply-To: <201404032211.s33MBqWj021361@svn.freebsd.org>
References:  <201404032211.s33MBqWj021361@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Apr 03, 2014 at 10:11:52PM +0000, Baptiste Daroussin wrote:
> New Revision: 350052
> URL: http://svnweb.freebsd.org/changeset/ports/350052
> QAT: https://qat.redports.org/buildarchive/r350052/
> 
> Log:
>   Prepend install(1) command with the STRIPBIN env defined to the proper
>   STRIPBIN to allow cross-installation

I think it's good time to rethink our stripping policy/strategy at large, as
it is kind of mess overall, and now I see the risk of it to become even more
messy with introduction of cross-building.

So, we have ports with their own `do-install' targets, and binaries are
normally installed with INSTALL_(PROGRAM|LIB), which includes `-s' switch by
default; passing STRIPBIN via env allows install(1) to call correct strip(1)
in cross-case, right?

Other ports deploy files through a vendor's routine, which can be anything,
from install(1) to cp(1) or tar(1) or cpio(1).  Some of them try to strip
binaries during compilation; others do it on install, or may not do at all.

I've recently started to notice that folks strip binaries in `post-install'
target.  Frankly, I don't understand 1) why it is being done this way, and
2) why it become so popular.  It is not just ugly on its own, it is ugly on
a much larger scale as it adds little, almost identical, imperative pieces
of code to *a lot* of Makefiles.  What makes me wonder even more, this is
being done for staged ports!

I propose that, instead of adding hacks for `-s' feature of install(1) we
remove this switch completely from INSTALL_* knobs, and remove any manual
STRIP_CMD's from ports' Makefile.  Let the files in $STAGEDIR be unstripped,
there is nothing wrong with it; moreover, staging allows precisely for any
pre-package tuning, file cherry-picking, etc.

Stripping should be done by pkg(8) when generating final package (perhaps
subject to some NO_STRIP/NO_STRIP_FILES knob or something).  This will also
ensure that correct strip(1) binary will be called, without exposing it to
install(1).  It will also allow to consolidate stripping logic in one place
instead of having it scattered around the whole Ports Tree.

Makefiles should stay mostly declarative.  Adding code there just does not
look right upfront.

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140404085811.GA19897>