summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.woodpecker/linux.yaml14
-rw-r--r--README.md57
-rwxr-xr-xbuild_single.sh21
-rw-r--r--libbridge/CMakeLists.txt15
-rw-r--r--patches/monero/0005-macos-build-fix.patch115
-rw-r--r--patches/wownero/0006-macos-build-fix.patch115
6 files changed, 334 insertions, 3 deletions
diff --git a/.woodpecker/linux.yaml b/.woodpecker/linux.yaml
index 22057e9..29d6e83 100644
--- a/.woodpecker/linux.yaml
+++ b/.woodpecker/linux.yaml
@@ -21,12 +21,26 @@ steps:
image: git.mrcyjanek.net/mrcyjanek/debian:buster
commands:
- cd ${repo} && git submodule update --init --force && cd ..
+ - git config --global user.email "ci@mrcyjanek.net"
+ - git config --global user.name "CI mrcyjanek.net"
- ./apply_patches.sh ${repo}
- cd ${repo}/contrib/depends
- for i in sources built; do cp "/root/.cache/${repo}/$i" . -r || true; done
- make download
volumes:
- /opt/cache/monero_c/dotcache:/root/.cache
+ - name: x86_64-apple-darwin11
+ image: git.mrcyjanek.net/mrcyjanek/debian:bookworm
+ commands:
+ - apt update
+ - apt install -y gperf libtinfo5
+ - ./build_single.sh ${repo} x86_64-apple-darwin11 -j$(nproc)
+ - name: aarch64-apple-darwin11
+ image: git.mrcyjanek.net/mrcyjanek/debian:bookworm
+ commands:
+ - apt update
+ - apt install -y gperf libtinfo5
+ - ./build_single.sh ${repo} aarch64-apple-darwin11 -j$(nproc)
- name: x86_64-w64-mingw32
image: git.mrcyjanek.net/mrcyjanek/debian:buster
commands:
diff --git a/README.md b/README.md
index aa90603..35c17c0 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,63 @@
[![status-badge](https://ci.mrcyjanek.net/api/badges/5/status.svg?branch=rewrite-wip)](https://ci.mrcyjanek.net/repos/5/branches/rewrite-wip)
+## Building
+
+to "clean" everything:
+
+```bash
+$ rm -rf monero wownero release
+$ git submodule update --init --recursive --force
+```
+
+fix ownership (if you build in docker but clone as a local user)
+
+```bash
+$ sudo chown $(whoami) . -R
+```
+
+patch codebase
+
+```bash
+$ ./apply_patches.sh monero
+$ ./apply_patches.sh wownero
+```
+
+build monero_c
+
+```bash
+$ ./build_single.sh monero x86_64-linux-gnu -j$(nproc)
+ wownero i686-linux-gnu
+ aarch64-linux-gnu
+ x86_64-linux-android
+ i686-linux-android
+ aarch64-linux-android
+ arm-linux-androideabi
+ i686-w64-mingw32
+ x86_64-w64-mingw32
+```
+
+While building I aim to compile the code at oldest supported release of debian, using default toolchain to ensure that all linux distributions are able to run monero_c libraries, below I present a supported builders for given targets
+
+| x | builder | notes |
+| x86_64-linux-gnu | debian:buster | |
+| i686-linux-gnu | debian:buster | |
+| aarch64-linux-gnu | debian:buster | |
+| x86_64-linux-android | debian:buster | |
+| i686-linux-android | debian:buster | |
+| aarch64-linux-android | debian:buster | |
+| arm-linux-androideabi | debian:buster | |
+| i686-w64-mingw32 | debian:buster | hardcoded DLL paths in build_single.sh |
+| x86_64-w64-mingw32 | debian:buster | -"- |
+| x86_64-apple-darwin11 | debian:bookworm | extra build step: `${HOST_ABI}-ranlib $PWD/$repo/contrib/depends/${HOST_ABI}/lib/libpolyseed.a` |
+| aarch64-apple-darwin11 | debian:bookworm | -"- |
+
+Libraries on CI are build using the following docker images:
+- git.mrcyjanek.net/mrcyjanek/debian:buster
+- git.mrcyjanek.net/mrcyjanek/debian:bookworm
+
+It is entirely possible to use upstream debian:buster / debian:bookworm
+
## Contributing
To contribute you can visit git.mrcyjanek.net/mrcyjanek/monero_c and open a PR, alternatively use any other code mirror or send patches directly.
diff --git a/build_single.sh b/build_single.sh
index 2e0b3cc..85f1633 100755
--- a/build_single.sh
+++ b/build_single.sh
@@ -85,8 +85,13 @@ case "$HOST_ABI" in
;;
"x86_64-apple-darwin11")
export PATH="$WDIR/$repo/contrib/depends/x86_64-apple-darwin11/native/bin:$PATH"
- export CC="clang -stdlib=libc++ -target x86_64-apple-darwin11 -mmacosx-version-min=10.7 --sysroot /build/$repo/contrib/depends/x86_64-apple-darwin11/native/SDK/ -mlinker-version=609 -B/build/$repo/contrib/depends/x86_64-apple-darwin11/native/bin/x86_64-apple-darwin11-"
- export CXX="clang++ -stdlib=libc++ -target x86_64-apple-darwin11 -mmacosx-version-min=10.7 --sysroot /build/$repo/contrib/depends/x86_64-apple-darwin11/native/SDK/ -mlinker-version=609 -B/build/$repo/contrib/depends/x86_64-apple-darwin11/native/bin/x86_64-apple-darwin11-"
+ export CC="clang -stdlib=libc++ -target x86_64-apple-darwin11 -mmacosx-version-min=10.8 --sysroot $WDIR/$repo/contrib/depends/x86_64-apple-darwin11/native/SDK/ -mlinker-version=609 -B$WDIR/$repo/contrib/depends/x86_64-apple-darwin11/native/bin/x86_64-apple-darwin11-"
+ export CXX="clang++ -stdlib=libc++ -target x86_64-apple-darwin11 -mmacosx-version-min=10.8 --sysroot $WDIR/$repo/contrib/depends/x86_64-apple-darwin11/native/SDK/ -mlinker-version=609 -B$WDIR/$repo/contrib/depends/x86_64-apple-darwin11/native/bin/x86_64-apple-darwin11-"
+ ;;
+ "aarch64-apple-darwin11")
+ export PATH="$WDIR/$repo/contrib/depends/aarch64-apple-darwin11/native/bin:$PATH"
+ export CC="clang -stdlib=libc++ -target arm64-apple-darwin11 -mmacosx-version-min=10.8 --sysroot $WDIR/$repo/contrib/depends/aarch64-apple-darwin11/native/SDK/ -mlinker-version=609 -B$WDIR/$repo/contrib/depends/aarch64-apple-darwin11/native/bin/aarch64-apple-darwin11-"
+ export CXX="clang++ -stdlib=libc++ -target arm64-apple-darwin11 -mmacosx-version-min=10.8 --sysroot $WDIR/$repo/contrib/depends/aarch64-apple-darwin11/native/SDK/ -mlinker-version=609 -B$WDIR/$repo/contrib/depends/aarch64-apple-darwin11/native/bin/aarch64-apple-darwin11-"
;;
esac
@@ -143,6 +148,9 @@ pushd $repo/build/${HOST_ABI}
"x86_64-apple-darwin11")
env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=$buildType -D BUILD_TAG="mac-x64" ../..
;;
+ "aarch64-apple-darwin11")
+ env CC="${CC}" CXX="${CXX}" cmake -DCMAKE_TOOLCHAIN_FILE=$PWD/../../contrib/depends/${HOST_ABI}/share/toolchain.cmake -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D STATIC=ON -D ARCH="armv8-a" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=$buildType -D BUILD_TAG="mac-armv8" ../..
+ ;;
*)
echo "we don't know how to compile monero for '$HOST_ABI'"
exit 1
@@ -151,6 +159,12 @@ pushd $repo/build/${HOST_ABI}
CC=gcc CXX=g++ make wallet_api $NPROC
popd
+# Special treatment for apple
+if [[ "${HOST_ABI}" == "x86_64-apple-darwin11" || "${HOST_ABI}" == "aarch64-apple-darwin11" ]];
+then
+ ${HOST_ABI}-ranlib $PWD/$repo/contrib/depends/${HOST_ABI}/lib/libpolyseed.a
+fi
+
pushd libbridge
rm -rf build/${HOST_ABI} || true
mkdir -p build/${HOST_ABI} -p
@@ -169,6 +183,9 @@ pushd release/$repo
cp ../../$repo/build/${HOST_ABI}/external/polyseed/libpolyseed.${APPENDIX} ${HOST_ABI}_libpolyseed.${APPENDIX}
rm ${HOST_ABI}_libpolyseed.${APPENDIX}.xz || true
xz -e ${HOST_ABI}_libpolyseed.${APPENDIX}
+ elif [[ "${HOST_ABI}" == "x86_64-apple-darwin11" || "${HOST_ABI}" == "aarch64-apple-darwin11" ]];
+ then
+ APPENDIX="${APPENDIX}dylib"
else
APPENDIX="${APPENDIX}so"
fi
diff --git a/libbridge/CMakeLists.txt b/libbridge/CMakeLists.txt
index 620577f..b222f9a 100644
--- a/libbridge/CMakeLists.txt
+++ b/libbridge/CMakeLists.txt
@@ -263,12 +263,18 @@ include_directories( ${EXTERNAL_LIBS_DIR}/include )
message(STATUS EXTERNAL_LIBS_DIR : ${EXTERNAL_LIBS_DIR})
-if(${HOST_ABI} STREQUAL "x86_64-linux-gnu")
+if(${HOST_ABI} STREQUAL "x86_64-linux-gnu" OR
+ ${HOST_ABI} STREQUAL "x86_64-apple-darwin11")
set(EXTRA_LIBS "wallet-crypto")
else()
set(EXTRA_LIBS "")
endif()
+if (${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11")
+ set(EXTRA_LIBS_APPLE "-framework IOKit" "-framework CoreFoundation" "-framework Cocoa" hidapi)
+# set_target_properties(wallet2_api_c PROPERTIES LINK_FLAGS "-Wl,-F/Library/Frameworks")
+endif()
+
# target_compile_options(wallet2_api_c PRIVATE -static-libstdc++)
if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR ${HOST_ABI} STREQUAL "i686-w64-mingw32")
@@ -277,6 +283,12 @@ if(${HOST_ABI} STREQUAL "x86_64-w64-mingw32" OR ${HOST_ABI} STREQUAL "i686-w64-m
set(EXTRA_LIBS_WINDOWS wsock32 ws2_32 iconv iphlpapi crypt32 hidapi)
endif()
+if(${HOST_ABI} STREQUAL "x86_64-apple-darwin11" OR ${HOST_ABI} STREQUAL "aarch64-apple-darwin11")
+ set_target_properties(wallet2_api_c PROPERTIES SUFFIX ".dylib")
+
+ set_target_properties(wallet2_api_c PROPERTIES NO_SONAME 1)
+endif()
+
if (${MONERO_FLAVOR} STREQUAL "monero")
target_compile_definitions(wallet2_api_c PRIVATE FLAVOR_MONERO)
elseif(${MONERO_FLAVOR} STREQUAL "wownero")
@@ -334,4 +346,5 @@ target_link_libraries( wallet2_api_c
sodium
${EXTRA_LIBS_WINDOWS}
+ ${EXTRA_LIBS_APPLE}
)
diff --git a/patches/monero/0005-macos-build-fix.patch b/patches/monero/0005-macos-build-fix.patch
new file mode 100644
index 0000000..4149a02
--- /dev/null
+++ b/patches/monero/0005-macos-build-fix.patch
@@ -0,0 +1,115 @@
+From b1b150b3de4dd3197c373be39b790c31bb7ddab3 Mon Sep 17 00:00:00 2001
+From: Your Name <you@example.com>
+Date: Thu, 28 Mar 2024 02:03:08 +0100
+Subject: [PATCH] macos build fix
+
+---
+ contrib/depends/hosts/darwin.mk | 2 +
+ contrib/depends/packages/polyseed.mk | 13 +++--
+ .../polyseed/0001-disable-soname.patch | 49 +++++++++++++++++++
+ 3 files changed, 60 insertions(+), 4 deletions(-)
+ create mode 100644 contrib/depends/patches/polyseed/0001-disable-soname.patch
+
+diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
+index 79d449054..cbe795081 100644
+--- a/contrib/depends/hosts/darwin.mk
++++ b/contrib/depends/hosts/darwin.mk
+@@ -8,6 +8,8 @@ endif
+ darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)-
+ darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
+
++darwin_RANLIB=$(host_prefix)/native/bin/$(host)-ranlib
++
+ darwin_CFLAGS=-pipe
+ darwin_CXXFLAGS=$(darwin_CFLAGS)
+ darwin_ARFLAGS=cr
+diff --git a/contrib/depends/packages/polyseed.mk b/contrib/depends/packages/polyseed.mk
+index 2ddeac621..0071b20f3 100644
+--- a/contrib/depends/packages/polyseed.mk
++++ b/contrib/depends/packages/polyseed.mk
+@@ -4,18 +4,23 @@ $(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags
+ $(package)_download_file=v$($(package)_version).tar.gz
+ $(package)_file_name=$(package)-$($(package)_version).tar.gz
+ $(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a
+-$(package)_patches=force-static-mingw.patch
++$(package)_patches=force-static-mingw.patch 0001-disable-soname.patch
+
+ define $(package)_preprocess_cmds
+- patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch
++ patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch &&\
++ patch -p1 < $($(package)_patch_dir)/0001-disable-soname.patch
+ endef
+
+ define $(package)_config_cmds
+- cmake -DCMAKE_INSTALL_PREFIX=$(host_prefix) -DCMAKE_C_COMPILER=$($(package)_cc) .
++ CC="$($(package)_cc)" cmake -DCMAKE_INSTALL_PREFIX="$(host_prefix)" .
++endef
++
++define $(package)_set_vars
++ $(package)_build_opts=CC="$($(package)_cc)"
+ endef
+
+ define $(package)_build_cmds
+- $(MAKE)
++ CC="$($(package)_cc)" $(MAKE)
+ endef
+
+ define $(package)_stage_cmds
+diff --git a/contrib/depends/patches/polyseed/0001-disable-soname.patch b/contrib/depends/patches/polyseed/0001-disable-soname.patch
+new file mode 100644
+index 000000000..a261636e8
+--- /dev/null
++++ b/contrib/depends/patches/polyseed/0001-disable-soname.patch
+@@ -0,0 +1,49 @@
++From aabafcfc0572651436d024a635483c49042fad7f Mon Sep 17 00:00:00 2001
++From: Czarek Nakamoto <cyjan@mrcyjanek.net>
++Date: Thu, 28 Mar 2024 00:32:51 +0100
++Subject: [PATCH] disable soname
++
++---
++ CMakeLists.txt | 16 +++++++++-------
++ 1 file changed, 9 insertions(+), 7 deletions(-)
++
++diff --git a/CMakeLists.txt b/CMakeLists.txt
++index 8a8e7c2..5301353 100644
++--- a/CMakeLists.txt
+++++ b/CMakeLists.txt
++@@ -36,6 +36,7 @@ include_directories(polyseed
++ target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED)
++ set_target_properties(polyseed PROPERTIES VERSION 2.0.0
++ SOVERSION 2
+++ NO_SONAME 1
++ C_STANDARD 11
++ C_STANDARD_REQUIRED ON)
++
++@@ -45,16 +46,17 @@ include_directories(polyseed_static
++ include/)
++ target_compile_definitions(polyseed_static PRIVATE POLYSEED_STATIC)
++ set_target_properties(polyseed_static PROPERTIES OUTPUT_NAME polyseed
+++ NO_SONAME 1
++ C_STANDARD 11
++ C_STANDARD_REQUIRED ON)
++
++-add_executable(polyseed-tests
++- tests/tests.c)
++-include_directories(polyseed-tests
++- include/)
++-target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
++-target_link_libraries(polyseed-tests
++- PRIVATE polyseed_static)
+++# add_executable(polyseed-tests
+++# tests/tests.c)
+++# include_directories(polyseed-tests
+++# include/)
+++# target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
+++# target_link_libraries(polyseed-tests
+++# PRIVATE polyseed_static)
++
++ include(GNUInstallDirs)
++ install(TARGETS polyseed polyseed_static
++--
++2.39.2
++
+--
+2.39.2
+
diff --git a/patches/wownero/0006-macos-build-fix.patch b/patches/wownero/0006-macos-build-fix.patch
new file mode 100644
index 0000000..4149a02
--- /dev/null
+++ b/patches/wownero/0006-macos-build-fix.patch
@@ -0,0 +1,115 @@
+From b1b150b3de4dd3197c373be39b790c31bb7ddab3 Mon Sep 17 00:00:00 2001
+From: Your Name <you@example.com>
+Date: Thu, 28 Mar 2024 02:03:08 +0100
+Subject: [PATCH] macos build fix
+
+---
+ contrib/depends/hosts/darwin.mk | 2 +
+ contrib/depends/packages/polyseed.mk | 13 +++--
+ .../polyseed/0001-disable-soname.patch | 49 +++++++++++++++++++
+ 3 files changed, 60 insertions(+), 4 deletions(-)
+ create mode 100644 contrib/depends/patches/polyseed/0001-disable-soname.patch
+
+diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk
+index 79d449054..cbe795081 100644
+--- a/contrib/depends/hosts/darwin.mk
++++ b/contrib/depends/hosts/darwin.mk
+@@ -8,6 +8,8 @@ endif
+ darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)-
+ darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
+
++darwin_RANLIB=$(host_prefix)/native/bin/$(host)-ranlib
++
+ darwin_CFLAGS=-pipe
+ darwin_CXXFLAGS=$(darwin_CFLAGS)
+ darwin_ARFLAGS=cr
+diff --git a/contrib/depends/packages/polyseed.mk b/contrib/depends/packages/polyseed.mk
+index 2ddeac621..0071b20f3 100644
+--- a/contrib/depends/packages/polyseed.mk
++++ b/contrib/depends/packages/polyseed.mk
+@@ -4,18 +4,23 @@ $(package)_download_path=https://github.com/tevador/$(package)/archive/refs/tags
+ $(package)_download_file=v$($(package)_version).tar.gz
+ $(package)_file_name=$(package)-$($(package)_version).tar.gz
+ $(package)_sha256_hash=f36282fcbcd68d32461b8230c89e1a40661bd46b91109681cec637433004135a
+-$(package)_patches=force-static-mingw.patch
++$(package)_patches=force-static-mingw.patch 0001-disable-soname.patch
+
+ define $(package)_preprocess_cmds
+- patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch
++ patch -p1 < $($(package)_patch_dir)/force-static-mingw.patch &&\
++ patch -p1 < $($(package)_patch_dir)/0001-disable-soname.patch
+ endef
+
+ define $(package)_config_cmds
+- cmake -DCMAKE_INSTALL_PREFIX=$(host_prefix) -DCMAKE_C_COMPILER=$($(package)_cc) .
++ CC="$($(package)_cc)" cmake -DCMAKE_INSTALL_PREFIX="$(host_prefix)" .
++endef
++
++define $(package)_set_vars
++ $(package)_build_opts=CC="$($(package)_cc)"
+ endef
+
+ define $(package)_build_cmds
+- $(MAKE)
++ CC="$($(package)_cc)" $(MAKE)
+ endef
+
+ define $(package)_stage_cmds
+diff --git a/contrib/depends/patches/polyseed/0001-disable-soname.patch b/contrib/depends/patches/polyseed/0001-disable-soname.patch
+new file mode 100644
+index 000000000..a261636e8
+--- /dev/null
++++ b/contrib/depends/patches/polyseed/0001-disable-soname.patch
+@@ -0,0 +1,49 @@
++From aabafcfc0572651436d024a635483c49042fad7f Mon Sep 17 00:00:00 2001
++From: Czarek Nakamoto <cyjan@mrcyjanek.net>
++Date: Thu, 28 Mar 2024 00:32:51 +0100
++Subject: [PATCH] disable soname
++
++---
++ CMakeLists.txt | 16 +++++++++-------
++ 1 file changed, 9 insertions(+), 7 deletions(-)
++
++diff --git a/CMakeLists.txt b/CMakeLists.txt
++index 8a8e7c2..5301353 100644
++--- a/CMakeLists.txt
+++++ b/CMakeLists.txt
++@@ -36,6 +36,7 @@ include_directories(polyseed
++ target_compile_definitions(polyseed PRIVATE POLYSEED_SHARED)
++ set_target_properties(polyseed PROPERTIES VERSION 2.0.0
++ SOVERSION 2
+++ NO_SONAME 1
++ C_STANDARD 11
++ C_STANDARD_REQUIRED ON)
++
++@@ -45,16 +46,17 @@ include_directories(polyseed_static
++ include/)
++ target_compile_definitions(polyseed_static PRIVATE POLYSEED_STATIC)
++ set_target_properties(polyseed_static PROPERTIES OUTPUT_NAME polyseed
+++ NO_SONAME 1
++ C_STANDARD 11
++ C_STANDARD_REQUIRED ON)
++
++-add_executable(polyseed-tests
++- tests/tests.c)
++-include_directories(polyseed-tests
++- include/)
++-target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
++-target_link_libraries(polyseed-tests
++- PRIVATE polyseed_static)
+++# add_executable(polyseed-tests
+++# tests/tests.c)
+++# include_directories(polyseed-tests
+++# include/)
+++# target_compile_definitions(polyseed-tests PRIVATE POLYSEED_STATIC)
+++# target_link_libraries(polyseed-tests
+++# PRIVATE polyseed_static)
++
++ include(GNUInstallDirs)
++ install(TARGETS polyseed polyseed_static
++--
++2.39.2
++
+--
+2.39.2
+