mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-03 19:01:31 +00:00
Fix sys/static.sh on iOS/macOS targets ##build
This commit is contained in:
parent
5fce24f764
commit
25c1472a95
@ -537,21 +537,16 @@ R_API bool r_sys_getenv_asbool(const char *key) {
|
||||
return res;
|
||||
}
|
||||
|
||||
#if __vinix__
|
||||
#define USE_GLIBC 0
|
||||
#else
|
||||
#define USE_GLIBC 1
|
||||
#endif
|
||||
|
||||
R_API char *r_sys_getdir(void) {
|
||||
#if __WINDOWS__
|
||||
return _getcwd (NULL, 0);
|
||||
#else
|
||||
#if USE_GLIBC
|
||||
#ifdef __GLIBC__
|
||||
return getcwd (NULL, 0);
|
||||
#else
|
||||
char *res = calloc (1024, 1);
|
||||
char *cwd = getcwd (res, 1024);
|
||||
const size_t maxpathlen = 4096;
|
||||
char *res = calloc (maxpathlen, 1);
|
||||
char *cwd = getcwd (res, maxpathlen);
|
||||
if (!cwd) {
|
||||
free (res);
|
||||
}
|
||||
|
@ -2,6 +2,17 @@
|
||||
|
||||
[ -z "${STATIC_BINS}" ] && STATIC_BINS=0
|
||||
|
||||
if [ "$1" = "--help" ]; then
|
||||
echo "Usage: sys/static.sh [--help,--meson]"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "--meson" ]; then
|
||||
CFLAGS="-static" LDFLAGS="-static" meson --prefix=${HOME}/.local --buildtype release --default-library static build
|
||||
ninja -C build && ninja -C build install
|
||||
exit $?
|
||||
fi
|
||||
|
||||
case "$(uname)" in
|
||||
Linux)
|
||||
LDFLAGS="${LDFLAGS} -lpthread -ldl -lutil -lm"
|
||||
@ -12,13 +23,16 @@ Linux)
|
||||
if [ -n "`gcc -v 2>&1 | grep gcc`" ]; then
|
||||
export AR=gcc-ar
|
||||
fi
|
||||
CFLAGS_STATIC=-static
|
||||
;;
|
||||
Darwin)
|
||||
CFLAGS="${CFLAGS} -flto"
|
||||
LDFLAGS="${LDFLAGS} -flto"
|
||||
CFLAGS_STATIC=""
|
||||
;;
|
||||
DragonFly|OpenBSD)
|
||||
LDFLAGS="${LDFLAGS} -lpthread -lkvm -lutil -lm"
|
||||
CFLAGS_STATIC=-static
|
||||
;;
|
||||
esac
|
||||
MAKE=make
|
||||
@ -61,7 +75,7 @@ fi
|
||||
${MAKE} -j 8 || exit 1
|
||||
BINS="rarun2 rasm2 radare2 ragg2 rabin2 rax2 rahash2 rafind2 r2agent radiff2 r2r"
|
||||
# shellcheck disable=SC2086
|
||||
export CFLAGS="-static ${CFLAGS}"
|
||||
export CFLAGS="${CFLAGS_STATIC} ${CFLAGS}"
|
||||
for a in ${BINS} ; do
|
||||
(
|
||||
cd binr/$a
|
||||
@ -70,7 +84,7 @@ for a in ${BINS} ; do
|
||||
${MAKE} -j4 || exit 1
|
||||
else
|
||||
if [ "${STATIC_BINS}" = 1 ]; then
|
||||
CFLAGS=-static LDFLAGS=-static ${MAKE} -j4 || exit 1
|
||||
CFLAGS=${CFLAGS_STATIC} LDFLAGS=${CFLAGS_STATIC} ${MAKE} -j4 || exit 1
|
||||
else
|
||||
${MAKE} -j4 || exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user