Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile for gnu/linux with autotools #13

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,16 @@
/porosity-private
/porosity/packages/boost-vc140.1.63.0.0
boost.1.63.0.0
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
build-aux/
config.log
config.status
configure
libtool
porosity/porosity/*.o
porosity/porosity/.deps/
porosity/porosity/porosity
output/*
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ACLOCAL_AMFLAGS = -I build-aux/m4
SUBDIRS = porosity/porosity
EXTRA_DIST = autogen.sh
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# porosity

## Getting Started

Platform | Status
-----------------|-----------
Windows         | [![Build Status](https://comae.visualstudio.com/_apis/public/build/definitions/13b58962-60a0-48ed-879d-f56575385e2e/4/badge)](https://comae.visualstudio.com/_apis/public/build/definitions/13b58962-60a0-48ed-879d-f56575385e2e/4/badge)
Expand All @@ -23,6 +21,39 @@ This new paradigm of applications opens the door to many possibilities and oppor

As we, reverse engineers, know having access to source code is often a luxury. Hence, the need for an open-source tool like Porosity: decompiler for EVM bytecode into readable Solidity-syntax contracts – to enable static and dynamic analysis of compiled contracts but also vulnerability discovery.

## Build & Install

### Debian (Ubuntu 16.04)

Install development dependencies:

```
sudo apt-get install build-essential libtool autotools-dev automake
```

Install boost *(only necessary if boost version > 1.58 isn't available in package manager)*:
```
sudo apt-get install python-dev libxml2-dev libxslt-dev libicu-dev gperf bison libjpeg-dev wget
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.bz2
tar xf boost_1_64_0.tar.bz2
cd boost_1_64_0
./bootstap.sh
sudo ./b2 install
```

Configure and build:
```sh
./autogen.sh
./configure
make
```

And install with:

```
sudo make install
```

## Getting Started
First you can either compile your own Ethereum contract or analyze public contract from [Etherscan](https://etherscan.io/address/0x8d12a197cb00d4747a1fe03395095ce2a5cc6819#code).

Expand Down
3 changes: 3 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
set -e
autoreconf -if --warnings=all
33 changes: 33 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
AC_INIT([porosity],[1.0.0])
AC_PROG_CXX
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
AC_CONFIG_FILES([Makefile porosity/porosity/Makefile])
AM_INIT_AUTOMAKE([foreign])
LT_INIT()

AC_SUBST([AM_CXXFLAGS], [-std=c++1y])

AC_CHECK_HEADERS([boost/version.hpp], [boost_found_headers=yes; break;])
AS_IF([test "x$boost_found_headers" != "xyes"],
[AC_MSG_ERROR([Unable to find boost headers.])])

AC_MSG_CHECKING([boost version])
TEMP_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
@%:@include <boost/version.hpp>
]], [[
#if BOOST_VERSION > 105800
// Everything is okay
#else
# error Boost version is too old
#endif
]])],[
AC_MSG_RESULT(yes)
],[
AC_MSG_ERROR([boost versions <= 1.58 are known to be broken for multiprecision number comparison.])
])
CPPFLAGS="$TEMP_CPPFLAGS"

AC_OUTPUT
6 changes: 1 addition & 5 deletions porosity/porosity/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
#include <string>
#include <chrono>
#pragma warning(push)
#include <boost/version.hpp>
#if (BOOST_VERSION == 105800)
#include "boost_multiprecision_number_compare_bug_workaround.hpp"
#endif
#include <boost/multiprecision/cpp_int.hpp>
#pragma warning(pop)
#include "vector_ref.h"
Expand Down Expand Up @@ -325,4 +321,4 @@ namespace std
}
};

}
}
11 changes: 0 additions & 11 deletions porosity/porosity/Makefile

This file was deleted.

4 changes: 4 additions & 0 deletions porosity/porosity/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
bin_PROGRAMS = porosity
porosity_SOURCES = Porosity.cpp CommonData.cpp Contract.cpp Debug.cpp Instruction.cpp VMState.cpp Utils.cpp Disassm.cpp Output.cpp SHA3.cpp
porosity_LDADD =
porosity_LDFLAGS = -Wall -static