From 8cbf2435f690eaf51b89deb2f90933ec75a72d3f Mon Sep 17 00:00:00 2001 From: Guillem Castro Date: Fri, 10 Feb 2023 13:24:03 +0100 Subject: [PATCH] Remove FLAC dependency --- .github/workflows/rust.yml | 36 +++++++++++++++++++++++++++--------- Cargo.lock | 32 ++++++++++++++++++++++---------- Cargo.toml | 8 ++++---- build.rs | 29 ----------------------------- 4 files changed, 53 insertions(+), 52 deletions(-) delete mode 100644 build.rs diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e0a6bda..a313993 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -3,8 +3,6 @@ name: Rust on: push: branches: [ "master" ] - pull_request: - branches: [ "master" ] env: CARGO_TERM_COLOR: always @@ -12,16 +10,36 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} + strategy: + fail-fast: false + matrix: + platform: [macos-latest, ubuntu-latest, windows-latest] + include: + - platform: macos-latest + target: macos + - platform: ubuntu-latest + target: linux64 + - platform: windows-latest + target: win64 + # platform: [ubuntu-latest] steps: - uses: actions/checkout@v3 - - name: Install Dependencies - run: sudo apt install libflac-dev build-essential pkg-config alsa libasound2-dev + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + - if: matrix.platform == 'ubuntu-latest' + run: | + apt-get update + apt-get install -y libasound2-dev gcc alsa - name: Build - run: cargo build --verbose --release - - name: Run tests - run: cargo test --verbose + run: | + cargo build --verbose --release + - name: Rename binary + run: | + mv target/release/spotify-dl target/release/spotify-dl.${{ matrix.target }} - uses: "marvinpinto/action-automatic-releases@latest" with: repo_token: "${{ secrets.GITHUB_TOKEN }}" @@ -30,4 +48,4 @@ jobs: title: "Latest Build" files: | LICENSE - target/release/spotify-dl + target/release/spotify-dl* diff --git a/Cargo.lock b/Cargo.lock index 0a51969..f1682f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -270,6 +270,15 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "cmake" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +dependencies = [ + "cc", +] + [[package]] name = "combine" version = "4.6.4" @@ -475,19 +484,13 @@ dependencies = [ [[package]] name = "flac-bound" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "750099df417963398b7d52cfbdbda53aa20c64d553d33cacedc872fa30cb8a00" +checksum = "d438dc79612e982e62d0d86a1fd434b4f536cddf156ce02063cd56fc3d8d426c" dependencies = [ - "flac-sys", + "libflac-sys", ] -[[package]] -name = "flac-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5ccca1896065c6c3927147467ab3d042565607c01194e36560e84344a02c5c0" - [[package]] name = "flate2" version = "1.0.24" @@ -961,6 +964,16 @@ version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +[[package]] +name = "libflac-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358a7beee1a8a2b28876814d6dbf06126255b062a59f02779143ec68cb9e54e7" +dependencies = [ + "cmake", + "libc", +] + [[package]] name = "libloading" version = "0.7.3" @@ -1911,7 +1924,6 @@ dependencies = [ "futures-state-stream", "indicatif", "librespot", - "pkg-config", "regex", "rpassword", "structopt", diff --git a/Cargo.toml b/Cargo.toml index 70ffc32..46ab953 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "spotify-dl" version = "0.1.0" authors = ["Guillem Castro "] edition = "2018" -links = "FLAC" +#links = "FLAC" [dependencies] futures = "0.1" @@ -13,12 +13,12 @@ rpassword = "5.0" indicatif = "0.15.0" librespot = "0.3.1" tokio = { version = "1.18.2", features = ["rt"] } -flac-bound = { version = "0.2.0" } +flac-bound = { version = "0.3.0", default-features = false, features = ["libflac-noogg"] } audiotags = "0.2.7182" regex = "1.7.1" [package.metadata.deb] depends="libflac-dev" -[build-dependencies] -pkg-config = "0.3.16" +# [build-dependencies] +# pkg-config = "0.3.16" diff --git a/build.rs b/build.rs deleted file mode 100644 index 6e716ec..0000000 --- a/build.rs +++ /dev/null @@ -1,29 +0,0 @@ -use std::env; -use std::fs; -use std::path::Path; - -fn main() { - let library = pkg_config::Config::new().probe("flac").unwrap(); - let profile = env::var_os("PROFILE").unwrap(); - - let lib_flac_from = String::from( - if env::consts::OS == "macos"{ - "libFLAC.dylib" - } - else{ - "libFLAC.so" - } - ); - let lib_flac_to = String::from( - if env::consts::OS == "macos"{ - "libFLAC.dylib" - } - else{ - "libflac.so" - } - ); - let from = library.link_paths.get(0).unwrap().join(lib_flac_from); - let to = Path::new("target").join(profile).join("deps").join(lib_flac_to); - fs::copy(from, to).unwrap(); - println!("cargo:rerun-if-changed=build.rs"); -}