Browse Source

Some additional debian build stuff fixed for alethzero rename.

CMake install executables with make install.
cl-refactor
Gav Wood 11 years ago
parent
commit
53c3d1cf2a
  1. 2
      CMakeLists.txt
  2. 1
      alethzero/CMakeLists.txt
  3. 4
      debian/control
  4. 4
      debian/rules
  5. 3
      eth/CMakeLists.txt
  6. 36
      libethereum/PeerNetwork.cpp

2
CMakeLists.txt

@ -1,5 +1,5 @@
project(ethereum)
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.9)
set(CMAKE_AUTOMOC ON)

1
alethzero/CMakeLists.txt

@ -14,3 +14,4 @@ qt5_wrap_ui(ui_Main.h Main.ui)
qt5_use_modules(alethzero Widgets Network )
target_link_libraries(alethzero ethereum)
install( TARGETS alethzero RUNTIME DESTINATION bin )

4
debian/control

@ -22,8 +22,8 @@ Depends: libethereum (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends},
Description: The future of computational social contracts. Dev Files.
A long description of libethereum. Dev Files.
Package: alephzero
Package: alethzero
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libethereum (= ${binary:Version}), qtbase5
Description: The Qt-based Ethereum GUI.
A long description of alephzero.
A long description of alethzero.

4
debian/rules

@ -22,11 +22,9 @@ export DH_OPTIONS
override_dh_auto_configure:
cmake -DCMAKE_INSTALL_PREFIX=$(CURDIR)/debian/libethereum-dev/usr .
cd alephzero && qmake alephzero.pro INCLUDEPATH=$(CURDIR) QMAKE_LIBDIR=$(CURDIR)/libethereum
override_dh_auto_build:
$(MAKE) -j8
cd alephzero && $(MAKE) -j8
override_dh_auto_install:
$(MAKE) install
@ -34,5 +32,5 @@ override_dh_auto_install:
mkdir -p $(CURDIR)/debian/libethereum/usr
mv $(CURDIR)/debian/libethereum-dev/usr/lib $(CURDIR)/debian/libethereum/usr/lib
mkdir -p $(CURDIR)/debian/alephzero/usr/bin
install -m 755 -s alephzero/alephzero $(CURDIR)/debian/alephzero/usr/bin
mv $(CURDIR)/debian/libethereum-dev/usr/bin/alethzero $(CURDIR)/debian/alethzero/usr/lib

3
eth/CMakeLists.txt

@ -17,3 +17,6 @@ target_link_libraries(eth gmp)
target_link_libraries(eth boost_system)
target_link_libraries(eth boost_filesystem)
target_link_libraries(eth ${CMAKE_THREAD_LIBS_INIT})
install( TARGETS eth RUNTIME DESTINATION bin )

36
libethereum/PeerNetwork.cpp

@ -606,8 +606,10 @@ struct UPnP
string externalIP()
{
char addr[16];
UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, addr);
return addr;
if (!UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, addr))
return addr;
else
return "0.0.0.0";
}
int addRedirect(char const* addr, int port)
@ -695,7 +697,7 @@ struct UPnP
class NoNetworking: public std::exception {};
PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, short _port, NodeMode _m, string const& _publicAddress):
PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch, uint _networkId, short _port, NodeMode _m, string const& _publicAddress, bool _upnp):
m_clientVersion(_clientVersion),
m_mode(_m),
m_listenPort(_port),
@ -705,7 +707,7 @@ PeerServer::PeerServer(std::string const& _clientVersion, BlockChain const& _ch,
m_requiredNetworkId(_networkId)
{
populateAddresses();
determinePublic(_publicAddress);
determinePublic(_publicAddress, _upnp);
ensureAccepting();
if (m_verbosity)
cout << "Mode: " << (_m == NodeMode::PeerServer ? "PeerServer" : "Full") << endl;
@ -732,12 +734,14 @@ PeerServer::~PeerServer()
delete m_upnp;
}
void PeerServer::determinePublic(string const& _publicAddress)
void PeerServer::determinePublic(string const& _publicAddress, bool _upnp)
{
m_upnp = new UPnP;
if (m_upnp->isValid() && m_peerAddresses.size())
if (_upnp)
m_upnp = new UPnP;
bi::tcp::resolver r(m_ioService);
if (m_upnp && m_upnp->isValid() && m_peerAddresses.size())
{
bi::tcp::resolver r(m_ioService);
cout << "external addr: " << m_upnp->externalIP() << endl;
int p = m_upnp->addRedirect(m_peerAddresses[0].to_string().c_str(), m_listenPort);
if (!p)
@ -747,15 +751,27 @@ void PeerServer::determinePublic(string const& _publicAddress)
p = m_listenPort;
}
if (m_upnp->externalIP() == string("0.0.0.0") && _publicAddress.empty())
auto eip = m_upnp->externalIP();
if (eip == string("0.0.0.0") && _publicAddress.empty())
m_public = bi::tcp::endpoint(bi::address(), p);
else
{
auto it = r.resolve({_publicAddress.empty() ? m_upnp->externalIP() : _publicAddress, toString(p)});
auto it = r.resolve({_publicAddress.empty() ? eip : _publicAddress, toString(p)});
m_public = it->endpoint();
m_addresses.push_back(m_public.address().to_v4());
}
}
else
{
// No UPnP - fallback on given public address or, if empty, the assumed peer address.
if (_publicAddress.size())
m_public = r.resolve({_publicAddress, toString(m_listenPort)})->endpoint();
else if (m_peerAddresses.size())
m_public = r.resolve({m_peerAddresses[0].to_string(), toString(m_listenPort)})->endpoint();
else
m_public = bi::tcp::endpoint(bi::address(), m_listenPort);
m_addresses.push_back(m_public.address().to_v4());
}
/* int er;
UPNPDev* dlist = upnpDiscover(250, 0, 0, 0, 0, &er);
for (UPNPDev* d = dlist; d; d = dlist->pNext)

Loading…
Cancel
Save