Remove FLAC dependency

This commit is contained in:
Guillem Castro 2023-02-10 13:24:03 +01:00
parent 5c842b6a2e
commit 8cbf2435f6
4 changed files with 53 additions and 52 deletions

View file

@ -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*

32
Cargo.lock generated
View file

@ -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",

View file

@ -3,7 +3,7 @@ name = "spotify-dl"
version = "0.1.0"
authors = ["Guillem Castro <guillemcastro4@gmail.com>"]
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"

View file

@ -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");
}