Combine static libraries on Apple

you can use libtool to do it

libtool -static -o new.a old1.a old2.a

If you're dealing with multi-architecture static libraries, a bit of extra manipulation is required to thin each library, combine the thinned versions, and then fatten the result. Here's a handy script which you can edit to your satisfaction which does all that in one. The example takes three iOS libraries path/to/source/libs/libone.a, path/to/source/libs/libtwo.a, and path/to/source/libs/libthree.a and merges them into a single library libcombined.a.

#! /bin/bash

INPATH="path/to/source/libs"

LIBPREFIX="lib"
LIBS="one two three"
LIBEXT=".a"

OUT="combined"

ARCHS="armv7 armv7s arm64"

for arch in $ARCHS
do
  for lib in $LIBS
  do
    lipo -extract $arch $INPATH/$LIBPREFIX$lib$LIBEXT -o $LIBPREFIX$lib-$arch$LIBEXT
  done
  INLIBS=`eval echo $LIBPREFIX\{${LIBS// /,}\}-$arch$LIBEXT`
  libtool -static -o $LIBPREFIX$OUT-$arch$LIBEXT $INLIBS
  rm $INLIBS
done

OUTLIBS=`eval echo $LIBPREFIX$OUT-\{${ARCHS// /,}\}$LIBEXT`
lipo -create $OUTLIBS -o $LIBPREFIX$OUT$LIBEXT
rm $OUTLIBS