Skip to content

Commit

Permalink
Remove remaining shlr/sdb leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Dec 2, 2024
1 parent a3bd807 commit 83c9f20
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 51 deletions.
4 changes: 2 additions & 2 deletions binr/radare2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ MACSDK=macosx10.10
ENTITL=radare2.xcent
#ENTITL=radare2_ios.xml

CFLAGS_INCLUDES+=-I$(SHLR)/sdb/src
include ../../shlr/sdb.mk
CFLAGS_INCLUDES+=$(SDB_CFLAGS)
CFLAGS_INCLUDES+=-I$(LIBR)/include

ifeq (${COMPILER},emscripten)
Expand Down Expand Up @@ -94,6 +95,5 @@ include ../../shlr/bochs/deps.mk
include ../../shlr/grub/deps.mk
include ../../shlr/qnx/deps.mk
include ../../shlr/ar/deps.mk
include ../../shlr/sdb.mk

LDFLAGS+=$(LINK)
4 changes: 2 additions & 2 deletions binr/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ LINK+=$(LIBR)/crypto/libr_crypto.a
LINK+=$(LIBR)/main/libr_main.a
else ifeq (${COMPILER},wasm)
LINK+=$(SHLR)/libr_shlr.a
LINK+=$(SHLR)/sdb/src/libsdb.a
LINK+=$(SHLR)/../subprojects/sdb/src/libsdb.a
include $(SHLR)/capstone.mk
EXT_EXE=.wasm
else ifeq (${COMPILER},emscripten)
LINK+=$(SHLR)/libr_shlr.a
LINK+=$(SHLR)/sdb/src/libsdb.a
LINK+=$(SHLR)/../subprojects/sdb/src/libsdb.a
include $(SHLR)/capstone.mk
CFLAGS+= -s SIDE_MODULE=1
#CFLAGS+=-s ERROR_ON_UNDEFINED_SYMBOLS=0
Expand Down
42 changes: 11 additions & 31 deletions doc/emscripten.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
Building for the browser
========================
# Building for the browser

# Install emscripten:
## Install emscripten:

git clone git://github.com/kripken/emscripten.git
export PATH=/path/to/emscripten:$PATH
make clean
```bash
$ git clone git://github.com/kripken/emscripten.git
$ export PATH=/path/to/emscripten:$PATH
$ make clean
```

## Build radare

# Build radare

sys/emscripten.sh


<!--
--- random notes ---
export CC="emcc --ignore-dynamic-linking"
./configure --prefix=/usr --disable-shared --enable-static --disable-debugger --with-compiler=emscripten --without-pic --with-nonpic
emmake make -j4
cd binr/radare2
emcc ../../libr/*/*.o radare2.c -I ../../libr/include/ -DR2_BIRTH=\"pop\" -DR2_GITTIP=\"123\" ../../libr/db/sdb/src/*.o
binr/rax2/rax2.js:
emcc -O2 rax2.o ../../libr/util/libr_util.a -o rax2.js
binr/rasm2/rasm2.js:
emcc -O2 -L.. -o rasm2.js ../../shlr/sdb/src/libsdb.a ../../libr/fs/p/grub/libgrubfs.a -lm $A/util/libr_util.a $A/asm/libr_asm.a rasm2.o ../../libr/util/libr_util.a ../../libr/parse/libr_parse.a ../../libr/db/libr_db.a ../../libr/syscall/libr_syscall.a ../../libr/asm/libr_asm.a ../../libr/lib/libr_lib.a ../../libr/db/libr_db.a ../../shlr/sdb/src/libsdb.a ../../libr/util/libr_util.a
-->
```bash
$ sys/emscripten.sh
```
2 changes: 1 addition & 1 deletion doc/license.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ should be copied to `./plugins.cfg` before calling `./configure-plugins` to take
### Less restrictive than LGPL

* libr/bin/mangling/cxx: GPLv2 or later, with linking exception
* subprojects/sdb: MIT
* shlr/capstone: BSD + LLVM
* shlr/zip/zip: BSD
* shlr/zip/zlib: BSD
* shlr/java: Apache2.0
* shlr/sdb: MIT
* shlr/qnx: GPL (will be moved to extras soon)
* shlr/grub: GPL (used by some fs plugins)
* shlr/lz4: simplified BSD license
Expand Down
5 changes: 3 additions & 2 deletions libr/bin/p/mach064.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ TARGET_MACH064=bin_mach064.${EXT_SO}
ALL_TARGETS+=${TARGET_MACH064}

${TARGET_MACH064}: ${OBJ_MACH064}
-${CC} $(call libname,bin_mach064) -shared ${CFLAGS} -o ${TARGET_MACH064}\
${OBJ_MACH064} $(LINK) $(LDFLAGS) $(SHLR)/sdb/src/libsdb.a
-${CC} $(call libname,bin_mach064) \
-shared ${CFLAGS} -o ${TARGET_MACH064} \
${OBJ_MACH064} $(LINK) $(LDFLAGS)
2 changes: 1 addition & 1 deletion libr/core/p/sixref.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ALL_TARGETS+=${CORE_TARGET_SIXREF}
${CORE_TARGET_SIXREF}: ${CORE_OBJ_SIXREF}
${CC} $(call libname,core_anal) ${CFLAGS} \
-o core_sixref.${EXT_SO} \
$(SHLR)/sdb/src/libsdb.a \
$(SHLR)/../subprojects/sdb/src/libsdb.a \
-L$(LIBR)/crypto -lr_crypto \
${CORE_OBJ_SIXREF}
endif
2 changes: 1 addition & 1 deletion libr/fs/d/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../../../global.mk

# this bin should be created by make -C shlr/Makefile sdb/sdb
SDB=$(STOP)/sdb/sdb
SDB=$(STOP)/../subprojects/sdb/sdb
DBS=dospart.sdb

all: $(DBS)
Expand Down
9 changes: 4 additions & 5 deletions libr/util/str.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ R_API ut32 r_str_hash(const char *s) {
}

R_API int r_str_delta(char *p, char a, char b) {
char *_a = strchr (p, a);
char *_b = strchr (p, b);
const char *_a = strchr (p, a);
const char *_b = strchr (p, b);
return (!_a || !_b)? 0 : (_a - _b);
}

Expand Down Expand Up @@ -320,10 +320,9 @@ R_API int r_str_word_set0(char *str) {
*p = '\0';
// FIX: i++;
continue;
} else {
quote = 1;
memmove (p, p + 1, strlen (p + 1) + 1);
}
quote = 1;
memmove (p, p + 1, strlen (p + 1) + 1);
}
if (quote) {
continue;
Expand Down
6 changes: 3 additions & 3 deletions shlr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ sdb-host:
@echo ">>>>>>>>"
@echo
$(MAKE) -C $(SDB_ROOT) clean ; rm -f $(SDB_ROOT)/src/*.o $(SDB_ROOT)/include/sdb/version.h
$(MAKE) -C $(SDB_ROOT)/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='-I$(SHLR)/sdb/include' CFLAGS='${HOST_CFLAGS} ${PIC}' bin
$(MAKE) -C $(SDB_ROOT)/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='-I$(SDB_ROOT)/include' CFLAGS='${HOST_CFLAGS} ${PIC}' bin
cp -f $(SDB_ROOT)/src/sdb${BUILD_EXT_EXE} $(SDB_ROOT)/src/.sdb${BUILD_EXT_EXE}
cp -f $(SDB_ROOT)/src/sdb${BUILD_EXT_EXE} $(SDB_ROOT)/sdb$(BUILD_EXT_EXE)
rm -f $(SDB_LIBA)
Expand All @@ -161,11 +161,11 @@ sdb-target:
$(MAKE) -C $(SDB_ROOT) clean ; rm -f $(SDB_ROOT)/src/*.o ../include/sdb/version.h
$(MAKE) -C $(SDB_ROOT)/src ../include/sdb/version.h
ifeq ($(EXT_EXE),.wasm)
$(MAKE) -C $(SDB_ROOT)/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS=-I$(SHLR)/sdb/include \
$(MAKE) -C $(SDB_ROOT)/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS=-I$(SDB_ROOT)/include \
CFLAGS_SHARED="${CFLAGS_SHARED} -DHAVE_MMAN=0" \
CC="${CC}" AR="${AR}" ARCH=undefined CFLAGS='${CFLAGS} -DHAVE_MMAN=0' LDFLAGS='${LDFLAGS}' libsdb.$(EXT_AR)
else
$(MAKE) -C $(SDB_ROOT)/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS="-I$(SHLR)/sdb/include -DHAVE_SYSTEM=0" \
$(MAKE) -C $(SDB_ROOT)/src ARCH=xxx EXT_AR=.$(EXT_AR) RANLIB="${RANLIB}" CPPFLAGS="-I$(SDB_ROOT)/include -DHAVE_SYSTEM=0" \
CFLAGS_SHARED="${CFLAGS_SHARED}" \
CC="${CC}" AR="${AR}" ARCH=undefined LDFLAGS='${LDFLAGS}' libsdb.$(EXT_AR)
endif
Expand Down
5 changes: 4 additions & 1 deletion shlr/sdb.mk
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# deprecate.. move into subprojects/sdb-deps.mk
CFLAGS+=-I$(SHLR)/../subprojects/sdb/include
SDB_ROOT=$(SHLR)/../subprojects/sdb
SDB_CFLAGS+=-I$(SDB_ROOT)/include
SDB_LDFLAGS+=$(SDB_ROOT)/lib/lib_sdb.a
CFLAGS+=$(SDB_CFLAGS)
2 changes: 1 addition & 1 deletion shlr/spp/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ spp_files = [

inc_dirs = [
'../../libr/include',
'../../shlr/sdb/src'
'../../subprojects/sdb'
]

libspp_static = static_library('spp', spp_files,
Expand Down
2 changes: 1 addition & 1 deletion sys/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ RebuildCapstone() {
}

RebuildSdb() {
Rebuild shlr/sdb
Rebuild subprojects/sdb
Rebuild libr/util
}

Expand Down

0 comments on commit 83c9f20

Please sign in to comment.