From 88865e2663b5269e64317d13d1346645af057e66 Mon Sep 17 00:00:00 2001 From: parazyd Date: Tue, 6 Jun 2023 14:01:27 +0200 Subject: [PATCH] drk: Replace "play" with "rodio". Fun police go away. This removes the deps on pkgconfig and libmpg123, and should ease the build process for non GNU/Linux operating systems. --- Cargo.lock | 395 ++++++++++++++++-- README.md | 4 +- bin/drk/Cargo.toml | 5 +- bin/drk/build.rs | 26 -- bin/drk/src/cli_util.rs | 36 +- bin/drk/src/main.rs | 10 +- bin/drk/src/wallet_money.rs | 4 +- contrib/dependency_setup.sh | 44 +- contrib/docker/Dockerfile.alpine | 2 +- .../docker/Dockerfile.alpineARMviaEmulation | 2 +- contrib/docker/Dockerfile.debian | 2 +- contrib/docker/Dockerfile.fedora | 2 +- contrib/docker/Dockerfile.ubuntu | 2 +- .../docker/Dockerfile.ubuntuARMviaEmulation | 2 +- 14 files changed, 407 insertions(+), 129 deletions(-) delete mode 100644 bin/drk/build.rs diff --git a/Cargo.lock b/Cargo.lock index 2d3605358..d7ff0ca55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -58,6 +58,28 @@ dependencies = [ "memchr", ] +[[package]] +name = "alsa" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44" +dependencies = [ + "alsa-sys", + "bitflags", + "libc", + "nix 0.24.3", +] + +[[package]] +name = "alsa-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +dependencies = [ + "libc", + "pkg-config", +] + [[package]] name = "android_system_properties" version = "0.1.5" @@ -392,6 +414,26 @@ version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +[[package]] +name = "bindgen" +version = "0.64.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" +dependencies = [ + "bitflags", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 1.0.109", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -575,6 +617,24 @@ name = "cc" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] [[package]] name = "cfg-if" @@ -632,6 +692,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" version = "2.34.0" @@ -730,6 +801,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "combine" +version = "4.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" +dependencies = [ + "bytes", + "memchr", +] + [[package]] name = "concurrent-queue" version = "2.2.0" @@ -770,10 +851,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.4", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -817,6 +904,26 @@ dependencies = [ "libc", ] +[[package]] +name = "coreaudio-rs" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" +dependencies = [ + "bitflags", + "core-foundation-sys 0.6.2", + "coreaudio-sys", +] + +[[package]] +name = "coreaudio-sys" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f034b2258e6c4ade2f73bf87b21047567fb913ee9550837c2316d139b0262b24" +dependencies = [ + "bindgen", +] + [[package]] name = "corosensei" version = "0.1.3" @@ -830,6 +937,31 @@ dependencies = [ "windows-sys 0.33.0", ] +[[package]] +name = "cpal" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c" +dependencies = [ + "alsa", + "core-foundation-sys 0.8.4", + "coreaudio-rs", + "dasp_sample", + "jni 0.19.0", + "js-sys", + "libc", + "mach2", + "ndk", + "ndk-context", + "oboe", + "once_cell", + "parking_lot 0.12.1", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "windows 0.46.0", +] + [[package]] name = "cpufeatures" version = "0.2.7" @@ -1114,7 +1246,7 @@ version = "3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7394a21d012ce5c850497fb774b167d81b99f060025fbf06ee92b9848bd97eb2" dependencies = [ - "nix", + "nix 0.26.2", "windows-sys 0.48.0", ] @@ -1526,6 +1658,12 @@ dependencies = [ "rand", ] +[[package]] +name = "dasp_sample" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" + [[package]] name = "data-encoding" version = "2.4.0" @@ -1696,10 +1834,9 @@ dependencies = [ "darkfi-money-contract", "darkfi-sdk", "darkfi-serial", - "pkg-config", - "play", "prettytable-rs", "rand", + "rodio", "serde_json", "signal-hook", "signal-hook-async-std", @@ -2480,11 +2617,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", - "core-foundation-sys", + "core-foundation-sys 0.8.4", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows 0.48.0", ] [[package]] @@ -2661,6 +2798,49 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +[[package]] +name = "jni" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" +dependencies = [ + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + [[package]] name = "jpeg-decoder" version = "0.3.0" @@ -2694,6 +2874,12 @@ dependencies = [ "spin 0.5.2", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "leb128" version = "0.2.5" @@ -2788,6 +2974,15 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" +dependencies = [ + "libc", +] + [[package]] name = "maybe-rayon" version = "0.1.1" @@ -2828,6 +3023,26 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "minimp3" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985438f75febf74c392071a975a29641b420dd84431135a6e6db721de4b74372" +dependencies = [ + "minimp3-sys", + "slice-deque", + "thiserror", +] + +[[package]] +name = "minimp3-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e21c73734c69dc95696c9ed8926a2b393171d98b3f5f5935686a26a487ab9b90" +dependencies = [ + "cc", +] + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -2866,14 +3081,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" [[package]] -name = "mpg123-sys" -version = "0.6.0" +name = "ndk" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75c26239d85c1423091c109fcdabbcfaac868576dc018b0e959137217907610" +checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags", + "jni-sys", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.4.1+23.1.7779620" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" +dependencies = [ + "jni-sys", +] + +[[package]] +name = "nix" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +dependencies = [ + "bitflags", + "cfg-if", "libc", - "pkg-config", ] [[package]] @@ -2909,6 +3153,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -2970,6 +3225,27 @@ dependencies = [ "libc", ] +[[package]] +name = "num_enum" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "num_threads" version = "0.1.6" @@ -3000,6 +3276,29 @@ dependencies = [ "memchr", ] +[[package]] +name = "oboe" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" +dependencies = [ + "jni 0.20.0", + "ndk", + "ndk-context", + "num-derive", + "num-traits", + "oboe-sys", +] + +[[package]] +name = "oboe-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" +dependencies = [ + "cc", +] + [[package]] name = "once_cell" version = "1.17.1" @@ -3012,17 +3311,6 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" -[[package]] -name = "out123-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da977be7c4b44e2ad26be779aafc1761a89bd2ee6e363770bb71eb67a00d2e5" -dependencies = [ - "libc", - "mpg123-sys", - "pkg-config", -] - [[package]] name = "parking" version = "2.1.0" @@ -3117,6 +3405,12 @@ dependencies = [ "rustc_version", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "pem" version = "1.1.1" @@ -3180,17 +3474,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "play" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c570085654588139e9ea2f452fe7dcb78d576da4f1c04d58b98b32fc42744ff0" -dependencies = [ - "libc", - "mpg123-sys", - "out123-sys", -] - [[package]] name = "plotters" version = "0.3.4" @@ -3472,6 +3755,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "raw-window-handle" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" + [[package]] name = "rayon" version = "1.7.0" @@ -3653,12 +3942,28 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "rodio" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf1d4dea18dff2e9eb6dca123724f8b60ef44ad74a9ad283cdfe025df7e73fa" +dependencies = [ + "cpal", + "minimp3", +] + [[package]] name = "rustc-demangle" version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustc_version" version = "0.3.3" @@ -3889,6 +4194,12 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "shlex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" + [[package]] name = "signal-hook" version = "0.3.15" @@ -4003,6 +4314,17 @@ dependencies = [ "sled", ] +[[package]] +name = "slice-deque" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31ef6ee280cdefba6d2d0b4b78a84a1c1a3f3a4cec98c2d4231c8bc225de0f25" +dependencies = [ + "libc", + "mach", + "winapi", +] + [[package]] name = "slice-group-by" version = "0.3.1" @@ -5197,6 +5519,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows" version = "0.48.0" diff --git a/README.md b/README.md index 21f5b32fc..38de36949 100644 --- a/README.md +++ b/README.md @@ -47,15 +47,13 @@ The following dependencies are also required: | make | make | | jq | jq | | gcc | gcc | -| pkg-config | pkg-config | -| libmpg123 | libmpg123-dev | Users of Debian-based systems (e.g. Ubuntu) can simply run the following to install the required dependencies: ```shell # apt-get update -# apt-get install -y git make jq gcc pkg-config libmpg123-dev +# apt-get install -y git make jq gcc ``` Alternatively, users can try using the automated script under `contrib` diff --git a/bin/drk/Cargo.toml b/bin/drk/Cargo.toml index 9eb2a3a47..65c40d83e 100644 --- a/bin/drk/Cargo.toml +++ b/bin/drk/Cargo.toml @@ -8,9 +8,6 @@ repository = "https://github.com/darkrenaissance/darkfi" license = "AGPL-3.0-only" edition = "2021" -[build-dependencies] -pkg-config = "0.3.26" - [dependencies] anyhow = "1.0.71" async-std = {version = "1.12.0", features = ["attributes"]} @@ -32,4 +29,4 @@ signal-hook-async-std = "0.2.2" signal-hook = "0.3.15" sqlx = {version = "0.6.3", features = ["runtime-async-std-rustls", "sqlite"]} url = "2.3.1" -play = {version = "0.5.3", optional = true} +rodio = {version = "0.17.1", default-features = false, features = ["minimp3"]} diff --git a/bin/drk/build.rs b/bin/drk/build.rs deleted file mode 100644 index 72e0255a3..000000000 --- a/bin/drk/build.rs +++ /dev/null @@ -1,26 +0,0 @@ -/* This file is part of DarkFi (https://dark.fi) - * - * Copyright (C) 2020-2023 Dyne.org foundation - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -use pkg_config::probe_library; - -fn main() { - #[cfg(target_os = "linux")] - if probe_library("libout123").is_ok() && probe_library("libmpg123").is_ok() { - println!("cargo:rustc-cfg=feature=\"play\""); - } -} diff --git a/bin/drk/src/cli_util.rs b/bin/drk/src/cli_util.rs index e6e4c42ef..89e984742 100644 --- a/bin/drk/src/cli_util.rs +++ b/bin/drk/src/cli_util.rs @@ -15,11 +15,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -use std::{path::Path, process::exit}; +use std::{io::Cursor, process::exit}; -use async_std::{fs::File, io::WriteExt}; -use darkfi::{util::parse::decode_base10, Result}; +use darkfi::{ + util::{async_util::sleep, parse::decode_base10}, + Result, +}; use darkfi_sdk::crypto::TokenId; +use rodio::{source::Source, Decoder, OutputStream}; use super::Drk; @@ -67,21 +70,22 @@ pub async fn parse_token_pair(drk: &Drk, s: &str) -> Result<(TokenId, TokenId)> } /// Fun police go away -pub async fn kaching() -> Result<()> { - #[cfg(feature = "play")] - { - const WALLET_MP3: &[u8] = include_bytes!("../wallet.mp3"); - const MP3_DROP: &str = "/tmp/wallet.mp3"; +pub async fn kaching() { + const WALLET_MP3: &[u8] = include_bytes!("../wallet.mp3"); - if !Path::new(MP3_DROP).exists() { - let mut f = File::create(MP3_DROP).await?; - f.write_all(WALLET_MP3).await?; - } + let cursor = Cursor::new(WALLET_MP3); - if play::play(MP3_DROP).is_err() { - return Ok(()) - } + let Ok((_stream, stream_handle)) = OutputStream::try_default() else { + return + }; + + let Ok(source) = Decoder::new(cursor) else { + return + }; + + if let Err(_) = stream_handle.play_raw(source.convert_samples()) { + return } - Ok(()) + sleep(2).await; } diff --git a/bin/drk/src/main.rs b/bin/drk/src/main.rs index 1efaf0a32..399ea81b4 100644 --- a/bin/drk/src/main.rs +++ b/bin/drk/src/main.rs @@ -69,7 +69,7 @@ mod rpc_blockchain; /// CLI utility functions mod cli_util; -use cli_util::{parse_token_pair, parse_value_pair}; +use cli_util::{kaching, parse_token_pair, parse_value_pair}; /// Wallet functionality related to drk operations mod wallet; @@ -104,6 +104,9 @@ struct Args { #[derive(Subcommand)] enum Subcmd { + /// Fun + Kaching, + /// Send a ping request to the darkfid RPC endpoint Ping, @@ -487,6 +490,11 @@ async fn main() -> Result<()> { } match args.command { + Subcmd::Kaching => { + kaching().await; + Ok(()) + } + Subcmd::Ping => { let drk = Drk::new(args.endpoint).await?; drk.ping().await.with_context(|| "Failed to ping darkfid RPC endpoint")?; diff --git a/bin/drk/src/wallet_money.rs b/bin/drk/src/wallet_money.rs index 96d85df98..c1f536cad 100644 --- a/bin/drk/src/wallet_money.rs +++ b/bin/drk/src/wallet_money.rs @@ -645,8 +645,8 @@ impl Drk { let _ = self.rpc_client.request(req).await?; } - if !owncoins.is_empty() && (kaching().await).is_err() { - return Ok(()) + if !owncoins.is_empty() { + kaching().await; } Ok(()) diff --git a/contrib/dependency_setup.sh b/contrib/dependency_setup.sh index 0065a689d..059b51121 100644 --- a/contrib/dependency_setup.sh +++ b/contrib/dependency_setup.sh @@ -22,12 +22,12 @@ setup_mac() { } setup_apt() { - apt_deps="git make jq gcc pkg-config libmpg123-dev" + apt_deps="git make jq gcc" $1 install $apt_deps || return 1 } setup_pacman() { - pacman_deps="git make jq gcc pkgconf mpg123" + pacman_deps="git make jq gcc" $1 -Sy $pacman_deps || return 1 } @@ -52,17 +52,17 @@ setup_zypper() { } setup_emerge() { - emerge_deps="dev-vcs/git app-misc/jq dev-util/pkgconf" + emerge_deps="dev-vcs/git app-misc/jq" $1 $emerge_deps || return 1 } setup_pkg() { - pkg_deps="git bash jq gcc findutils cantarell-fonts devel/pkgconf gmake devel/automake pulseaudio-module-sndio" + pkg_deps="git bash jq gcc findutils cantarell-fonts gmake devel/automake" $1 install -y $pkg_deps || return 1 } setup_pkg_add() { - pkg_add_deps="git bash jq gcc-11.2.0p6 findutils cantarell-fonts pkgconf gmake automake-1.15.1" + pkg_add_deps="git bash jq gcc-11.2.0p6 findutils cantarell-fonts gmake automake-1.15.1" $1 -I $pkg_add_deps || return 1 } @@ -148,40 +148,6 @@ Linux) echo "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y --default-toolchain nightly --default-host x86_64-unknown-openbsd" fi - if command -v pkg || command -v pkg_add || command -v pkgin; then - echo "Dependencies installed!" >&2 - cat <<'ENDOFCAT' >&2 -======================= -Few more things may be needed: -Install rust from https://www.rust-lang.org/tools/install -Execute: rustup target add wasm32-unknown-unknown -And apply few patches ... -cd .. -git clone --recurse-submodules -j8 https://github.com/stainless-steel/mpg123-sys -cd ./mpg123-sys -sed -e's/$(RM)/rm -f/g' -i.bak source/Makefile.in - -patch -p0 build.rs <<'EOF' -43a44 -> .arg(&format!("--with-audio=sndio")) -EOF - -cargo build # to see if it works fine - -cd ../darkfi - -patch -p0 Cargo.toml <<'EOF' -329a330 -> mpg123-sys = { path = "../mpg123-sys" } -EOF - -gmake test # no errors expected -gmake -ls -al darkfid ircd dnetview faucetd vanityaddr # list of built executables -ENDOFCAT - exit 0 - fi - echo "Error: Could not recognize your package manager." >&2 exit 1 ;; diff --git a/contrib/docker/Dockerfile.alpine b/contrib/docker/Dockerfile.alpine index bfb635daf..b9845ccda 100644 --- a/contrib/docker/Dockerfile.alpine +++ b/contrib/docker/Dockerfile.alpine @@ -42,7 +42,7 @@ RUN bash -c 'make -j test && make -j' # 3. stage FROM alpine:${ALPINE_VER} -RUN apk add --no-cache openssl ttf-opensans libgcc mpg123-libs +RUN apk add --no-cache openssl ttf-opensans libgcc WORKDIR /opt/darkfi diff --git a/contrib/docker/Dockerfile.alpineARMviaEmulation b/contrib/docker/Dockerfile.alpineARMviaEmulation index 9c5cbd9d8..e847ed8ed 100644 --- a/contrib/docker/Dockerfile.alpineARMviaEmulation +++ b/contrib/docker/Dockerfile.alpineARMviaEmulation @@ -47,7 +47,7 @@ RUN bash -c 'make -j test && make -j' # 3. stage FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${OS_VER} -RUN apk add --no-cache openssl ttf-opensans libgcc mpg123-libs +RUN apk add --no-cache openssl ttf-opensans libgcc WORKDIR /opt/darkfi diff --git a/contrib/docker/Dockerfile.debian b/contrib/docker/Dockerfile.debian index 42da97693..83b0da3bb 100644 --- a/contrib/docker/Dockerfile.debian +++ b/contrib/docker/Dockerfile.debian @@ -31,7 +31,7 @@ RUN bash -c 'make -j test && make -j all' # 2. stage FROM debian:${RUN_OS_VER} -RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 \ +RUN apt-get -y update && apt-get install -y openssl fonts-lato \ && apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /opt/darkfi diff --git a/contrib/docker/Dockerfile.fedora b/contrib/docker/Dockerfile.fedora index ddc93c13f..065722413 100644 --- a/contrib/docker/Dockerfile.fedora +++ b/contrib/docker/Dockerfile.fedora @@ -38,7 +38,7 @@ RUN bash -c 'make -j test && make -j all' # 3. stage FROM ${OS_VER} -RUN dnf -y install openssl lato-fonts mpg123-libs \ +RUN dnf -y install openssl lato-fonts \ && dnf clean all \ && rm -rf /var/cache/dnf diff --git a/contrib/docker/Dockerfile.ubuntu b/contrib/docker/Dockerfile.ubuntu index 28c55fbb8..776e5c5c8 100644 --- a/contrib/docker/Dockerfile.ubuntu +++ b/contrib/docker/Dockerfile.ubuntu @@ -40,7 +40,7 @@ RUN bash -c 'make -j test && make -j all' # 3. stage FROM ${REPOSITORY}:${RUN_OS_VER} -RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 \ +RUN apt-get -y update && apt-get install -y openssl fonts-lato \ && apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /opt/darkfi diff --git a/contrib/docker/Dockerfile.ubuntuARMviaEmulation b/contrib/docker/Dockerfile.ubuntuARMviaEmulation index e6fdbd7ab..bdd60d72a 100644 --- a/contrib/docker/Dockerfile.ubuntuARMviaEmulation +++ b/contrib/docker/Dockerfile.ubuntuARMviaEmulation @@ -44,7 +44,7 @@ RUN bash -c 'make -j test && make -j all' # 3. stage FROM --platform=$TARGETPLATFORM ${REPOSITORY}:${RUN_OS_VER} -RUN apt-get -y update && apt-get install -y openssl fonts-lato libout123-0 libmpg123-0 \ +RUN apt-get -y update && apt-get install -y openssl fonts-lato \ && apt-get clean && rm -rf /var/lib/apt/lists/* WORKDIR /opt/darkfi