Hello list!

I've created a Makefile for the cmus music player [1]. It compiles fine
with current trunk and works well on my two routers (D-Link DIR-825 and
Asus WL500g). Is it possible to get it included upstream so it can be
installed via opkg?

Another question regarding the Makefile: The current version depends on
libmad, libvorbisidec and libflac. Cmus supports many more input/output
plugins. What is the best way to handle that?
1. Just depend on the most common ones (current version).
2. Depend on no library, but set PKG_BUILD_DEPENDS. This way all plugins
   are installed (really small .so files, 4-20KiB), and the user can
   decide which libraries to install (like Recommends in apt) for
   himself.
3. Use Config.in like for libffmpeg.

What do you suggest?


[1] http://cmus.sourceforge.net/

Attachments:
Makefile -> packages/sound/cmus/Makefile
2 patches -> packages/sound/cmus/patches/


Johannes
#
# Copyright (C) 2011 Johannes Weißl <[email protected]>
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=cmus
PKG_VERSION:=2.3.5
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-v$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/cmus
PKG_MD5SUM:=535a7567ee4cbfa2de8957907a649908

PKG_INSTALL:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/cmus-v$(PKG_VERSION)

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk

define Package/cmus
  SECTION:=sound
  CATEGORY:=Sound
  DEPENDS:= \
        +libpthread +librt +libncursesw $(ICONV_DEPENDS) \
        +AUDIO_SUPPORT:alsa-lib \
        +BUILD_PATENTED:libmad +libvorbisidec +libflac
  TITLE:=C* Music Player
  URL:=http://cmus.sourceforge.net/
endef

define Package/cmus/description
        C* Music Player is a modular and very configurable ncurses-based
        audio player. It has some interesting features like configurable
        colorscheme, mp3 and ogg streaming, it can be controlled with an
        UNIX socket, filters, album/artists sorting and a vi-like
        configuration interface.
endef

define Build/Configure
        # this is *NOT* GNU configure
        ( cd $(PKG_BUILD_DIR); \
                CROSS="$(TARGET_CROSS)" \
                CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) 
-I$(ICONV_PREFIX)/include" \
                LDFLAGS="$(TARGET_LDFLAGS) 
-Wl,-rpath-link=$(STAGING_DIR)/usr/lib -L$(ICONV_PREFIX)/lib" \
                PKG_CONFIG_PATH="$(STAGING_DIR)/usr/lib/pkgconfig" \
                PKG_CONFIG_LIBDIR="$(STAGING_DIR)/usr/lib/pkgconfig" \
                ./configure \
                prefix="/usr" \
                CONFIG_FLAC=a \
                CONFIG_MAD=$(if $(CONFIG_BUILD_PATENTED),a,n) \
                CONFIG_MODPLUG=n \
                CONFIG_MIKMOD=n \
                CONFIG_MPC=n \
                CONFIG_VORBIS=a \
                CONFIG_TREMOR=y \
                CONFIG_WAVPACK=n \
                CONFIG_MP4=n \
                CONFIG_AAC=n \
                CONFIG_FFMPEG=n \
                CONFIG_ROAR=n \
                CONFIG_PULSE=n \
                CONFIG_ALSA=$(if $(CONFIG_AUDIO_SUPPORT),a,n) \
                CONFIG_AO=n \
                CONFIG_ARTS=n \
                CONFIG_OSS=y \
                CONFIG_SUN=n \
                CONFIG_WAVEOUT=n \
                DEBUG=0 \
        )
endef

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                DESTDIR="$(PKG_INSTALL_DIR)" \
                V=$(V) \
                install
endef

define Package/cmus/install
        $(INSTALL_DIR) $(1)/usr/bin
        $(INSTALL_DIR) $(1)/usr/lib/cmus/ip
        $(INSTALL_DIR) $(1)/usr/lib/cmus/op
        $(INSTALL_DIR) $(1)/usr/share/cmus
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cmus $(1)/usr/bin/
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/ip/*.so $(1)/usr/lib/cmus/ip/
        $(CP) $(PKG_INSTALL_DIR)/usr/lib/cmus/op/*.so $(1)/usr/lib/cmus/op/
        $(CP) $(PKG_INSTALL_DIR)/usr/share/cmus/{rc,default.theme} 
$(1)/usr/share/cmus/
endef

$(eval $(call BuildPackage,cmus))

From 859fe7166cc0809a7045a086c77d3df4fd214e7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= <[email protected]>
Date: Fri, 1 Apr 2011 02:13:29 +0200
Subject: [PATCH 1/2] openwrt: allow overriding charset with CMUS_CHARSET environment variable

nl_langinfo(CODESET) always returns "ASCII".
---
 ui_curses.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/ui_curses.c b/ui_curses.c
index 49fe706..b1d1463 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -2243,11 +2243,14 @@ int main(int argc, char *argv[])
 	}
 
 	setlocale(LC_CTYPE, "");
+	charset = getenv("CMUS_CHARSET");
+	if (!charset) {
 #ifdef CODESET
-	charset = nl_langinfo(CODESET);
+		charset = nl_langinfo(CODESET);
 #else
-	charset = "ISO-8859-1";
+		charset = "ISO-8859-1";
 #endif
+	}
 	if (strcmp(charset, "UTF-8") == 0)
 		using_utf8 = 1;
 
-- 
1.7.4.1

From e86749a2880a9a4eada9f43290fb63eeb93358f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= <[email protected]>
Date: Fri, 1 Apr 2011 02:14:43 +0200
Subject: [PATCH 2/2] openwrt: do not use ACS_VLINE

Problems when cmus is run in screen.
---
 ui_curses.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ui_curses.c b/ui_curses.c
index b1d1463..5afd578 100644
--- a/ui_curses.c
+++ b/ui_curses.c
@@ -891,7 +891,7 @@ static void draw_separator(void)
 	mvaddch(0, tree_win_w, ' ');
 	bkgdset(pairs[CURSED_SEPARATOR]);
 	for (row = 1; row < LINES - 3; row++)
-		mvaddch(row, tree_win_w, ACS_VLINE);
+		mvaddch(row, tree_win_w, '|');
 }
 
 static void do_update_view(int full)
-- 
1.7.4.1

Attachment: pgpDu4otISzfZ.pgp
Description: PGP signature

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to