pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

spotifyd: Try to simplify the package mostly based on ncspot



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Tue Jul 20 19:56:52 2021 +0200
Changeset:	769a6924f63dce345a458e60c49f604e7ca9b23e

Modified Files:
	spotifyd/Makefile
	spotifyd/TODO
Added Files:
	spotifyd/options.mk

Log Message:
spotifyd: Try to simplify the package mostly based on ncspot

 - Introduce a backend option group to select audio backend and prefers
  `portaudio'
 - Remove CHECK_WRKREF_SKIP: it does not seem no longer needed
 - Use CARGO_NO_DEFAULT_FEATURES instead of directly adjusting CARGO_ARGS

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=769a6924f63dce345a458e60c49f604e7ca9b23e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 spotifyd/Makefile   | 18 +++++++-----------
 spotifyd/TODO       |  7 -------
 spotifyd/options.mk | 30 ++++++++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 18 deletions(-)

diffs:
diff --git a/spotifyd/Makefile b/spotifyd/Makefile
index c1b4694055..64c3baa2e8 100644
--- a/spotifyd/Makefile
+++ b/spotifyd/Makefile
@@ -1,7 +1,7 @@
 # $NetBSD$
 
 DISTNAME=	spotifyd-0.3.2
-PKGREVISION=	1
+PKGREVISION=	2
 CATEGORIES=	audio
 MASTER_SITES=	${MASTER_SITE_GITHUB:=Spotifyd/}
 GITHUB_TAG=	v${PKGVERSION_NOREV}
@@ -13,6 +13,7 @@ COMMENT=	Open source Spotify client running as a UNIX daemon
 LICENSE=	gnu-gpl-v3
 
 USE_LANGUAGES=	c # rust, but needs a toolchain to link
+USE_TOOLS+=	pkg-config
 
 DISTFILES=	${DEFAULT_DISTFILES}
 
@@ -421,15 +422,12 @@ CARGO_CRATE_DEPENDS+=	winreg-0.6.2
 CARGO_CRATE_DEPENDS+=	ws2_32-sys-0.2.1
 CARGO_CRATE_DEPENDS+=	xdg-2.2.0
 
-
-MAKE_ENV+=		OPENSSL_DIR=${BUILDLINK_PREFIX.openssl:Q}
 INSTALLATION_DIRS+=	bin
 
-RUSTFLAGS+=		-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.pulseaudio}/lib
-RUSTFLAGS+=		-C link-arg=-L${BUILDLINK_PREFIX.pulseaudio}/lib
+MAKE_ENV+=		OPENSSL_DIR=${BUILDLINK_PREFIX.openssl:Q}
+RUSTFLAGS+=		-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}/lib
 
-# TODO investigate why this is needed
-CHECK_WRKREF_SKIP+=	bin/spotifyd
+CARGO_NO_DEFAULT_FEATURES=	YES
 
 #  NOTE: To update this package currently you need to something like this:
 #  1. Update version in makefile
@@ -446,14 +444,12 @@ CHECK_WRKREF_SKIP+=	bin/spotifyd
 #  12. That might fail. Need to update patches, etc with help of `pkgvi` and `pkgdiff`, e.g: `pkgdiff Cargo.lock.orig Cargo.lock > ../../patches/patch-Cargo.lock`, etc
 #  13. If patches updated `make mdi`
 
-CARGO_NO_DEFAULT_FEATURES=	YES
-CARGO_FEATURES+=		pulseaudio_backend
-
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/target/release/spotifyd ${DESTDIR}${PREFIX}/bin
 
+.include "options.mk"
+
 BUILDLINK_API_DEPENDS.rust+=   rust>=1.40.0
 .include "../../lang/rust/cargo.mk"
-.include "../../audio/pulseaudio/buildlink3.mk"
 .include "../../security/openssl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/spotifyd/TODO b/spotifyd/TODO
index 279ae9a191..ab5960df8f 100644
--- a/spotifyd/TODO
+++ b/spotifyd/TODO
@@ -1,13 +1,6 @@
 This package has known vulnerabilities, please investigate and fix if possible:
   CVE-2020-35711
 
-## Todo
-
-1. In the Makefile there is this todo item:
-
-		# TODO investigate why this is needed
-		CHECK_WRKREF_SKIP+=	bin/spotifyd
-
 ## Done
 
 1. Need to somewhat manually create patches. mkpatches doesn't pick up changes
diff --git a/spotifyd/options.mk b/spotifyd/options.mk
new file mode 100644
index 0000000000..64240d99b6
--- /dev/null
+++ b/spotifyd/options.mk
@@ -0,0 +1,30 @@
+# $NetBSD: options.mk,v 1.2 2020/10/20 22:54:40 tnn Exp $
+
+PKG_OPTIONS_VAR=		PKG_OPTIONS.spotifyd
+PKG_OPTIONS_OPTIONAL_GROUPS=	backend
+PKG_OPTIONS_GROUP.backend=	alsa portaudio pulseaudio rodio
+
+PKG_SUGGESTED_OPTIONS=		portaudio
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Malsa)
+CARGO_FEATURES+=	alsa_backend
+RUSTFLAGS+=		-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.alsa-lib}/lib
+.include "../../audio/alsa-lib/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mportaudio)
+CARGO_FEATURES+=	portaudio_backend
+RUSTFLAGS+=		-C link-arg=${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.portaudio}/${BUILDLINK_LIBDIRS.portaudio}
+.include "../../audio/portaudio/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mpulseaudio)
+CARGO_FEATURES+=	pulseaudio_backend
+.include "../../audio/pulseaudio/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Mrodio)
+CARGO_FEATURES+=	rodio_backend
+.endif


Home | Main Index | Thread Index | Old Index