Browse Source

Minor fix.

cl-refactor
Gav Wood 11 years ago
parent
commit
db77f20641
  1. 53
      CMakeLists.txt
  2. 28
      MANIFEST.in
  3. 23
      libethereum/PeerServer.cpp
  4. 60
      setup.py

53
CMakeLists.txt

@ -109,51 +109,48 @@ else ()
message(FATAL_ERROR "Your C++ compiler does not support C++11.") message(FATAL_ERROR "Your C++ compiler does not support C++11.")
endif () endif ()
if (${TARGET_PLATFORM} STREQUAL "w64") if(${TARGET_PLATFORM} STREQUAL "w64")
else () else()
# Look for available Crypto++ version and if it is >= 5.6.2 # Look for available Crypto++ version and if it is >= 5.6.2
find_path(ID cryptlib.h find_path(ID cryptlib.h
/usr/include/cryptopp ../cryptopp/src
/usr/include/crypto++ ../../cryptopp/src)
/usr/local/include/cryptopp if(ID)
/usr/local/include/crypto++ set(LS ${ID}/../target/build/release/libcryptopp.so)
/opt/local/include/cryptopp else()
/opt/local/include/crypto++ find_path(ID cryptlib.h
) /usr/include/cryptopp
find_library(LS NAMES cryptoppeth cryptopp /usr/include/crypto++
PATHS /usr/local/include/cryptopp
/usr/lib /usr/local/include/crypto++
/usr/local/lib /opt/local/include/cryptopp
/opt/local/lib /opt/local/include/crypto++
) )
find_library(LS NAMES cryptoppeth cryptopp
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
)
endif()
if(ID AND LS) if (ID AND LS)
message(STATUS "Found Crypto++: ${ID}, ${LS}") message(STATUS "Found Crypto++: ${ID}, ${LS}")
set(_CRYPTOPP_VERSION_HEADER ${ID}/config.h) set(_CRYPTOPP_VERSION_HEADER ${ID}/config.h)
if(EXISTS ${_CRYPTOPP_VERSION_HEADER}) if(EXISTS ${_CRYPTOPP_VERSION_HEADER})
file(STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION REGEX "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$") file(STRINGS ${_CRYPTOPP_VERSION_HEADER} _CRYPTOPP_VERSION REGEX "^#define CRYPTOPP_VERSION[ \t]+[0-9]+$")
string(REGEX REPLACE "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION ${_CRYPTOPP_VERSION}) string(REGEX REPLACE "^#define CRYPTOPP_VERSION[ \t]+([0-9]+)" "\\1" _CRYPTOPP_VERSION ${_CRYPTOPP_VERSION})
if(${_CRYPTOPP_VERSION} LESS 562) if(${_CRYPTOPP_VERSION} LESS 562)
message(STATUS "System Crypto++ version found is smaller than 5.6.2.") message(STATUS "Crypto++ version found is smaller than 5.6.2.")
else() else()
set(CRYPTOPP_INCLUDE_DIR ${ID} CACHE FILEPATH "" FORCE) set(CRYPTOPP_INCLUDE_DIR ${ID} CACHE FILEPATH "" FORCE)
set(CRYPTOPP_LIBRARIES ${LS} CACHE FILEPATH "" FORCE) set(CRYPTOPP_LIBRARIES ${LS} CACHE FILEPATH "" FORCE)
set(CRYPTOPP_FOUND TRUE) set(CRYPTOPP_FOUND TRUE)
message(STATUS "System Crypto++ found and version greater or equal to 5.6.2") message(STATUS "Crypto++ found and version greater or equal to 5.6.2")
endif() endif()
endif() endif()
endif() endif()
if(NOT CRYPTOPP_FOUND)
set(CRYPTOPP_INCLUDE_DIR "../cryptopp562" CACHE FILEPATH "" FORCE)
find_library(LSLOC NAMES cryptoppeth cryptopp
PATHS ../cryptopp562
NO_DEFAULT_PATH
)
set(CRYPTOPP_LIBRARIES ${LSLOC} CACHE FILEPATH "" FORCE)
message(STATUS "System Crypto++ not found, broken or too old. We use ${LSLOC}")
endif()
# Not really worth caching. We want to reevaluate anyway. # Not really worth caching. We want to reevaluate anyway.
mark_as_advanced(CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARIES) mark_as_advanced(CRYPTOPP_INCLUDE_DIR CRYPTOPP_LIBRARIES)

28
MANIFEST.in

@ -1,28 +0,0 @@
include CMakeLists.txt
include libevmface/*.cpp
include libevmface/*.h
include libevmface/CMakeLists.txt
include libethcore/*.cpp
include libethcore/*.h
include libethcore/CMakeLists.txt
include libethential/*.cpp
include libethential/*.h
include libethential/CMakeLists.txt
include liblll/*.cpp
include liblll/*.h
include liblll/CMakeLists.txt
include libserpent/*.cpp
include libserpent/*.h
include libserpent/CMakeLists.txt
include libpyserpent/*.cpp
include libpyserpent/*.h
include libpyserpent/CMakeLists.txt
include libpyserpent/*.cpp
include libpyserpent/CMakeLists.txt
include lllc/*.cpp
include lllc/CMakeLists.txt
include sc/*.cpp
include sc/CMakeLists.txt
include README.md
include BuildInfo.sh

23
libethereum/PeerServer.cpp

@ -213,14 +213,21 @@ void PeerServer::populateAddresses()
if (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST)) if (getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST))
continue; continue;
// TODO: Make exception safe when no internet. // TODO: Make exception safe when no internet.
auto it = r.resolve({host, "30303"}); try
bi::tcp::endpoint ep = it->endpoint(); {
bi::address ad = ep.address(); auto it = r.resolve({host, "30303"});
m_addresses.push_back(ad.to_v4()); bi::tcp::endpoint ep = it->endpoint();
bool isLocal = std::find(c_rejectAddresses.begin(), c_rejectAddresses.end(), ad) != c_rejectAddresses.end(); bi::address ad = ep.address();
if (!isLocal) m_addresses.push_back(ad.to_v4());
m_peerAddresses.push_back(ad.to_v4()); bool isLocal = std::find(c_rejectAddresses.begin(), c_rejectAddresses.end(), ad) != c_rejectAddresses.end();
clog(NetNote) << "Address: " << host << " = " << m_addresses.back() << (isLocal ? " [LOCAL]" : " [PEER]"); if (!isLocal)
m_peerAddresses.push_back(ad.to_v4());
clog(NetNote) << "Address: " << host << " = " << m_addresses.back() << (isLocal ? " [LOCAL]" : " [PEER]");
}
catch (...)
{
clog(NetNote) << "Couldn't resolve: " << host;
}
} }
} }

60
setup.py

@ -1,60 +0,0 @@
#!/usr/bin/env python
import os
import sys
from setuptools import setup
from setuptools.command.install import install
from distutils.command.build import build
from subprocess import call
# Setup.py for languages only
class build_me(build):
def run(self):
build.run(self)
# if os.uname()[0] == 'Linux' and os.geteuid() == 0:
# call(['sudo', 'apt-get', 'install', 'build-essential'])
# call(['sudo', 'apt-get', 'install', 'g++-4.8'])
# call(['sudo', 'apt-get', 'install', 'cmake'])
# call(['sudo', 'apt-get', 'install', 'libboost-all-dev'])
call(['mkdir', 'build'])
os.chdir('build')
call(['cmake', '..', '-DLANGUAGES=1'])
call(['make'])
os.chdir('..')
class install_me(install):
def run(self):
install.run(self)
os.chdir('build')
call(['make', 'install'])
os.chdir('..')
class uninstall_me():
def run(self):
sys.stderr.write("This is currently a dummy method. "
"Nothing has been uninstalled.")
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='ethereum-serpent',
version='1.4.11',
description='Serpent compiler',
maintainer='Vitalik Buterin',
maintainer_email='v@buterin.com',
license='WTFPL',
url='http://www.ethereum.org/',
long_description=read('README.md'),
cmdclass={
'build': build_me,
'install': install_me,
'uninstall': uninstall_me,
}
)
Loading…
Cancel
Save