mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-06 18:13:46 +00:00
Add support for acr/musl-gcc static builds ##build
This commit is contained in:
parent
a91776482a
commit
e92d170a3b
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@ -179,14 +179,20 @@ jobs:
|
||||
path: radare2-win-installer\Output\radare2.exe
|
||||
# LINUX
|
||||
linux-static:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Installing the musl runtime
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt upgrade
|
||||
sudo apt install musl-tools
|
||||
- name: Building static r2 with acr
|
||||
run: |
|
||||
cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg
|
||||
NOLTO=1 sys/static.sh
|
||||
# NOLTO=1 sys/static.sh
|
||||
make -C binr/blob
|
||||
tar cJvf r2-static.tar.xz r2-static
|
||||
- name: Pub
|
||||
|
@ -80,8 +80,10 @@ LIBMAGIC=@LIBMAGIC@
|
||||
LIBZIP=@LIBZIP@
|
||||
LIBXXHASH=@LIBXXHASH@
|
||||
|
||||
ifeq ($(HAVE_LIB_SSL),1)
|
||||
SSL_CFLAGS=@SSL_CFLAGS@
|
||||
SSL_LDFLAGS=@SSL_LDFLAGS@
|
||||
endif
|
||||
|
||||
HAVE_LIBUV=@HAVE_LIBUV@
|
||||
LIBUV_CFLAGS=@LIBUV_CFLAGS@
|
||||
|
@ -130,16 +130,16 @@ E+=../shlr/capstone/libcapstone.${EXT_AR}
|
||||
endif
|
||||
|
||||
ifeq ($(OSTYPE),darwin)
|
||||
libr_LDFLAGS=-dynamiclib -shared
|
||||
LIBR_LDFLAGS=-dynamiclib -shared
|
||||
else
|
||||
libr_LDFLAGS=-shared
|
||||
LIBR_LDFLAGS=-shared
|
||||
endif
|
||||
|
||||
libr.${EXT_SO}: .libr2
|
||||
ifeq (${COMPILER},emscripten)
|
||||
echo nothing to do here
|
||||
else
|
||||
$(CC) -fvisibility=hidden $(MLFLAGS) ${LINK} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $(libr_LDFLAGS) -o libr.${EXT_SO} \
|
||||
$(CC) -fvisibility=hidden $(MLFLAGS) ${LINK} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} $(LIBR_LDFLAGS) -o libr.${EXT_SO} \
|
||||
.libr2/*/*.o \
|
||||
../shlr/gdb/lib/libgdbr.${EXT_AR} ../shlr/java/libr_java.${EXT_AR} \
|
||||
../shlr/libr_shlr.${EXT_AR} ../shlr/mpc/libmpc.${EXT_AR} $(E) \
|
||||
|
@ -7,7 +7,7 @@
|
||||
#if __x86_64__ || __i386__ || __arm__ || __arm64__
|
||||
#include <sys/uio.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <asm/ptrace.h>
|
||||
// #include <asm/ptrace.h>
|
||||
#include "linux_coredump.h"
|
||||
#include "linux_ptrace.h"
|
||||
|
||||
|
25
mk/musl-gcc.mk
Normal file
25
mk/musl-gcc.mk
Normal file
@ -0,0 +1,25 @@
|
||||
ifeq (${_INCLUDE_MK_MUSL_GCC_},)
|
||||
_INCLUDE_MK_GCC_=1
|
||||
CC?=musl-gcc
|
||||
OBJCOPY?=objcopy
|
||||
RANLIB?=ranlib
|
||||
ONELIB=0
|
||||
AR?=ar
|
||||
CC_AR=${AR} q ${LIBAR}
|
||||
CFLAGS+=-MD
|
||||
CFLAGS_INCLUDE=-I
|
||||
LDFLAGS_LINK=-l
|
||||
LDFLAGS_LINKPATH=-L
|
||||
CFLAGS_OPT0=-O0
|
||||
CFLAGS_OPT1=-O1
|
||||
CFLAGS_OPT2=-O2
|
||||
CFLAGS_OPT3=-O3
|
||||
CFLAGS_DEBUG=-g
|
||||
LD?=ld
|
||||
|
||||
PARTIALLD=${LD} -r --whole-archive
|
||||
LDFLAGS_LIB=${LDFLAGS} -shared
|
||||
LDFLAGS_SONAME=-Wl,-soname=
|
||||
|
||||
CC_LIB=${CC} ${LDFLAGS_LIB} -o ${LIBSO}
|
||||
endif
|
@ -28,6 +28,12 @@ gmake --help >/dev/null 2>&1
|
||||
# find root
|
||||
cd "$(dirname "$PWD/$0")" ; cd ..
|
||||
|
||||
musl-gcc --help > /dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
CFGARGS=--with-compiler=musl-gcc
|
||||
export CC="musl-gcc"
|
||||
fi
|
||||
|
||||
ccache --help > /dev/null 2>&1
|
||||
if [ $? = 0 ]; then
|
||||
[ -z "${CC}" ] && CC=gcc
|
||||
@ -39,6 +45,8 @@ if [ -n "$1" ]; then
|
||||
else
|
||||
PREFIX=/usr
|
||||
fi
|
||||
# CFGARGS=--disable-loadlibs
|
||||
CFGARGS=--without-openssl
|
||||
DOCFG=1
|
||||
if [ 1 = "${DOCFG}" ]; then
|
||||
# build
|
||||
@ -48,12 +56,12 @@ if [ 1 = "${DOCFG}" ]; then
|
||||
export CFLAGS="${CFLAGS} -fPIC"
|
||||
cp -f dist/plugins-cfg/plugins.static.nogpl.cfg plugins.cfg
|
||||
./configure-plugins || exit 1
|
||||
#./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv --disable-loadlibs || exit 1
|
||||
./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv || exit 1
|
||||
./configure --prefix="$PREFIX" --without-gpl --with-libr --without-libuv $CFGARGS || exit 1
|
||||
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}"
|
||||
for a in ${BINS} ; do
|
||||
(
|
||||
cd binr/$a
|
||||
|
Loading…
Reference in New Issue
Block a user