mirror of
https://github.com/radareorg/r2xsql.git
synced 2026-11-08 17:43:07 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f3cada586 | ||
|
|
336e7969e6 |
No files matched your search
@@ -2,7 +2,7 @@
|
||||
# Stage the same plugins/ layout on every platform for r2pm -bi.
|
||||
set -euo pipefail
|
||||
|
||||
# Derive the target from the runner, independent of the build host's r2pm.
|
||||
# The pinned radare2 predates r2pm -H R2PM_TRIPLET.
|
||||
case "${RUNNER_OS}-${RUNNER_ARCH}" in
|
||||
Linux-X64) R2PM_TRIPLET=linux-x86-64; ext=so ;;
|
||||
Windows-X64) R2PM_TRIPLET=windows-x86-64; ext=dll ;;
|
||||
@@ -27,8 +27,7 @@ cat > dist/plugin/README.txt <<EOF
|
||||
r2xsql — radare2 core plugin
|
||||
|
||||
Built against radare2 ${R2_REF} for ${R2PM_TRIPLET}.
|
||||
Install with a matching radare2 version and an r2pm supporting
|
||||
R2PM_VERSION_MAP (available in radare2 git; planned for 6.2.6):
|
||||
Install with a matching radare2 version and a recent r2pm:
|
||||
|
||||
r2pm -U
|
||||
r2pm -bi r2xsql
|
||||
@@ -49,7 +48,7 @@ with double quotes to preserve SQL operators and statement separators.
|
||||
Analysis is explicit: run aaa or start radare2 with -A.
|
||||
|
||||
The plugin also works through radare2's own HTTP server:
|
||||
radare2 -e http.bind=127.0.0.1 -e http.sandbox=false -e http.port=9090 -c aaa -c '=h' <file>
|
||||
radare2 -e http.bind=127.0.0.1 -e http.port=9090 -c aaa -c '=h' <file>
|
||||
curl --data-binary '"sqlj SELECT name FROM funcs LIMIT 5"' http://127.0.0.1:9090/cmd/
|
||||
|
||||
Read the command output for errors even when HTTP returns status 200.
|
||||
|
||||
@@ -18,7 +18,7 @@ concurrency:
|
||||
|
||||
# Build against this radare2 release without changing its version for r2pm.
|
||||
env:
|
||||
R2_REF: "6.2.4"
|
||||
R2_REF: "6.2.2"
|
||||
|
||||
jobs:
|
||||
# ============================================================================
|
||||
|
||||
@@ -40,23 +40,6 @@ ifeq ($(wildcard $(LIBXSQL_DIR)/CMakeLists.txt),)
|
||||
LIBXSQL_DIR:=$(BUILD)/libxsql
|
||||
endif
|
||||
|
||||
# $(1) is the included makefile stamp, refreshed after a managed checkout.
|
||||
define check_libxsql
|
||||
@mkdir -p $(dir $(1))
|
||||
@current=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify HEAD 2>/dev/null || echo unknown); \
|
||||
expected=$$(git -C "$(LIBXSQL_DIR)" rev-parse --verify "$(LIBXSQL_REF)^{commit}" 2>/dev/null); \
|
||||
if [ "$$current" != "$$expected" ]; then \
|
||||
if [ "$(LIBXSQL_DIR)" = "$(BUILD)/libxsql" ]; then \
|
||||
git -C "$(LIBXSQL_DIR)" fetch origin tag "$(LIBXSQL_REF)" && \
|
||||
git -C "$(LIBXSQL_DIR)" checkout "$(LIBXSQL_REF)" && touch $(1) || exit $$?; \
|
||||
elif [ "$$current" != unknown ]; then \
|
||||
echo "ERROR: libxsql at $$current, expected $(LIBXSQL_REF). Update $(LIBXSQL_DIR) manually." >&2; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
@test -f $(1) || touch $(1)
|
||||
endef
|
||||
|
||||
# --- radare2 (in-process libr backend) ----------------------------------------
|
||||
R2_CFLAGS=$(shell pkg-config --cflags r_core)
|
||||
R2_LDFLAGS=$(shell pkg-config --libs r_core)
|
||||
@@ -101,7 +84,7 @@ all: $(PLUGIN)
|
||||
|
||||
# Removing files must not fetch or rebuild dependencies via included makefiles.
|
||||
ifneq ($(filter-out clean mrproper uninstall user-uninstall,$(or $(MAKECMDGOALS),all)),)
|
||||
include $(BUILD)/libxsql.mk
|
||||
-include $(BUILD)/libxsql.mk
|
||||
-include $(OBJS:.o=.d)
|
||||
endif
|
||||
|
||||
@@ -112,10 +95,9 @@ $(LIBXSQL_DIR)/CMakeLists.txt:
|
||||
@echo "libxsql not found at ../libxsql -- cloning $(LIBXSQL_URL)"
|
||||
git clone --depth 1 --branch $(LIBXSQL_REF) $(LIBXSQL_URL) $(LIBXSQL_DIR)
|
||||
|
||||
# Check before reading sources; a checkout restarts make with the new source list.
|
||||
.PHONY: libxsql-check
|
||||
$(BUILD)/libxsql.mk: $(LIBXSQL_DIR)/CMakeLists.txt libxsql-check
|
||||
$(call check_libxsql,$@)
|
||||
$(BUILD)/libxsql.mk: $(LIBXSQL_DIR)/CMakeLists.txt
|
||||
@mkdir -p $(dir $@)
|
||||
@touch $@
|
||||
|
||||
# Rebuild legacy objects without .d files when this Makefile is updated.
|
||||
$(BUILD)/obj/sqlite/sqlite3.o: $(LIBXSQL_DIR)/external/sqlite/sqlite3.c Makefile | $(LIBXSQL_DIR)/CMakeLists.txt
|
||||
|
||||
+6
-28
@@ -64,34 +64,12 @@ consume [`libxsql`](https://github.com/0xeb/libxsql): the Makefile uses a
|
||||
sibling `../libxsql` checkout (else clones it), and meson pulls it as a
|
||||
subproject. All three builds pin the same libxsql release tag (`v1.0.21`).
|
||||
|
||||
## Binary releases
|
||||
|
||||
The plugin release version and radare2 version are separate. A plugin release
|
||||
such as `v0.0.1` contains assets named
|
||||
`r2xsql-<radare2-version>-<R2PM_TRIPLET>.zip`, for example
|
||||
`r2xsql-6.2.4-linux-x86-64.zip`. Each archive contains the plugin in `plugins/`.
|
||||
The current CI targets Linux x64, Windows x64 and macOS ARM64 against radare2
|
||||
6.2.4. A different engine ABI needs a matching build, including iaito's engine.
|
||||
|
||||
Pushing a `v*` tag runs the build workflow and, after all platform builds
|
||||
succeed, creates a GitHub Release with the ZIPs attached. Branch builds and
|
||||
manual workflow runs upload CI artifacts without publishing a release.
|
||||
Keep `R2_REF` in `.github/workflows/build.yml` and the compatibility table in
|
||||
[`radare2-pm/db/r2xsql`](https://github.com/radareorg/radare2-pm/blob/master/db/r2xsql)
|
||||
aligned. The recipe uses `R2PM_VERSION_MAP` to map the installed radare2 version
|
||||
(`R2V`) to the plugin release tag (`R2PM_VERSION`). It downloads from that exact
|
||||
release, retaining `R2V` in the asset name to select the compatible build.
|
||||
Add a mapping only when that release supplies a build for the engine version;
|
||||
a new r2pm version alone does not make an older plugin ABI compatible.
|
||||
|
||||
Binary installation requires r2pm with `R2PM_VERSION_MAP` support, available in
|
||||
radare2 git and planned for radare2 6.2.6. Radare2 6.2.4 introduced binary
|
||||
installation, but its r2pm lacks this mapping facility. The mapped release
|
||||
and matching target asset must also be published; a CI artifact alone is not
|
||||
enough. With a suitable r2pm, use `r2pm -U` then `r2pm -bi r2xsql`; uninstall
|
||||
with `r2pm -u r2xsql`. Unsupported versions or targets fail instead of falling
|
||||
back to a source build. To install manually, copy the matching plugin to the
|
||||
directory printed by `radare2 -NN -H R2_USER_PLUGINS`.
|
||||
When published, binary release assets are named `r2xsql-<radare2-version>-<R2PM_TRIPLET>.zip`, for
|
||||
example `r2xsql-6.2.4-linux-x86-64.zip`. Each contains the plugin in `plugins/`.
|
||||
With a recent r2pm supporting binary installs, use `r2pm -U` followed by
|
||||
`r2pm -bi r2xsql`; uninstall with `r2pm -u r2xsql`. Only matching radare2
|
||||
versions and targets are installed. To install manually, copy the plugin to
|
||||
the directory printed by `radare2 -NN -H R2_USER_PLUGINS`.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ does the same for a local build. Manual installation uses the directory
|
||||
reported by `r2 -NN -H R2_USER_PLUGINS`. Restart a host after installation.
|
||||
The plugin's radare2 ABI must match the engine loading it; iaito can use a
|
||||
different engine from the standalone r2 on PATH. Binary installation with
|
||||
`r2pm -bi r2xsql` requires an available asset matching the host and platform,
|
||||
plus r2pm with `R2PM_VERSION_MAP` support (radare2 git; planned for 6.2.6).
|
||||
`r2pm -bi r2xsql` requires an available asset matching the host and platform.
|
||||
See [building and packaging](development.md).
|
||||
|
||||
For a build that is not installed:
|
||||
|
||||
Reference in new issue
Block a user