Browse Source

Fix windows build

pull/92/head
FireMartZ 6 years ago
parent
commit
5c6d026d3c
  1. 6
      configure.ac
  2. 6
      depends/hosts/mingw32.mk
  3. 4
      depends/packages/bdb.mk
  4. 4
      depends/packages/rust.mk
  5. 3
      src/crypto/equihash.cpp
  6. 14
      src/metrics.cpp
  7. 2
      zcutil/build-win.sh

6
configure.ac

@ -437,10 +437,10 @@ if test x$use_hardening != xno; then
HARDENED_CPPFLAGS="$HARDENED_CPPFLAGS -D_FORTIFY_SOURCE=2"
],[AC_MSG_ERROR(Cannot enable -D_FORTIFY_SOURCE=2)])
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
if test x$TARGET_OS != xwindows; then
AX_CHECK_LINK_FLAG([[-Wl,-z,relro]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,relro"],[AC_MSG_ERROR(Cannot enable RELRO)])
AX_CHECK_LINK_FLAG([[-Wl,-z,now]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -Wl,-z,now"],[AC_MSG_ERROR(Cannot enable BIND_NOW)])
# All windows code is PIC, forcing it on just adds useless compile warnings
AX_CHECK_COMPILE_FLAG([-fPIE],[HARDENED_CXXFLAGS="$HARDENED_CXXFLAGS -fPIE"],[AC_MSG_ERROR(Cannot enable -fPIE)])
AX_CHECK_LINK_FLAG([[-pie]], [HARDENED_LDFLAGS="$HARDENED_LDFLAGS -pie"],[AC_MSG_ERROR(Cannot enable -pie)])

6
depends/hosts/mingw32.mk

@ -1,5 +1,7 @@
mingw32_CFLAGS=-pipe
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
mingw32_CC=x86_64-w64-mingw32-gcc-posix
mingw32_CXX=x86_64-w64-mingw32-g++-posix
mingw32_CFLAGS=-pipe -fopenmp -DPTW32_STATIC_LIB
mingw32_CXXFLAGS=$(mingw32_CFLAGS) -std=c++11
mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)

4
depends/packages/bdb.mk

@ -15,6 +15,10 @@ define $(package)_config_cmds
../dist/$($(package)_autoconf)
endef
define $(package)_preprocess_cmds
sed -i -e "s/WinIoCtl.h/winioctl.h/g" src/dbinc/win_db.h
endef
define $(package)_build_cmds
$(MAKE) libdb_cxx-6.2.a libdb-6.2.a
endef

4
depends/packages/rust.mk

@ -1,8 +1,8 @@
package=rust
$(package)_version=1.16.0
$(package)_download_path=https://static.rust-lang.org/dist
$(package)_file_name_linux=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
$(package)_sha256_hash_linux=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
$(package)_file_name=rust-$($(package)_version)-x86_64-unknown-linux-gnu.tar.gz
$(package)_sha256_hash=48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd
$(package)_file_name_darwin=rust-$($(package)_version)-x86_64-apple-darwin.tar.gz
$(package)_sha256_hash_darwin=2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926

3
src/crypto/equihash.cpp

@ -17,6 +17,9 @@
#endif
#include "crypto/equihash.h"
#ifndef __linux__
#include "compat/endian.h"
#endif
#include "util.h"
#include <algorithm>

14
src/metrics.cpp

@ -16,7 +16,12 @@
#include <boost/thread.hpp>
#include <boost/thread/synchronized_value.hpp>
#include <string>
#include <sys/ioctl.h>
#ifdef WIN32
#include <io.h>
#include <windows.h>
#else
#include <sys/ioctl.h>
#endif
#include <unistd.h>
void AtomicTimer::start()
@ -443,11 +448,18 @@ void ThreadShowMetricsScreen()
// Get current window size
if (isTTY) {
#ifdef WIN32
CONSOLE_SCREEN_BUFFER_INFO csbi;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
cols = csbi.srWindow.Right - csbi.srWindow.Left + 1;
#else
cols = 80;
struct winsize w;
w.ws_col = 0;
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1 && w.ws_col != 0) {
cols = w.ws_col;
}
#endif
}
if (isScreen) {

2
zcutil/build-win.sh

@ -11,7 +11,7 @@ cd "$(dirname "$(readlink -f "$0")")/.."
cd depends/ && make HOST=$HOST V=1 NO_QT=1 && cd ../
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site CXXFLAGS+=" -fopenmp" ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared --disable-zmq --disable-rust --disable-proton
sed -i 's/-lboost_system-mt /-lboost_system-mt-s /' configure
CXXFLAGS="-DPTW32_STATIC_LIB -DCURVE_ALT_BN128 -fopenmp -pthread" CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --prefix="${PREFIX}" --host=x86_64-w64-mingw32 --enable-static --disable-shared --disable-zmq --disable-rust --disable-proton
cd src/
CC="${CC}" CXX="${CXX}" make V=1 -j4 hushd.exe hush-cli.exe hush-tx.exe

Loading…
Cancel
Save