2015-12-28 17:30:54 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2016-10-26 23:02:26 +00:00
|
|
|
LIBS="libr/cons/libr_cons.a libr/util/libr_util.a libr/bin/libr_bin.a libr/anal/libr_anal.a libr/bp/libr_bp.a libr/hash/libr_hash.a libr/debug/libr_debug.a shlr/sdb/src/libsdb.a libr/core/libr_core.a libr/fs/libr_fs.a libr/syscall/libr_syscall.a shlr/java/libr_java.a shlr/zip/librz.a libr/socket/libr_socket.a libr/anal/libr_anal.a libr/flag/libr_flag.a libr/search/libr_search.a libr/reg/libr_reg.a libr/config/libr_config.a libr/io/libr_io.a libr/parse/libr_parse.a libr/bp/libr_bp.a libr/asm/libr_asm.a libr/bp/libr_bp.a libr/egg/libr_egg.a libr/anal/libr_anal.a libr/magic/libr_magic.a libr/lang/libr_lang.a libr/fs/libr_fs.a shlr/grub/libgrubfs.a shlr/capstone/libcapstone.a shlr/gdb/lib/libgdbr.a"
|
2015-12-28 17:30:54 +00:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
LIB=libr.a
|
|
|
|
TMP=.ar.tmp
|
|
|
|
|
|
|
|
RANLIB="xcrun --sdk iphoneos ranlib"
|
|
|
|
|
|
|
|
rm -rf ${TMP}
|
|
|
|
mkdir -p ${TMP}
|
|
|
|
for a in ${LIBS} ; do
|
|
|
|
${RANLIB} $a
|
2015-12-28 19:40:18 +00:00
|
|
|
file "$a" | grep -q universal
|
|
|
|
if [ $? = 0 ]; then
|
|
|
|
ARCHS=`lipo -info $a | cut -d : -f 3-`
|
|
|
|
else
|
|
|
|
ARCHS=""
|
|
|
|
fi
|
2015-12-28 17:30:54 +00:00
|
|
|
if [ -n "${ARCHS}" ]; then
|
|
|
|
for b in ${ARCHS} ; do
|
|
|
|
mkdir -p "$TMP/$a/$b"
|
|
|
|
ORIG="$PWD/$a.$b"
|
|
|
|
lipo -thin $b -output $a.$b $a
|
|
|
|
echo "cd $TMP/$a/$b : ar x $ORIG"
|
|
|
|
( cd $TMP/$a/$b ; ar x $ORIG )
|
2015-12-28 19:40:18 +00:00
|
|
|
rm -f $a.$b
|
2015-12-28 17:30:54 +00:00
|
|
|
done
|
|
|
|
else
|
|
|
|
mkdir -p "${TMP}/${a}"
|
|
|
|
ORIG="$PWD/$a"
|
|
|
|
( cd $TMP/$a ; ar x $ORIG )
|
|
|
|
echo $a
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
cd ${TMP}
|
|
|
|
OBJS=`find * -iname *.o`
|
|
|
|
if [ -z "${OBJS}" ]; then
|
|
|
|
echo
|
|
|
|
echo "Cannot find any object"
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
rm -f "${LIB}"
|
|
|
|
ar qv "${LIB}" ${OBJS}
|
|
|
|
ranlib "${LIB}"
|
|
|
|
fi
|