Skip to content

Commit

Permalink
Merge branch 'static-experimental' into static-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
DeckerSU committed May 31, 2023
2 parents cdb5293 + 2299923 commit 0434744
Show file tree
Hide file tree
Showing 60 changed files with 1,286 additions and 519 deletions.
16 changes: 13 additions & 3 deletions .vscode.template/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
Expand All @@ -31,15 +36,20 @@
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ Before start, read the following docs: [depends](https://github.com/bitcoin/bitc
Install dependencies:
```
sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python3-setuptools libtinfo5 xorriso
# sudo apt-get install libstdc++-$(g++ -dumpversion)-dev # in the event of errors occurring while building native_libtapi
```

Place prepared SDK file `Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz` in repo root, use `build-mac-cross.sh` script to build.

As an alternative you can download this file from [bitcoincore.org](https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz).

#### OSX (Native)
Ensure you have [brew](https://brew.sh) and Command Line Tools installed.
```shell
Expand Down Expand Up @@ -71,6 +74,19 @@ cd komodo
# This can take some time.
```

macOS 12 (Monterrey) have incompatible version of Xcode `14.2` (Build version 14C18), to build on Monterrey you'll need to install the older version `13.2.1` using the following steps:

- Download the specific Xcode 13.2.1 version from [here](https://stackoverflow.com/questions/10335747) or [here](https://developer.apple.com/services-account/download?path=/Developer_Tools/Xcode_13.2.1/Xcode_13.2.1.xip).
- [Install](https://stackoverflow.com/questions/43663097/how-to-install-xcode-from-xip-file) it.
- To set default Xcode version run this command:
```
sudo xcode-select -switch /Applications/Xcode_13.2.1.app
```
- To check default Xcode version in your system use this command:
```
xcodebuild -version
```

#### Windows
Use a debian cross-compilation setup with mingw for windows and run:
```shell
Expand Down
8 changes: 4 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 7)
define(_CLIENT_VERSION_REVISION, 2)
define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_MINOR, 8)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2022)
define(_COPYRIGHT_YEAR, 2023)
define(_COPYRIGHT_HOLDERS, "The %s developers")
define(_COPYRIGHT_HOLDERS_SUBSTITUTION, "Ocean and Decker")

Expand Down
37 changes: 37 additions & 0 deletions contrib/devtools/update-rust-hashes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash

export LC_ALL=C

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
RUST_PACKAGE="$SCRIPT_DIR/../../depends/packages/rust.mk"

RUST_VERSION=$( grep -oP "_version=\K.*" $RUST_PACKAGE )

update_hash() {
url="https://static.rust-lang.org/dist/$1-$RUST_VERSION-$2.tar.gz"
echo "Fetching $url"
hash=$( curl $url | sha256sum | awk '{print $1}' )
sed -i "/\$(package)_$3_$4=/c\\\$(package)_$3_$4=$hash" $RUST_PACKAGE
}

update_rust_hash() {
update_hash rust $1 sha256_hash $2
}

update_stdlib_hash() {
update_hash rust-std $1 rust_std_sha256_hash $1
}

# For native targets
# update_rust_hash RUST_TARGET MAKEFILE_PACKAGE_IDENTIFIER
update_rust_hash aarch64-unknown-linux-gnu aarch64_linux
update_rust_hash x86_64-apple-darwin darwin
update_rust_hash x86_64-unknown-linux-gnu linux
update_rust_hash x86_64-unknown-freebsd freebsd

# For cross-compilation targets
# update_stdlib_hash RUST_TARGET
update_stdlib_hash aarch64-unknown-linux-gnu
update_stdlib_hash x86_64-apple-darwin
update_stdlib_hash x86_64-pc-windows-gnu
update_stdlib_hash x86_64-unknown-freebsd
1 change: 1 addition & 0 deletions depends/hosts/linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ i686_linux_CXX=$(default_host_CXX) -m32
x86_64_linux_CC=$(default_host_CC) -m64
x86_64_linux_CXX=$(default_host_CXX) -m64
endif
linux_cmake_system=Linux
2 changes: 1 addition & 1 deletion depends/packages/libcurl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ $(package)_file_name=curl-$($(package)_version).tar.gz
$(package)_sha256_hash=5f85c4d891ccb14d6c3c701da3010c91c6570c3419391d485d95235253d837d7
$(package)_config_opts_linux=--disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-unknown-linux-gnu
$(package)_config_opts_mingw32=--enable-mingw --disable-shared --enable-static --prefix=$(host_prefix) --host=x86_64-w64-mingw32 --disable-ldap
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix)
$(package)_config_opts_darwin=--disable-shared --enable-static --prefix=$(host_prefix) --without-libidn2 --without-zstd
$(package)_cflags_darwin=-mmacosx-version-min=$(OSX_MIN_VERSION)
$(package)_conf_tool=./configure

Expand Down
21 changes: 12 additions & 9 deletions depends/packages/libevent.mk
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package=libevent
$(package)_version=2.1.8
$(package)_download_path=https://github.com/libevent/libevent/archive
$(package)_version=2.1.12-stable
$(package)_download_path=https://github.com/libevent/libevent/releases/download/release-$($(package)_version)/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_download_file=release-$($(package)_version)-stable.tar.gz
$(package)_sha256_hash=316ddb401745ac5d222d7c529ef1eada12f58f6376a66c1118eee803cb70f83d

define $(package)_preprocess_cmds
./autogen.sh
endef
$(package)_sha256_hash=92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb

# When building for Windows, we set _WIN32_WINNT to target the same Windows
# version as we do in configure. Due to quirks in libevents build system, this
# is also required to enable support for ipv6. See #19375.
define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress
$(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples
$(package)_config_opts += --disable-dependency-tracking --enable-option-checking
$(package)_config_opts_release=--disable-debug-mode
$(package)_config_opts_linux=--with-pic
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
endef

define $(package)_config_cmds
Expand All @@ -28,4 +28,7 @@ define $(package)_stage_cmds
endef

define $(package)_postprocess_cmds
rm lib/*.la && \
rm include/ev*.h && \
rm include/event2/*_compat.h
endef
2 changes: 2 additions & 0 deletions depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $(package)_patches += support_new_android_ndks.patch fix_android_jni_static.patc
$(package)_patches+= no_sdk_version_check.patch
$(package)_patches+= fix_lib_paths.patch fix_android_pch.patch
$(package)_patches+= qtbase-moc-ignore-gcc-macro.patch fix_limits_header.patch
$(package)_patches+= fix_cocoa_cgcolorspaceref.patch

$(package)_qttranslations_file_name=qttranslations-$($(package)_suffix)
$(package)_qttranslations_sha256_hash=577b0668a777eb2b451c61e8d026d79285371597ce9df06b6dee6c814164b7c3
Expand Down Expand Up @@ -236,6 +237,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix_lib_paths.patch && \
patch -p1 -i $($(package)_patch_dir)/qtbase-moc-ignore-gcc-macro.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_limits_header.patch && \
patch -p1 -i $($(package)_patch_dir)/fix_cocoa_cgcolorspaceref.patch && \
mkdir -p qtbase/mkspecs/macx-clang-linux &&\
cp -f qtbase/mkspecs/macx-clang/qplatformdefs.h qtbase/mkspecs/macx-clang-linux/ &&\
cp -f $($(package)_patch_dir)/mac-qmake.conf qtbase/mkspecs/macx-clang-linux/qmake.conf && \
Expand Down
13 changes: 13 additions & 0 deletions depends/patches/qt/fix_cocoa_cgcolorspaceref.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/old/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h b/new/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
index e070ba9..0896917 100644
--- a/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
+++ b/qtbase/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.h
@@ -43,6 +43,8 @@
#include <qpa/qplatformgraphicsbuffer.h>
#include <private/qcore_mac_p.h>

+#include <CoreGraphics/CGColorSpace.h>
+
QT_BEGIN_NAMESPACE

class QIOSurfaceGraphicsBuffer : public QPlatformGraphicsBuffer
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,10 @@ wallet_utility_SOURCES = wallet-utility.cpp
wallet_utility_CPPFLAGS = $(AM_CPPFLAGS) $(BITCOIN_INCLUDES)
wallet_utility_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
wallet_utility_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)

if TARGET_WINDOWS
wallet_utility_SOURCES += wallet-utility-res.rc
endif
endif

if TARGET_WINDOWS
Expand Down
4 changes: 4 additions & 0 deletions src/Makefile.ktest.include
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ komodo_test_SOURCES = \
test-komodo/test_oldhash_removal.cpp \
test-komodo/test_kmd_feat.cpp

if TARGET_WINDOWS
komodo_test_SOURCES += test-komodo/komodo-test-res.rc
endif

komodo_test_CPPFLAGS = $(komodod_CPPFLAGS)

komodo_test_LDADD = -lgtest $(komodod_LDADD)
Expand Down
3 changes: 0 additions & 3 deletions src/cc/dapps/oraclefeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ char *clonestr(char *str)
if ( str == 0 || str[0]==0)
{
myprintf("warning cloning nullstr.%p\n",str);
//#ifdef __APPLE__
// while ( 1 ) sleep(1);
//#endif
str = (char *)"<nullstr>";
}
clone = (char *)malloc(strlen(str)+16);
Expand Down
3 changes: 0 additions & 3 deletions src/cc/games/prices.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ char *clonestr(char *str)
if ( str == 0 || str[0] == 0 )
{
printf("warning cloning nullstr.%p\n",str);
#ifdef __APPLE__
while ( 1 ) sleep(1);
#endif
str = (char *)"<nullstr>";
}
len = strlen(str);
Expand Down
2 changes: 1 addition & 1 deletion src/cc/import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ int32_t CheckCODAimport(CTransaction importTx,CTransaction burnTx,std::vector<CT
{
sprintf(out + (i * 2), "%02x", hash[i]);
}
out[65]='\0';
out[64]='\0';
codaburntxid.SetHex(out);
result=CodaRPC(&retstr,"prove-payment","-address",srcaddr.c_str(),"-receipt-chain-hash",receipt.c_str(),"");
if (result==0)
Expand Down
3 changes: 0 additions & 3 deletions src/cc/rogue/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ char *clonestr(char *str)
if ( str == 0 || str[0] == 0 )
{
printf("warning cloning nullstr.%p\n",str);
#ifdef __APPLE__
while ( 1 ) sleep(1);
#endif
str = (char *)"<nullstr>";
}
clone = (char *)malloc(strlen(str)+16);
Expand Down
45 changes: 45 additions & 0 deletions src/chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

using namespace std;

#include "main.h"
#include "txdb.h"

/**
* CChain implementation
*/
Expand Down Expand Up @@ -82,6 +85,48 @@ const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
return pindex;
}

void CBlockIndex::TrimSolution()
{
AssertLockHeld(cs_main);

// We can correctly trim a solution as soon as the block index entry has been added
// to leveldb. Updates to the block index entry (to update validity status) will be
// handled by re-reading the solution from the existing db entry. It does not help to
// try to avoid these reads by gating trimming on the validity status: the re-reads are
// efficient anyway because of caching in leveldb, and most of them are unavoidable.
if (HasSolution()) {
std::vector<unsigned char> empty;
nSolution.swap(empty);
}
}

CBlockHeader CBlockIndex::GetBlockHeader() const
{
AssertLockHeld(cs_main);

CBlockHeader header;
header.nVersion = nVersion;
if (pprev) {
header.hashPrevBlock = pprev->GetBlockHash();
}
header.hashMerkleRoot = hashMerkleRoot;
header.hashFinalSaplingRoot = hashFinalSaplingRoot;
header.nTime = nTime;
header.nBits = nBits;
header.nNonce = nNonce;
if (HasSolution()) {
header.nSolution = nSolution;
} else {
CDiskBlockIndex dbindex;
if (!pblocktree->ReadDiskBlockIndex(GetBlockHash(), dbindex)) {
LogPrintf("%s: Failed to read index entry", __func__);
throw std::runtime_error("Failed to read index entry");
}
header.nSolution = dbindex.GetSolution();
}
return header;
}

/** Turn the lowest '1' bit in the binary representation of a number into a '0'. */
int static inline InvertLowestOne(int n) { return n & (n - 1); }

Expand Down
Loading

0 comments on commit 0434744

Please sign in to comment.