From nobody@FreeBSD.org  Fri May 23 16:18:53 2014
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id B03C85B1
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 May 2014 16:18:53 +0000 (UTC)
Received: from cgiserv.freebsd.org (cgiserv.freebsd.org [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(Client did not present a certificate)
	by mx1.freebsd.org (Postfix) with ESMTPS id 84E942D4A
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 May 2014 16:18:53 +0000 (UTC)
Received: from cgiserv.freebsd.org ([127.0.1.6])
	by cgiserv.freebsd.org (8.14.8/8.14.8) with ESMTP id s4NGIoWZ008896
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 23 May 2014 16:18:50 GMT
	(envelope-from nobody@cgiserv.freebsd.org)
Received: (from nobody@localhost)
	by cgiserv.freebsd.org (8.14.8/8.14.8/Submit) id s4NGIoCU008893;
	Fri, 23 May 2014 16:18:50 GMT
	(envelope-from nobody)
Message-Id: <201405231618.s4NGIoCU008893@cgiserv.freebsd.org>
Date: Fri, 23 May 2014 16:18:50 GMT
From: Natacha Port <natbsd@instinctive.eu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] make explicit how to install static libraries
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         190146
>Category:       docs
>Synopsis:       [patch] [porters handbook] make explicit how to install static libraries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 23 16:20:00 UTC 2014
>Closed-Date:    Fri May 23 20:30:33 UTC 2014
>Last-Modified:  Fri May 23 20:30:33 UTC 2014
>Originator:     Natacha Port
>Release:        9.2-RELEASE
>Organization:
>Environment:
FreeBSD yulai 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013     root@bake.isc.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
A lot of ports are currently using $(INSTALL_LIB) macro to install static libraries (*.a files), presumably because the name hints at installing any kind of library.

However stripping breaks static libraries, since they are only an archives of object files not yet linked.

I detailed my analysis in PR ports/188993, which was the first port I encountered with the problem. I later discovered that there are a lot of them affected. I guess the problem does not manifests often, since static linking is seldom used.

Currently, the porter's handbook doesn't say anything about static libraries. The attached patch adds a specific note about them, and distinguish them from shared libraries.
>How-To-Repeat:
Run

grep -r 'INSTALL_LIB.*\.a' /usr/ports

and see the amount of matches
>Fix:
Hopefully patching the documentation will help porters install static libraries correctly in the future.

Patch attached with submission follows:

Index: en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml
===================================================================
--- en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml	(revision 44916)
+++ en_US.ISO8859-1/books/porters-handbook/makefiles/chapter.xml	(working copy)
@@ -4362,7 +4362,8 @@
 
 	<listitem>
 	  <para><varname>INSTALL_LIB</varname> is a command to
-	    install shared libraries.</para>
+	    install shared libraries (but not static
+	    libraries).</para>
 	</listitem>
 
 	<listitem>
@@ -4375,7 +4376,7 @@
 
 	<listitem>
 	  <para><varname>INSTALL_DATA</varname> is a command to
-	    install sharable data.</para>
+	    install sharable data, including static libraries.</para>
 	</listitem>
 
 	<listitem>
@@ -4387,6 +4388,13 @@
 
       <para>These are basically the <command>install</command>
 	command with all the appropriate flags.</para>
+
+      <note>
+	<para>Do not use <varname>INSTALL_LIB</varname> to install
+	  static libraries (<filename>*.a</filename>), because
+	  stripping them render them useless. Use
+	  <varname>INSTALL_DATA</varname> instead.</para>
+      </note>
     </sect2>
 
     <sect2 xml:id="install-strip">


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mat 
State-Changed-When: Fri May 23 20:30:10 UTC 2014 
State-Changed-Why:  
Committed, merci. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=190146 
>Unformatted:
