mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Storing version information in libc.so
Date: Wed, 27 Nov 2013 00:48:06 -0500	[thread overview]
Message-ID: <20131127054806.GA11224@brightrain.aerifal.cx> (raw)

[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]

Hi,

The main agenda item I have left for the 0.9.15 release is making it
so libc.so can print its own version number. I'm attaching the
proposed build script that will generate version.c for comments on any
problems it might have or improvements to make.

At present, I have the script setup to generate a function which
returns the version string. This is in contrast to the other obvious
implementations, which would be a macro or an extern array object. The
macro is inappropriate because I don't want a large file like
dynlink.c to be recompiled each time the version changes (which, with
git, happens on each commit). The extern array is obviously nicer
looking than the function, but at the point where it needs to be used
in dynlink.c, relocations have not been performed and thus it's not
accessible. Arguably this should just be "fixed", since operating
without relocations for "usage" or "ldd" output is moderately hackish
anyway.

As for the build system, the proposed rule for generating version.c
is this:

src/internal/version.c: VERSION $(wildcard .git .git/*)
	sh tools/version.sh > $@

The use of $(wildcard) should handle the case where .git does not
exist (release tarballs) and avoids gratuitous dependency on git
internals.

FYI for anyone who doesn't want to actually try running the proposed
version.sh, the output it's producing looks like:

- "0.9.14-git-79-ga663c93" (with git command available)
- "0.9.14-git-unknown" (with .git present but no git command)
- "0.9.14" (with no .git)

Rich

[-- Attachment #2: version.sh --]
[-- Type: application/x-sh, Size: 346 bytes --]

             reply	other threads:[~2013-11-27  5:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27  5:48 Rich Felker [this message]
2013-11-30 21:42 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131127054806.GA11224@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).