Skip to content

Commit

Permalink
Merge branch 'monero-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
U65535F authored Feb 14, 2025
2 parents 1f14a22 + 257db6d commit 9158feb
Show file tree
Hide file tree
Showing 60 changed files with 870 additions and 569 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
- uses: ./.github/actions/set-make-job-count
- name: install dependencies
run: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf@21 ccache
brew link protobuf@21 boost
HOMEBREW_NO_AUTO_UPDATE=1 brew install boost hidapi openssl zmq miniupnpc expat libunwind-headers protobuf ccache
- name: build
run: |
${{env.CCACHE_SETTINGS}}
Expand Down Expand Up @@ -132,10 +131,6 @@ jobs:
fail-fast: false
matrix:
include:
# Oldest supported Ubuntu LTS version
- name: Ubuntu 20.04
container: ubuntu:20.04

# Most popular Ubuntu LTS version
- name: Ubuntu 22.04
container: ubuntu:22.04
Expand Down Expand Up @@ -172,11 +167,11 @@ jobs:
test-ubuntu:
name: "${{ matrix.name }} (tests)"
needs: build-ubuntu
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Oldest supported Ubuntu LTS version
- name: Ubuntu 20.04
container: ubuntu:20.04
container:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/guix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ on:
- 'contrib/guix/**'
- '!contrib/**.md'
- '.github/workflows/guix.yml'
- '**/Cargo.lock'
pull_request:
paths:
- 'contrib/depends/**'
- 'contrib/guix/**'
- '!contrib/**.md'
- '.github/workflows/guix.yml'
- '**/Cargo.lock'

jobs:
cache-sources:
Expand Down
52 changes: 10 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -393,20 +393,11 @@ endif()
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_SOURCE_DIR}/cmake")

if (NOT DEFINED ENV{DEVELOPER_LOCAL_TOOLS})
message(STATUS "Could not find DEVELOPER_LOCAL_TOOLS in env (not required)")
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
elseif ("$ENV{DEVELOPER_LOCAL_TOOLS}" EQUAL 1)
message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 1")
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT ON)
else()
message(STATUS "Found: env DEVELOPER_LOCAL_TOOLS = 0")
set(BOOST_IGNORE_SYSTEM_PATHS_DEFAULT OFF)
option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost installation" OFF)
if (BOOST_IGNORE_SYSTEM_PATHS)
set(Boost_NO_SYSTEM_PATHS TRUE)
endif()

message(STATUS "BOOST_IGNORE_SYSTEM_PATHS defaults to ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT}")
option(BOOST_IGNORE_SYSTEM_PATHS "Ignore boost system paths for local boost installation" ${BOOST_IGNORE_SYSTEM_PATHS_DEFAULT})

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
enable_testing()

Expand Down Expand Up @@ -462,7 +453,7 @@ endif()

include_directories(external/rapidjson/include external/easylogging++ src contrib/epee/include external external/supercop/include)

if(MSVC OR MINGW)
if(MINGW)
set(DEFAULT_STATIC true)
else()
set(DEFAULT_STATIC false)
Expand All @@ -485,23 +476,15 @@ endif()
set(PIC_FLAG "-fPIC")

if(STATIC)
if(MSVC)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .dll.a .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
endif()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DZMQ_STATIC")
endif()

option(SANITIZE "Use ASAN memory sanitizer" OFF)
if(SANITIZE)
if (MSVC)
message(FATAL_ERROR "Cannot sanitize with MSVC")
else()
message(STATUS "Using ASAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()
message(STATUS "Using ASAN")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
endif()

# Set default blockchain storage location:
Expand Down Expand Up @@ -606,7 +589,7 @@ function(set_default_arch)
set(ARCH ${ARCH} CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
endfunction()

if (NOT (MSVC OR ARCH))
if (NOT ARCH)
set_default_arch()
endif()

Expand Down Expand Up @@ -688,16 +671,6 @@ endif()
# Trezor support check
include(CheckTrezor)

if(MSVC)
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /D__SSE4_1__")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Dinline=__inline")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760")
if(STATIC)
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
string(REPLACE "/MD" "/MT" ${VAR} "${${VAR}}")
endforeach()
endif()
else()
include(TestCXXAcceptsFlag)
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
if(ARCH STREQUAL "default")
Expand Down Expand Up @@ -1041,11 +1014,6 @@ else()
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${STATIC_FLAGS} ")
endif()
endif()

if (${BOOST_IGNORE_SYSTEM_PATHS} STREQUAL "ON")
set(Boost_NO_SYSTEM_PATHS TRUE)
endif()

set(OLD_LIB_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(Boost_NO_BOOST_CMAKE ON)
Expand Down Expand Up @@ -1109,7 +1077,7 @@ elseif(DRAGONFLY)
set(EXTRA_LIBRARIES execinfo ${COMPAT})
elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)")
set(EXTRA_LIBRARIES socket nsl resolv)
elseif(NOT MSVC AND NOT DEPENDS)
elseif(NOT DEPENDS)
find_library(RT rt)
find_library(Z z)
set(EXTRA_LIBRARIES ${RT} ${Z})
Expand Down
2 changes: 1 addition & 1 deletion contrib/brew/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ brew "doxygen"
brew "graphviz"
brew "libunwind-headers"
brew "xz"
brew "protobuf@21", link: true
brew "protobuf"
brew "libusb"
2 changes: 1 addition & 1 deletion contrib/depends/funcs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ $(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"
$(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)"
$(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)"
$(1)_autoconf=./configure --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)"
$(1)_autoconf=./configure --host=$($($(1)_type)_host) --prefix=$($($(1)_type)_prefix) --with-pic $$($(1)_config_opts) CC="$$($(1)_cc)" CXX="$$($(1)_cxx)"

ifeq ($(filter $(1),libusb unbound),)
$(1)_autoconf += --disable-dependency-tracking
Expand Down
22 changes: 17 additions & 5 deletions contrib/depends/hosts/android.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
ANDROID_API=21

ifeq ($(host_arch),arm)
host_toolchain=arm-linux-androideabi-
host_toolchain=armv7a-linux-androideabi$(ANDROID_API)-
else ifeq ($(host_arch),aarch64)
host_toolchain=aarch64-linux-android$(ANDROID_API)-
endif

android_CC=$(host_toolchain)clang
android_CXX=$(host_toolchain)clang++
android_RANLIB=:
clear_guix_env=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
-u LIBRARY_PATH

android_CC=$(clear_guix_env) $(build_prefix)/bin/$(host_toolchain)clang
android_CXX=$(clear_guix_env) $(build_prefix)/bin/$(host_toolchain)clang++

android_AR=llvm-ar
android_RANLIB=llvm-ranlib

android_CFLAGS=-pipe
android_CXXFLAGS=$(android_CFLAGS)
Expand All @@ -20,4 +28,8 @@ android_debug_CXXFLAGS=$(android_debug_CFLAGS)

android_native_toolchain=android_ndk

android_cmake_system=Android
# CMake 3.24 fails to detect API level for Android, even if set explicitly in
# toolchain.cmake. It also tries to manually construct paths to clang(++), but we
# want it to always use the options defined here. It's easier to just pretend
# we're a generic Linux target, than to hack around it.
android_cmake_system=Linux
24 changes: 5 additions & 19 deletions contrib/depends/packages/android_ndk.mk
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
package=android_ndk
$(package)_version=18b
$(package)_version=27c
$(package)_download_path=https://dl.google.com/android/repository/
$(package)_file_name=android-ndk-r$($(package)_version)-linux-x86_64.zip
$(package)_sha256_hash=4f61cbe4bbf6406aa5ef2ae871def78010eed6271af72de83f8bd0b07a9fd3fd
$(package)_patches=api_definition.patch fix_env.patch

define $(package)_set_vars
$(package)_config_opts_arm=--arch arm
$(package)_config_opts_aarch64=--arch arm64
endef
$(package)_file_name=android-ndk-r$($(package)_version)-linux.zip
$(package)_sha256_hash=59c2f6dc96743b5daf5d1626684640b20a6bd2b1d85b13156b90333741bad5cc

define $(package)_extract_cmds
echo $($(package)_sha256_hash) $($(1)_source_dir)/$($(package)_file_name) | sha256sum -c &&\
unzip -q $($(1)_source_dir)/$($(package)_file_name)
endef

define $(package)_preprocess_cmds
cd android-ndk-r$($(package)_version) && \
patch -p1 < $($(package)_patch_dir)/api_definition.patch && \
patch -p1 < $($(package)_patch_dir)/fix_env.patch
endef

define $(package)_stage_cmds
python3 android-ndk-r$($(package)_version)/build/tools/make_standalone_toolchain.py --api 21 \
--install-dir $(build_prefix) --stl=libc++ $($(package)_config_opts) &&\
mv $(build_prefix) $($(package)_staging_dir)/$(host_prefix)
mkdir -p $($(package)_staging_prefix_dir) && \
mv android-ndk-r$($(package)_version)/toolchains/llvm/prebuilt/linux-x86_64/* $($(package)_staging_prefix_dir)
endef

4 changes: 2 additions & 2 deletions contrib/depends/packages/darwin_sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $(package)_sha256_hash=df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717
# our own version of readline.

define $(package)_stage_cmds
mkdir -p $($(package)_staging_dir)/$(host_prefix)/native/SDK &&\
mkdir -p $($(package)_staging_prefix_dir)/SDK &&\
rm -rf usr/include/readline && \
mv * $($(package)_staging_dir)/$(host_prefix)/native/SDK
mv * $($(package)_staging_prefix_dir)/SDK
endef
4 changes: 2 additions & 2 deletions contrib/depends/packages/freebsd_base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ endef
# statically link our own version of OpenSSL.

define $(package)_stage_cmds
mkdir $($(package)_staging_dir)/$(host_prefix)/native &&\
mkdir $($(package)_staging_prefix_dir) &&\
rm -rf usr/include/openssl &&\
mv lib usr $($(package)_staging_dir)/$(host_prefix)/native
mv lib usr $($(package)_staging_prefix_dir)
endef
4 changes: 2 additions & 2 deletions contrib/depends/packages/libusb.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ endef

define $(package)_set_vars
$(package)_config_opts=--disable-shared
$(package)_config_opts_linux=--with-pic --disable-udev
$(package)_config_opts_linux=--disable-udev
$(package)_config_opts_mingw32=--disable-udev
$(package)_config_opts_darwin=--disable-udev
$(package)_config_opts_freebsd=--with-pic --disable-udev
$(package)_config_opts_freebsd=--disable-udev
endef

define $(package)_config_cmds
Expand Down
9 changes: 4 additions & 5 deletions contrib/depends/packages/openssl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ $(package)_version=3.0.13
$(package)_download_path=https://www.openssl.org/source
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=88525753f79d3bec27d2fa7c66aa0b92b3aa9498dafd93d7cfa4b3780cdae313

# The bundled ranlib in Android NDK 18b inserts timestamps by default.
# To prevent reproducibility issues, we must enable [D]eterministic mode.
$(package)_patches=fix-android.patch

define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
$(package)_config_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native" PATH="$(host_prefix)/native/bin" CC=clang AR=ar RANLIB="ranlib -D"
$(package)_config_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native" PATH="$(host_prefix)/native/bin"
$(package)_build_env_android=ANDROID_NDK_ROOT="$(host_prefix)/native"
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl --libdir=$(host_prefix)/lib
$(package)_config_opts+=no-capieng
Expand Down Expand Up @@ -52,7 +50,8 @@ $(package)_config_opts_x86_64_freebsd=BSD-x86_64
endef

define $(package)_preprocess_cmds
sed -i.old 's|crypto ssl apps util tools fuzz providers doc|crypto ssl util tools providers|' build.info
sed -i.old 's|crypto ssl apps util tools fuzz providers doc|crypto ssl util tools providers|' build.info && \
patch -p1 < $($(package)_patch_dir)/fix-android.patch
endef

define $(package)_config_cmds
Expand Down
1 change: 0 additions & 1 deletion contrib/depends/packages/unbound.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix)
$(package)_config_opts+=--with-libexpat=no --with-ssl=$(host_prefix) --with-libevent=no
$(package)_config_opts+=--without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix)
$(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes
$(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread"
Expand Down
2 changes: 0 additions & 2 deletions contrib/depends/packages/zeromq.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ $(package)_sha256_hash=6653ef5910f17954861fe72332e68b03ca6e4d9c7160eb3a8de5a5a91

define $(package)_set_vars
$(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve
$(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic
$(package)_cxxflags=-std=c++11
endef

Expand Down
15 changes: 0 additions & 15 deletions contrib/depends/patches/android_ndk/api_definition.patch

This file was deleted.

30 changes: 0 additions & 30 deletions contrib/depends/patches/android_ndk/fix_env.patch

This file was deleted.

27 changes: 27 additions & 0 deletions contrib/depends/patches/openssl/fix-android.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
OpenSSL's build system tries to be helpful by constructing the compiler name
for us. This doesn't work with our setup. Instead, we want it to use
$($(package)_cc), to ensure certain environment flags are unset.

diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf
index 41ad9223e0..ea27a3bbba 100644
--- a/Configurations/15-android.conf
+++ b/Configurations/15-android.conf
@@ -124,17 +124,7 @@
$user{RANLIB} = ":";
}
} elsif ($is_standalone_toolchain) {
- my $cc = $user{CC} // "clang";
- # One can probably argue that both clang and gcc should be
- # probed, but support for "standalone toolchain" was added
- # *after* announcement that gcc is being phased out, so
- # favouring clang is considered adequate. Those who insist
- # have option to enforce test for gcc with CC=gcc.
- if (which("$triarch-$cc") !~ m|^$ndk|) {
- die "no NDK $triarch-$cc on \$PATH";
- }
- $user{CC} = $cc;
- $user{CROSS_COMPILE} = "$triarch-";
+
} elsif ($user{CC} eq "clang") {
die "no NDK clang on \$PATH";
} else {
Loading

0 comments on commit 9158feb

Please sign in to comment.