From fb6e196fa5cff02bed53c4953a9244048c3505b0 Mon Sep 17 00:00:00 2001 From: Petr Zemek Date: Tue, 12 Dec 2017 19:03:40 +0100 Subject: [PATCH] Improve build, installation, and use in README. --- README.md | 76 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 34cc84a33..10e9aeb1a 100644 --- a/README.md +++ b/README.md @@ -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: @@ -45,7 +87,6 @@ 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= -G` @@ -53,7 +94,7 @@ Additionally, to run the decompiler once it is built and installed the following * `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=` to set the installation path to ``. * (Windows only) `-G` 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. @@ -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=` to use Perl at `` (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: