diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..32e125ef7728d43ca5af52eb894d77ea9725852a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +*.egg-info +src/pipedream/asm/x86/instructions_xed.py diff --git a/README.md b/README.md index 874d28ef95046be20b5f0a539d48ceb6db3b59a0..d073b85af7d4fb99d2c52cd9456c29f7468bc31e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,13 @@ +# Pipedream -# Install +## Install + +### Generate the x86 instruction database + +Before installing Pipedream, it is necessary to generate the database of x86 +instructions from Intel XED: ```bash - ## create X86 instruction database from Intel XED. git submodule init git submodule update cd tools/extract-xed-instruction-database/ @@ -10,3 +15,20 @@ make -C build -j build/extract-xed-instruction-database print-instr-db -o ../../src/pipedream/asm/x86/instructions_xed.py ``` + +Alternatively, if you already have generated this file on another machine, you +may copy it over as `src/pipedream/asm/x86/instructions_xed.py`. + +### Installing pipedream + +It is recommended to install python dependencies, as well as pipedream itself, +into a virtualenv: + +```bash + virtualenv -p python3 venv + source venv/bin/activate + pip install -e . +``` + +Note that this will break if you did not first generate the x86 instructions +database (see above). diff --git a/setup.py b/setup.py new file mode 100644 index 0000000000000000000000000000000000000000..f737b0b0de7ba1876a8519258803fc9f5081d3a7 --- /dev/null +++ b/setup.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 + +from pathlib import Path +from setuptools import setup, find_packages + + +def parse_requirements(): + reqs = [] + with open("requirements.txt", "r") as handle: + for line in handle: + reqs.append(line) + return reqs + + +def check_instructions_xed(): + """ Checks that `instructions_xed.py` exists. Raises an Exception on failure. """ + root_dir = Path(__file__).parent + instr_xed_path = root_dir / "src/pipedream/asm/x86/instructions_xed.py" + if not instr_xed_path.is_file(): + raise Exception( + ( + "Cannot find `instructions_xed.py` at {path}. Please check the " + "README for more details." + ).format(path=instr_xed_path.as_posix()) + ) + + +check_instructions_xed() +packages = find_packages(where="src/") + + +setup( + name="pipedream", + version="0.0.1", + description="Pipedream", + author="CORSE", + url="https://gitlab.inria.fr/fgruber/pipedream", + packages=packages, + package_dir={package: "src/" + package.replace(".", "/") for package in packages}, + include_package_data=True, + long_description=open("README.md").read(), + install_requires=parse_requirements(), +) diff --git a/tools/extract-xed-instruction-database/.gitignore b/tools/extract-xed-instruction-database/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f853de9cedc858d154156aabd3bf47fc94ee2af3 --- /dev/null +++ b/tools/extract-xed-instruction-database/.gitignore @@ -0,0 +1,6 @@ +CMakeCache.txt +CMakeFiles +Makefile +cmake_install.cmake +extract-xed-instruction-database +xed-build-prefix