diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..998d09ff --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,4 @@ +[env] +# point bindgen at LLVM on OpenBSD +# required to build at least clang-sys, sndio-sys and cpal +LIBCLANG_PATH = { value = "/usr/local/lib" } diff --git a/Cargo.lock b/Cargo.lock index fa9422ca..303f6d71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,9 +32,9 @@ dependencies = [ [[package]] name = "alsa" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c4da790adcb2ce5e758c064b4f3ec17a30349f9961d3e5e6c9688b052a9e18" +checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" dependencies = [ "alsa-sys", "bitflags", @@ -141,21 +141,26 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bindgen" -version = "0.56.0" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", + "cfg-if 0.1.10", "clang-sys", + "clap", + "env_logger 0.7.1", "lazy_static", "lazycell", + "log", "peeking_take_while", "proc-macro2", "quote", "regex", "rustc-hash", "shlex", + "which", ] [[package]] @@ -298,15 +303,30 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.3.0" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa66045b9cb23c2e9c1520732030608b02ee07e5cfaa5a521ec15ded7fa24c90" +checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ "glob", "libc", "libloading", ] +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", +] + [[package]] name = "cocoa" version = "0.24.0" @@ -429,9 +449,9 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.8" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa" +checksum = "17f73df0f29f4c3c374854f076c47dc018f19acaa63538880dba0937ad4fa8d7" dependencies = [ "bindgen", ] @@ -439,8 +459,7 @@ dependencies = [ [[package]] name = "cpal" version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98f45f0a21f617cd2c788889ef710b63f075c949259593ea09c826f1e47a2418" +source = "git+https://github.com/conwayste/cpal?branch=aaron/openbsd_sndio_host#bd1da413a5cad1038152c2f8340e97b946fee162" dependencies = [ "alsa", "core-foundation-sys", @@ -450,11 +469,12 @@ dependencies = [ "lazy_static", "libc", "mach", - "ndk 0.3.0", - "ndk-glue 0.3.0", + "ndk", + "ndk-glue", "nix", "oboe", "parking_lot", + "sndio-sys", "stdweb", "thiserror", "web-sys", @@ -538,7 +558,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "strsim", + "strsim 0.9.3", "syn", ] @@ -724,6 +744,19 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.8.4" @@ -731,7 +764,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3" dependencies = [ "atty", - "humantime", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -744,7 +777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" dependencies = [ "atty", - "humantime", + "humantime 2.1.0", "log", "regex", "termcolor", @@ -1137,6 +1170,15 @@ dependencies = [ "digest", ] +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + [[package]] name = "humantime" version = "2.1.0" @@ -1330,11 +1372,11 @@ dependencies = [ [[package]] name = "libloading" -version = "0.7.2" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ - "cfg-if 1.0.0", + "cc", "winapi 0.3.9", ] @@ -1428,18 +1470,6 @@ dependencies = [ "adler32", ] -[[package]] -name = "ndk" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8794322172319b972f528bf90c6b467be0079f1fa82780ffb431088e741a73ab" -dependencies = [ - "jni-sys", - "ndk-sys", - "num_enum", - "thiserror", -] - [[package]] name = "ndk" version = "0.4.0" @@ -1453,20 +1483,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "ndk-glue" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5caf0c24d51ac1c905c27d4eda4fa0635bbe0de596b8f79235e0b17a4d29385" -dependencies = [ - "lazy_static", - "libc", - "log", - "ndk 0.3.0", - "ndk-macro", - "ndk-sys", -] - [[package]] name = "ndk-glue" version = "0.4.0" @@ -1476,7 +1492,7 @@ dependencies = [ "lazy_static", "libc", "log", - "ndk 0.4.0", + "ndk", "ndk-macro", "ndk-sys", ] @@ -1502,14 +1518,15 @@ checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" [[package]] name = "nix" -version = "0.20.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" dependencies = [ "bitflags", "cc", "cfg-if 1.0.0", "libc", + "memoffset", ] [[package]] @@ -1634,8 +1651,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e15e22bc67e047fe342a32ecba55f555e3be6166b04dd157cd0f803dfa9f48e1" dependencies = [ "jni", - "ndk 0.4.0", - "ndk-glue 0.4.0", + "ndk", + "ndk-glue", "num-derive", "num-traits", "oboe-sys", @@ -2033,6 +2050,12 @@ dependencies = [ "quick-protobuf", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quick-protobuf" version = "0.8.0" @@ -2359,6 +2382,16 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +[[package]] +name = "sndio-sys" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0005ce55e70c5a0680a8f2f03d39f6185f7b17206bc784867657ebe938636f90" +dependencies = [ + "bindgen", + "libc", +] + [[package]] name = "socks" version = "0.3.3" @@ -2400,6 +2433,12 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "strsim" version = "0.9.3" @@ -2567,6 +2606,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.30" @@ -2818,6 +2866,12 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +[[package]] +name = "unicode-width" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" + [[package]] name = "unicode-xid" version = "0.2.2" @@ -2867,6 +2921,12 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14706d2a800ee8ff38c1d3edb873cd616971ea59eb7c0d046bb44ef59b06a1ae" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version-compare" version = "0.0.11" @@ -2979,6 +3039,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "which" +version = "3.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" +dependencies = [ + "libc", +] + [[package]] name = "winapi" version = "0.2.8" diff --git a/Cargo.toml b/Cargo.toml index de74cb55..a2981821 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,5 @@ opt-level = 2 piet = { git = "https://github.com/jpochyla/piet", branch = "ctfont-cache" } piet-common = { git = "https://github.com/jpochyla/piet", branch = "ctfont-cache" } piet-coregraphics = { git = "https://github.com/jpochyla/piet", branch = "ctfont-cache" } +# (not merged yet) solve panic at startup: "Add support for OpenBSD platform via sndio host" https://github.com/RustAudio/cpal/pull/493 +cpal = { git = "https://github.com/conwayste/cpal", branch = "aaron/openbsd_sndio_host" } diff --git a/README.md b/README.md index 3ae82b3a..b97a0b9f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Psst -Fast Spotify client with native GUI, without Electron, built in Rust. Very early in development, lacking in features, stability, and general user experience. It is being tested only on Mac so far, but aims for full Windows and Linux support. Contributions welcome! +Fast Spotify client with native GUI, without Electron, built in Rust. Very early in development, lacking in features, stability, and general user experience. It is being tested only on Mac so far, but aims for full Windows, Linux and BSD support. Contributions welcome! **Note:** Spotify Premium account is required. @@ -28,9 +28,21 @@ RHEL/Fedora: sudo dnf install openssl-devel gtk3-devel cairo-devel ``` +##### BSD + +Similar to Linux, Druid defaults to GTK while providing an X11 backend as well. +So far, only OpenBSD/amd64 has been tested, but other platforms should work as well. +Furthermore, bindgen must be able to find LLVM through the expected environment variable. + +OpenBSD: +```shell +doas pkg_add gtk+3 cairo llvm +export LIBCLANG_PATH=/usr/local/lib +``` + ##### Building -On all platforms, the **latest Rust stable** (at least 1.54.0) is needed. +On all platforms, the **latest Rust stable** (at least 1.56.0) is needed. Development build: ```shell diff --git a/psst-core/src/audio/source.rs b/psst-core/src/audio/source.rs index 979d568e..674e96d5 100644 --- a/psst-core/src/audio/source.rs +++ b/psst-core/src/audio/source.rs @@ -67,7 +67,8 @@ where let output_frames = output.chunks_exact_mut(self.output_channels); for (i, o) in input_frames.zip(output_frames) { o[0] = i[0]; - o[1] = i[1]; + // XXX on OpenBSD, there is only one channel. + //o[1] = i[1]; // Assume the rest is is implicitly silence. } output.len()