Improve jslinux build times, linking only the r2blob ##build

This commit is contained in:
pancake 2026-08-06 19:39:01 +02:00
parent d3211ca7a0
commit 0bb935e2cf
3 changed files with 40 additions and 12 deletions

View file

@ -47,15 +47,28 @@ endif
endif
endif
all: plugins.cfg libr/include/r_version.h
# which target to run inside libr/ (all, static, sublibs). see libr/Makefile
LIBS_TARGET?=all
all: libs
${MAKE} -C binr
# everything but the binr/ programs
libs: plugins.cfg libr/include/r_version.h
@libr/count.sh reset
${MAKE} -C shlr sdbs
${MAKE} -C shlr/zip
${MAKE} -C libr/util
${MAKE} -C libr/socket
${MAKE} -C shlr
${MAKE} -C libr
${MAKE} -C binr
${MAKE} -C libr $(LIBS_TARGET)
# just the busybox-style single-binary build: skips the 16 binr/ programs,
# libr.a/libr.so and every shared library, because r2blob links the static
# per-directory libr_*.a archives and nothing else
blob:
${MAKE} libs LIBS_TARGET=sublibs WITH_LIBS=0 WITH_LIBR=1
${MAKE} -C binr/blob symlinks WITH_LIBS=0 WITH_LIBR=1
GIT_TAP=$(shell git describe --tags --match '[0-9]*' 2>/dev/null)
GIT_TIP=$(shell git rev-parse HEAD 2>/dev/null || echo $(R2_VERSION))
@ -420,6 +433,6 @@ menu nconfig:
include mk/meson.mk
include ${MKPLUGINS}
.PHONY: all clean install symstall uninstall deinstall strip
.PHONY: all libs blob clean install symstall uninstall deinstall strip
.PHONY: libr binr install-man w32dist tests dist shot pkgcfg depgraph.png love
.PHONY: purge system-purge

10
dist/jslinux/Makefile vendored
View file

@ -49,7 +49,12 @@ BLK_KB ?= 256
R2_CFLAGS ?= -Oz -ffunction-sections -fdata-sections
# --with-libr builds the static libr_*.a archives the blob links against;
# --with-static-themes compiles the color themes into the binary since the
# guest image ships no r2 share directory
# guest image ships no r2 share directory.
#
# only `make libs LIBS_TARGET=sublibs WITH_LIBS=0` is run in the r2 tree:
# the 16 binr/ programs, the merged libr.a/libr.so and every shared library
# are pure waste here, since the blob is one static binary symlinked to all
# the tool names inside the image (busybox-style).
R2_CONFIGURE_FLAGS ?= --disable-debugger --without-ptrace-wrap --without-qjs \
--without-capstone --without-zydis --without-gpl --without-dylink \
--disable-loadlibs --with-checks-level=0 --with-libr --with-static-themes
@ -161,7 +166,8 @@ $(WORK)/r2blob: | $(CC_WRAP)
cd $(R2_ROOT) && CC=$(CC_WRAP) HOST_CC=cc CFLAGS="$(R2_CFLAGS)" ./configure \
--host=riscv64-unknown-linux-musl --with-ostype=gnulinux \
--prefix=/usr $(R2_CONFIGURE_FLAGS)
$(MAKE) -C $(R2_ROOT) -j$(JOBS) CC=$(CC_WRAP) HOST_CC=cc
$(MAKE) -C $(R2_ROOT) libs -j$(JOBS) CC=$(CC_WRAP) HOST_CC=cc \
LIBS_TARGET=sublibs WITH_LIBS=0 WITH_LIBR=1
cd $(R2_ROOT)/binr/blob && rm -f r2blob && \
LDFLAGS="-static -Wl,--gc-sections" $(MAKE) CC=$(CC_WRAP) build
@STRIP="$$(ls $(TCDIR)/bin/riscv64-linux-strip 2> /dev/null || \

View file

@ -16,7 +16,20 @@ include libs.mk
.PHONY: $(LIBS)
all:
all: sublibs
ifeq ($(WITH_LIBR),1)
$(MAKE) libr.${EXT_AR}
$(MAKE) libr.${EXT_SO}
endif
# same as all, but without the merged libr.${EXT_SO}
static: sublibs
ifeq ($(WITH_LIBR),1)
$(MAKE) libr.${EXT_AR}
endif
# only the per-directory libr_*.a / libr_*.so, no merged libr.a or libr.so
sublibs:
$(MAKE) -C xps
$(MAKE) $(LIBS0)
$(MAKE) $(LIBS1)
@ -29,10 +42,6 @@ all:
ifneq ($(LIBS8),)
$(MAKE) $(LIBS8)
endif
ifeq ($(WITH_LIBR),1)
$(MAKE) libr.${EXT_AR}
$(MAKE) libr.${EXT_SO}
endif
include ${SHLR}/zip/deps.mk
@ -250,4 +259,4 @@ mrproper:
for LIB in ${LIBS}; do ( cd $${LIB} && $(MAKE) mrproper ); done
.PHONY: sloc mrproper clean pkgcfg install deinstall uninstall libr
.PHONY: install-includes install-pkgconfig install-symlink all
.PHONY: install-includes install-pkgconfig install-symlink all static sublibs