radare2/sys/meson-sdk.sh
pancake 8b33d764a7
Fix #3929 - Enable LTO in sys/static.sh ##build (#17141)
* Fix #3929 - Enable LTO in sys/static.sh
* Update Ubuntu to 20.04 for static build
* Use `gcc-ar` when needed
* Do not use "c" option for ${AR}
* Use `$$AR` instead of `$AR`
* Aim to fix  `-dynamiclib` issue outside darwin
* Run tests for static LTO build

Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Anton Kochkov <xvilka@gmail.com>
2020-08-13 13:55:39 +08:00

38 lines
707 B
Bash
Executable File

#!/bin/sh
# sys/meson.py || exit 1
sys/meson.py --options use_libuv=false use_sys_magic=false || exit 1
(
cd build || exit 1
rm -rf a
mkdir a
for a in `find *| grep '\.a$' | grep -v 'libr\.a'` ; do
echo $a
b=`basename $a`
mkdir a/$b
(cd a/$b ; ${AR} xv ../../$a) > /dev/null
done
(
rm -f libr.a
cd a
${AR} rs ../libr.a */*.o
)
)
D=r2sdk
rm -rf $D
mkdir -p $D/lib || exit 1
cp -rf libr/include $D
cp -f build/r_userconf.h $D/include
cp -f build/r_version.h $D/include
cp -f build/libr.a $D/lib
rm -f $D.zip
zip -r $D.zip $D > /dev/null
cat > .test.c <<EOF
#include <r_core.h>
int main() {
RCore *core = r_core_new ();
r_core_free (core);
}
EOF
gcc .test.c -I $D/include $D/lib/libr.a