diff --git a/Dockerfile b/Dockerfile index 3346111fc..adcec9bb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,10 +34,8 @@ COPY license.txt /root/.binaryninja/license.dat RUN mkdir -p /opt/dewolf && test -f /opt/dewolf/install_api.py || ln -s /opt/binaryninja/scripts/install_api.py /opt/dewolf/install_api.py # update binja and cache this docker image -COPY Makefile.venv requirements.txt update_binja.py /opt/dewolf/ -COPY ./dewolf-idioms/requirements.txt /opt/dewolf/requirements-compiler-idioms.txt -RUN make -f /opt/dewolf/Makefile.venv venv VENV_PATH=/opt/dewolf/.venv PREFIX=/opt/dewolf - COPY . /opt/dewolf +RUN cd /opt/dewolf & make -f /opt/dewolf/Makefile.venv venv VENV_PATH=/opt/dewolf/.venv PREFIX=/opt/dewolf + RUN mkdir -p /root/.binaryninja/plugins/ && cp -r /opt/dewolf/dewolf-idioms/ /root/.binaryninja/plugins/ WORKDIR /opt/dewolf diff --git a/Makefile.venv b/Makefile.venv index 2ff00cb26..03bb9f35b 100644 --- a/Makefile.venv +++ b/Makefile.venv @@ -1,16 +1,16 @@ PYTHON_VERSION := 3.8 BINARY_NINJA_PATH := /opt/binaryninja PREFIX := . +DEWOLF_IDIOMS_PATH := $(shell find $(PREFIX)/.. $(PREFIX)/. $(BINARY_NINJA_PATH)/plugins -maxdepth 2 -name "dewolf-idioms" -print 2>/dev/null | head -n 1) .PHONY: venv venv: $(VENV_PATH) $(VENV_PATH)/lib/python$(PYTHON_VERSION)/site-packages/binaryninja.pth - .ONESHELL: $(VENV_PATH) -$(VENV_PATH): +$(VENV_PATH): $(DEWOLF_IDIOMS_PATH)/requirements.txt virtualenv -ppython$(PYTHON_VERSION) $(VENV_PATH) $(VENV_PATH)/bin/python -mpip install -r $(PREFIX)/requirements.txt - $(VENV_PATH)/bin/python -mpip install -r $(PREFIX)/requirements-compiler-idioms.txt + $(VENV_PATH)/bin/python -mpip install -r $(DEWOLF_IDIOMS_PATH)/requirements.txt $(VENV_PATH)/lib/python$(PYTHON_VERSION)/site-packages/binaryninja.pth: $(BINARY_NINJA_PATH)/python $(BINARY_NINJA_PATH)/scripts/install_api.py @@ -18,6 +18,9 @@ $(VENV_PATH)/lib/python$(PYTHON_VERSION)/site-packages/binaryninja.pth: $(BINARY echo "$(BINARY_NINJA_PATH)/python" > $(VENV_PATH)/lib/python$(PYTHON_VERSION)/site-packages/binaryninja.pth +$(DEWOLF_IDIOMS_PATH)/requirements.txt: + @$(error requirements.txt of dewolf-idioms not found. Please make sure you have cloned the repository and optionally set the DEWOLF_IDIOMS_PATH variable manually.) + $(BINARY_NINJA_PATH)/python: @$(error Failed to find Binary Ninja at '$(BINARY_NINJA_PATH)'. \ Please set the BINARY_NINJA_PATH variable manually, e.g. \