new package: mympd (#8244)

This commit is contained in:
xtkoba 2021-12-20 18:40:23 +09:00 committed by GitHub
parent 50b9308a9b
commit f8448679ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 0 deletions

17
packages/mympd/build.sh Normal file
View File

@ -0,0 +1,17 @@
TERMUX_PKG_HOMEPAGE=https://jcorporation.github.io/myMPD/
TERMUX_PKG_DESCRIPTION="A standalone and lightweight web-based MPD client"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=8.1.6
TERMUX_PKG_SRCURL=https://github.com/jcorporation/myMPD/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=eddeec8e598aca50e47d6da7f09103f2772d763abb65df7da2599013056a00ef
TERMUX_PKG_DEPENDS="libflac, libid3tag, openssl, pcre, resolv-conf"
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
CFLAGS+=" -I$TERMUX_PKG_SRCDIR/release"
ln -sfT ../dist src/dist
sh build.sh createassets
cd release
}

View File

@ -0,0 +1,11 @@
--- a/dist/src/libmpdclient/include/config.h
+++ b/dist/src/libmpdclient/include/config.h
@@ -11,7 +11,7 @@
#define DEFAULT_PORT 6600
-#define DEFAULT_SOCKET "/var/run/mpd/socket"
+#define DEFAULT_SOCKET "@TERMUX_PREFIX@/var/run/mpd/socket"
#define ENABLE_TCP

View File

@ -0,0 +1,14 @@
--- a/src/lib/http_client.c
+++ b/src/lib/http_client.c
@@ -22,9 +22,9 @@
//read resolv.conf directly - musl does not support res_init
sds buffer = sdsempty();
errno = 0;
- FILE *fp = fopen("/etc/resolv.conf", OPEN_FLAGS_READ);
+ FILE *fp = fopen("@TERMUX_PREFIX@/etc/resolv.conf", OPEN_FLAGS_READ);
if (fp == NULL) {
- MYMPD_LOG_WARN("Can not open /etc/resolv.conf");
+ MYMPD_LOG_WARN("Can not open @TERMUX_PREFIX@/etc/resolv.conf");
MYMPD_LOG_ERRNO(errno);
return buffer;
}

View File

@ -0,0 +1,34 @@
--- a/src/mpd_client/mpd_client_autoconf.c
+++ b/src/mpd_client/mpd_client_autoconf.c
@@ -102,12 +102,12 @@
}
//check for socket
- if (access("/run/mpd/socket", F_OK ) == 0) { /* Flawfinder: ignore */
- mympd_state->mpd_state->mpd_host = sds_replace(mympd_state->mpd_state->mpd_host, "/run/mpd/socket");
+ if (access("@TERMUX_PREFIX@/var/run/mpd/socket", F_OK ) == 0) { /* Flawfinder: ignore */
+ mympd_state->mpd_state->mpd_host = sds_replace(mympd_state->mpd_state->mpd_host, "@TERMUX_PREFIX@/var/run/mpd/socket");
return;
}
- if (access("/var/run/mpd/socket", F_OK ) == 0) { /* Flawfinder: ignore */
- mympd_state->mpd_state->mpd_host = sds_replace(mympd_state->mpd_state->mpd_host, "/var/run/mpd/socket");
+ if (access("@TERMUX_PREFIX@/run/mpd/socket", F_OK ) == 0) { /* Flawfinder: ignore */
+ mympd_state->mpd_state->mpd_host = sds_replace(mympd_state->mpd_state->mpd_host, "@TERMUX_PREFIX@/run/mpd/socket");
return;
}
}
@@ -116,10 +116,10 @@
static sds _find_mpd_conf(void) {
const char *filenames[] = {
- "/etc/mpd.conf",
- "/usr/local/etc/mpd.conf",
- "/etc/opt/mpd/mpd.conf",
- "/etc/opt/mpd.conf",
+ "@TERMUX_PREFIX@/etc/mpd.conf",
+ "@TERMUX_PREFIX@/local/etc/mpd.conf",
+ "@TERMUX_PREFIX@/etc/opt/mpd/mpd.conf",
+ "@TERMUX_PREFIX@/etc/opt/mpd.conf",
NULL
};

View File

@ -0,0 +1,11 @@
--- a/src/mpd_shared.c
+++ b/src/mpd_shared.c
@@ -24,7 +24,7 @@
mpd_state->mpd_keepalive = false;
mpd_state->mpd_timeout = 10000;
mpd_state->state = MPD_STATE_UNKNOWN;
- mpd_state->mpd_host = sdsnew("/run/mpd/socket");
+ mpd_state->mpd_host = sdsnew("@TERMUX_PREFIX@/var/run/mpd/socket");
mpd_state->mpd_port = 6600;
mpd_state->mpd_pass = sdsempty();
mpd_state->mpd_binarylimit = 8192;

View File

@ -0,0 +1,11 @@
--- a/src/mympd_api/mympd_api_utility.c
+++ b/src/mympd_api/mympd_api_utility.c
@@ -96,7 +96,7 @@
void mympd_state_default(struct t_mympd_state *mympd_state) {
mympd_state->music_directory = sdsnew("auto");
mympd_state->music_directory_value = sdsempty();
- mympd_state->playlist_directory = sdsnew("/var/lib/mpd/playlists");
+ mympd_state->playlist_directory = sdsnew("@TERMUX_PREFIX@/var/lib/mpd/playlists");
mympd_state->jukebox_mode = JUKEBOX_OFF;
mympd_state->jukebox_playlist = sdsnew("Database");
mympd_state->jukebox_unique_tag.len = 1;