Skip to content

Commit

Permalink
CI: Add Makefile for building complete wheel (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
psrok1 authored Aug 30, 2024
1 parent 061e7dc commit 5ac6d8b
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ jobs:
run: |
chmod +x drakrun/drakrun/tools/* # gh artifacts don't keep file permissions
cd drakrun
( cd drakrun/web/frontend ; npm install && npm run-script build )
python3 setup.py bdist_wheel
make DIST=1
- uses: actions/upload-artifact@v3
with:
name: drakvuf-sandbox-whl
Expand Down
35 changes: 35 additions & 0 deletions docs/usage/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,38 @@ It's also recommended to perform all installation activities using ``root`` user
Add ``--no-report`` if you don't want ``draksetup`` to send `basic usage report <https://github.com/CERT-Polska/drakvuf-sandbox/blob/master/USAGE_STATISTICS.md>`_.
16. Test your installation by navigating to the web interface ( http://localhost:6300/ ) and uploading some samples. The default analysis time is 10 minutes.

Building from sources
=====================

1. Clone Drakvuf Sandbox repository including submodules

.. code-block:: console
$ git clone --recursive [email protected]:CERT-Polska/drakvuf-sandbox.git
2. Build and install Drakvuf from sources using `instructions from the official Drakvuf documentation <https://drakvuf.com/>`_. It's recommended to use version pinned to the submodule.

3. Install DRAKVUF Sandbox system dependencies

.. code-block:: console
$ apt install tcpdump genisoimage qemu-utils bridge-utils dnsmasq libmagic1
4. Install additional Web build dependencies

.. code-block:: console
$ apt install nodejs npm
5. Make and install DRAKVUF Sandbox Python wheel. It's highly recommended to use `virtualenv <https://docs.python.org/3/library/venv.html>`_.

.. code-block:: console
$ python3 -m venv venv
$ source venv/bin/activate
$ cd drakrun
$ make
$ make install
6. Follow the :ref:`Basic installation` starting from the Step 2. Redis, MinIO and Drakvuf Sandbox configuration.
1 change: 1 addition & 0 deletions drakrun/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
drakrun.egg-info/
dist/
35 changes: 35 additions & 0 deletions drakrun/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
WEB_SOURCE_FILES := $(wildcard *.js *.css)
PYTHON_SOURCE_FILES := $( wildcard *.py ) drakrun/data pyproject.toml MANIFEST.in requirements.txt setup.py

.PHONY: all
all: dist/*.whl

dist/*.whl: $(PYTHON_SOURCE_FILES) drakrun/web/frontend/build drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m
rm -f dist/*.whl
ifndef DIST
DRAKRUN_VERSION_TAG=$(shell git rev-parse --short HEAD) python3 setup.py bdist_wheel
else
python3 setup.py bdist_wheel
endif

drakrun/web/frontend/build: drakrun/web/frontend/node_modules $(WEB_SOURCE_FILES) drakrun/web/frontend/public
cd drakrun/web/frontend ; npm run build

drakrun/web/frontend/node_modules: drakrun/web/frontend/package.json drakrun/web/frontend/package-lock.json
cd drakrun/web/frontend ; npm ci

drakrun/tools/get-explorer-pid: drakrun/tools/get-explorer-pid.c
gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0`

drakrun/tools/test-altp2m: drakrun/tools/test-altp2m.c
gcc $< -o $@ -lvmi `pkg-config --cflags --libs glib-2.0`

.PHONY: clean
clean:
rm -rf dist drakvuf_sandbox.egg-info build
rm -rf drakrun/web/frontend/build drakrun/web/frontend/node_modules
rm -f drakrun/tools/get-explorer-pid drakrun/tools/test-altp2m

.PHONY: install
install: all
pip install dist/*.whl

0 comments on commit 5ac6d8b

Please sign in to comment.