SHTOOL-ARX.TMP(1)

πŸ“¦
version 2.0.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

✨ shtool-arx ✨

okay bestie, gather round, because this is the GNU shtool version of the ar(1) command β€” the extensional one, the glow-up edition πŸ’…


🌸 NAME 🌸

shtool-arx β€” the GNU shtool ar(1) extensional command, no cap 🫢


πŸ¦‹ SYNOPSIS πŸ¦‹

shtool arx [-t|--trace] [-C|--command cmd] op archive file [file ...]

πŸ’– DESCRIPTION πŸ’–

So shtool arx is literally just a wrapper around the archiving tool ar(1) β€” but she's got range. The way she ate is that she can build archives out of existing archives. Like, if one of the file arguments matches "*.a", then the archive member files inside that file get used instead of file itself. Iconic behavior, honestly. ✨

The whole trick of this command is the automatic handling of archive members, and it's highkey the moment if you wanna construct a (usually top-level) library archive out of pre-built sub-library archives (usually staying inside subdirs) in a large source tree. Very main character. 🌈

And for GNU libtool based projects β€” surprise β€” a similar functionality is provided by GNU libtool internally too. So she's not the only one doing it, but she IS the one doing it right here. periodt. πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

The following command line options are available. Slay, there's two.

  • -t, --trace β€” shows the actually involved shell commands. Basically she narrates her own drama so you can see exactly what she ran. πŸ•΅οΈβ€β™€οΈ
  • -C, --command cmd β€” set the used ar(1) command to cmd instead of just "ar" (which would be searched in $PATH). Pick your own fave ar, bestie. πŸ’«

🌟 EXAMPLE 🌟

Here's her in the wild, doing Makefile things:

#   Makefile
AR=ar
RANLIB=ranlib
  :
OBJS=foo.o bar.o
LIBS=baz/libbaz.a quux/libquux.a
  :
libfoo.a: $(OBJS) $(LIBS)
    shtool arx -C $(AR) rc libfoo.a $(OBJS) $(LIBS)
    $(RANLIB) libfoo.a

See how LIBS is pointing at a bunch of sub-library archives? Yeah. She opens them up and folds their members right into libfoo.a. Chef's kiss. 🀌


πŸ’œ HISTORY πŸ’œ

The GNU shtool arx command was originally written by Ralf S. Engelschall <rse@engelschall.com> in 1999 for GNU shtool. It was prompted by need to build libraries out of sub-libraries inside the OSSP project. A founding mother of build-system drama, we love her. 🌸


πŸ‘€ SEE ALSO πŸ‘€

shtool(1), ar(1).


ngl if you're out here linking pre-built .a files by hand, you're doing it the hard way. let her cook. πŸ“

okay that's the whole page, mwah πŸ’– this was brought to you by shtool 2.0.8, dated 18-Jul-2008 β€” yes she's vintage, yes she still slays, we stan a legacy queen πŸ‘‘βœ¨πŸ«Ά

πŸ“¦ where this page comes from