Skip to content

Commit

Permalink
Improve build, installation, and use in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
s3rvac committed Dec 12, 2017
1 parent 4369806 commit fb6e196
Showing 1 changed file with 54 additions and 22 deletions.
76 changes: 54 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,64 @@ Features:
* Output in two high-level languages: C and a Python-like language.
* Generation of call graphs, control-flow graphs, and various statistics.

## Requirements
## Installation and Use

* A compiler supporting C++14
* On Windows, only Microsoft Visual C++ is supported (version >= Visual Studio 2015 Update 2).
* CMake (version >= 3.6)
* Perl
* On Windows, [Active Perl](https://www.activestate.com/activeperl) needs to be the first Perl in `PATH`, or it has to be provided to CMake using `CMAKE_PROGRAM_PATH` variable, e.g. `-DCMAKE_PROGRAM_PATH=/c/perl/bin`.
* [GNU Bison](https://www.gnu.org/software/bison/), [Flex](https://www.gnu.org/software/flex/), [GNU Tar](https://www.gnu.org/software/tar/), `wget`, `sha256sum`.
* On Windows, you can follow RetDec's Windows environment setup [guide](https://github.com/avast-tl/retdec/wiki/Windows-Environment) to help you get everything you need.
Currently, we support only Windows and Linux.

Additionally, to run the decompiler once it is built and installed the following tools are needed:
* [GNU Bash](https://www.gnu.org/software/bash/), [UPX](https://upx.github.io/), [bc](https://www.gnu.org/software/bc/), [dot](http://www.graphviz.org/).
* As before, you can follow RetDec's Windows environment setup [guide](https://github.com/avast-tl/retdec/wiki/Windows-Environment) to help you get everything you need on Windows.
### Windows

1. Either download and unpack a pre-built package, or build and install the decompiler by yourself (the process is described below):

* 32b Windows: TBA
* 64b Windows: TBA

2. Install [MSYS2](http://www.msys2.org/) and other needed applications by following RetDec's [Windows environment setup guide](https://github.com/avast-tl/retdec/wiki/Windows-Environment).

3. Now, you are all set to run the decompiler. To decompile a binary file named `test.exe`, go into `$RETDEC_INSTALLED_DIR/bin` and run:

```
bash decompile.sh test.exe
```
For more information, run `bash decompile.sh --help`.
### Linux
1. There are currently no pre-built packages for Linux. You will have to build and install the decompiler by yourself. The process is described below.
2. After you have built the decompiler, you will need to install the following packages via your distribution's package manager:
* [GNU Bash](https://www.gnu.org/software/bash/)
* [UPX](https://upx.github.io/)
* [bc](https://www.gnu.org/software/bc/)
* [Graphviz](http://www.graphviz.org/)
3. Now, you are all set to run the decompiler. To decompile a binary file named `test.exe`, go into `$RETDEC_INSTALLED_DIR/bin` and run:
```
./decompile.sh test.exe
```
For more information, run `./decompile.sh --help`.
## Build and Installation
This section describes a manual build and installation of RetDec.
### Requirements
* Linux:
* A compiler supporting C++14
* [CMake](https://cmake.org/) (version >= 3.6)
* [Perl](https://www.perl.org/)
* standard tools (e.g. `sh`, `wget`, `sha256sum`)
* Windows:
* Microsoft Visual C++ (version >= Visual Studio 2015 Update 2)
* [MSYS2](http://www.msys2.org/) and some other applications. Follow RetDec's [Windows environment setup guide](https://github.com/avast-tl/retdec/wiki/Windows-Environment) to get everything you need on Windows.
* [Active Perl](https://www.activestate.com/activeperl). It needs to be the first Perl in `PATH`, or it has to be provided to CMake using `CMAKE_PROGRAM_PATH` variable, e.g. `-DCMAKE_PROGRAM_PATH=/c/perl/bin`.
### Process
* Recursively clone the repository (it contains submodules):
* `git clone --recursive https://github.com/avast-tl/retdec`
* Linux:
Expand All @@ -45,15 +87,14 @@ Additionally, to run the decompiler once it is built and installed the following
* `make && make install`
* Windows:
* Open MSBuild command prompt, or any terminal that is configured to run the `msbuild` command.
* Make sure you can run required commands listed in the Requirements section.
* `cd retdec`
* `mkdir build && cd build`
* `cmake .. -DCMAKE_INSTALL_PREFIX=<path> -G<generator>`
* `msbuild /m /p:Configuration=Release retdec.sln`
* `msbuild /m /p:Configuration=Release INSTALL.vcxproj`
* Alternatively, you can open `retdec.sln` generated by `cmake` in Visual Studio IDE.
You must pass the following parameters to `cmake`:
You have to pass the following parameters to `cmake`:
* `-DCMAKE_INSTALL_PREFIX=<path>` to set the installation path to `<path>`.
* (Windows only) `-G<generator>` is `-G"Visual Studio 14 2015"` for 32-bit build using Visual Studio 2015, or `-G"Visual Studio 14 2015 Win64"` for 64-bit build using Visual Studio 2015. Later versions of Visual Studio may be used.
Expand All @@ -63,15 +104,6 @@ You can pass the following additional parameters to `cmake`:
* `-DCMAKE_BUILD_TYPE=Debug` to build with debugging information, which is useful during development. By default, the project is built in the `Release` mode. This has no effect on Windows, but the same thing can be achieved by running `msbuild` with the `/p:Configuration=Debug` parameter.
* `-DCMAKE_PROGRAM_PATH=<path>` to use Perl at `<path>` (probably useful only on Windows).
## Usage Example

To decompile a binary file named `test.bin` run:
```
./decompile.sh test.bin
```

Run `./decompile.sh --help` to list all the available options.

## Repository Overview
This repository contains the following libraries:
Expand Down

0 comments on commit fb6e196

Please sign in to comment.