From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4247 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Version reporting Date: Wed, 20 Nov 2013 21:25:24 -0500 Message-ID: <20131121022523.GA2868@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1385000731 7920 80.91.229.3 (21 Nov 2013 02:25:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Nov 2013 02:25:31 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4251-gllmg-musl=m.gmane.org@lists.openwall.com Thu Nov 21 03:25:37 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1VjJxY-0002i8-Rv for gllmg-musl@plane.gmane.org; Thu, 21 Nov 2013 03:25:36 +0100 Original-Received: (qmail 32679 invoked by uid 550); 21 Nov 2013 02:25:36 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 32671 invoked from network); 21 Nov 2013 02:25:35 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4247 Archived-At: One of the requested features I want to get in before 1.0 is having ld.so report the musl version; an open issue is whether the version should also get linked into static binaries. I've gone back and forth about how much detail I want in the version string, but here's a proposal we could discuss: Base version stored in VERSION file. Generate version.c with deps (to force rebuild) on VERSION and an appropriate file in .git if it exists (using $wildcard()). Derivation of version.c: - If .git does not exist, simply use VERSION - Else if .git exists but git command does not work, use VERSION+git - Else if git describe with --match matches VERSION, use VERSION - Else if git does not have tag matching VERSION, use VERSION - Else, use VERSION+git Optionally, the else case could be replaced with a more detailed version string produced by git describe. It's not clear to me whether this is desirable; more likely, it's misleading if you have local changes in your tree, since it gives a false feeling that the binary actually matches a particular revision in the git history. An alternate, possibly simpler approach would be simply always using VERSION and appending +git unconditionally if .git exists. Comments? Rich