MPD 0.15 and MPC 0.16

Discussion about my Wifi Radio project at http://mightyohm.com/wifiradio/ or my WL-520gU talk at NOTACON.
concord
Posts: 2
Joined: Wed Jul 01, 2009 12:43 pm
Location: Canada!

MPD 0.15 and MPC 0.16

Post by concord »

1st - Thank you MightyOhm for such an awsome and detailed project! My next step is to put together the LCD module and assemble everything into a box. I'm building this for my parents as they are not too comfortable with computers and this would solve the problem and give them a simple Internet Radio device.

2nd - MPD 0.15 went final on June 23. I've been trying for a week now to get myself familiar with OpenWRT and how to compile third party code as packages with NO luck! :( Has anyone been successful in compiling MPD 0.15 into OpenWRT? Or does anyone have a good HowTo link with some nice step by step instructions on compiling packages? The OpenWRT forums and wiki are not much help (The wiki is out of date and the few examples are for White Russian and the forums are not really noob friendly)

My desire for MPD 0.15 is because BBC World Radio and DW Radio broadcast in MMS. There are also other European stations that my parents would like to listen to that only play in MMS or RM, I know that MPD does not support RM.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: MPD 0.15 and MPC 0.16

Post by mightyohm »

I was able to compile a simple SID player using a Makefile I largely copied from some existing packages. It was somewhat painful and I'm not sure that I did things the right/easiest way, but in the end it worked! I'll dig through my files and see if I can find some files and notes that might help. As far as existing resources go, you're right, they are few and far between. :(
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: MPD 0.15 and MPC 0.16

Post by mightyohm »

Here is the Makefile I created to compile tinysid. This might help you get started.
I put this into package/tinysid after creating the new tinysid directory. I also created a "patches" subdir, I think the build process may expect this (not sure).

The weird thing about the build system is that it expects the package to be downloaded from somewhere, I had a hard time fooling it into using a local directory for the source. That's why if you look at the Makefile, it downloads a tinysid package from mightyohm.com. This was a hack, I put the source for the package into a tar.gz and uploaded it to my host. There is probably a better way to do this.

Code: Select all

#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 13857 2009-01-04 13:01:21Z michu $

include $(TOPDIR)/rules.mk

PKG_NAME:=tinysid
PKG_VERSION:=0.94
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://mightyohm.com/files/

include $(INCLUDE_DIR)/package.mk

define Package/tinysid
  SECTION:=sound
  CATEGORY:=Sound
  TITLE:=Extremely compact SID music player for Linux
  URL:=http://www.rsinsch.de/?id=7298b&s=k2&lang=en
endef

define Package/tinysid/description
	TinySID is a small C64 SID music file player.
endef

define Build/Configure
$(call Build/Configure/Default, \
	--disable-iconv \
)
endef

define Package/tinysid/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_BUILD_DIR)/tinysid $(1)/usr/bin/
endef

$(eval $(call BuildPackage,tinysid))
toolunious
Posts: 2
Joined: Sun Jul 05, 2009 11:21 am

Re: MPD 0.15 and MPC 0.16

Post by toolunious »

It's possible to use a local source instead of an external source. I stumbled upon this -pretty simple- MakeFile.

Simply replace cmdpad with the folder name of the package that you're compiling.

Code: Select all

##############################################
# OpenWrt Makefile for helloworld program
#
#
# Most of the variables used here are defined in
# the include directives below. We just need to
# specify a basic description of the package,
# where to build our program, where to find
# the source files, and where to install the
# compiled program on the router.
#
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and
# there should be no trailing whitespace in
# lines that are not commented.
#
##############################################

include $(TOPDIR)/rules.mk

# Name and release number of this package
PKG_NAME:=cmdpad
PKG_RELEASE:=0.0.3

# This specifies the directory where we're going to build the program.
# The root build directory, $(BUILD_DIR), is by default the build_mipsel
# directory in your OpenWrt SDK directory
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

# Specify package information for this program.
# The variables defined here should be self explanatory.
define Package/cmdtab
	SECTION:=utils
	CATEGORY:=Utilities
	TITLE:=Cmdtab -- prints a snarky message
	DESCRIPTION:=\
	If you can't figure out what this program does, \\\
	you're probably brain-dead and need immediate \\\
	medical attention.
endef

# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/
endef

# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one

# Specify where and how to install the program. Since we only have one file,
# the helloworld executable, install it by copying it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install
# directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the
# command to copy the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/cmdpad/install
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/cmdpad $(1)/bin/
endef

# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,cmdpad))
	
-edit Note: you have to put the source files in ~/src/ which has to be located in your package folder.
ilinux
Posts: 55
Joined: Mon Jul 06, 2009 2:36 am

Re: MPD 0.15 and MPC 0.16

Post by ilinux »

How can build the old version?
toolunious
Posts: 2
Joined: Sun Jul 05, 2009 11:21 am

Re: MPD 0.15 and MPC 0.16

Post by toolunious »

You don't have to, they are already put available by mr MightyOhm http://mightyohm.com/files/kamikaze-2.4 ... es/mipsel/
concord
Posts: 2
Joined: Wed Jul 01, 2009 12:43 pm
Location: Canada!

Re: MPD 0.15 and MPC 0.16

Post by concord »

Well thanks to both of you for trying, but I did not get any success... It won't even attempt to download the package (if I use your method MightyOhm)

This is the MakeFile I put inside packages/mpd15

Code: Select all

#
# Copyright (C) 2006 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 13857 2009-01-04 13:01:21Z michu $

include $(TOPDIR)/rules.mk
#include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=mpd15
PKG_VERSION:=0.15
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://localhost/files/

include $(INCLUDE_DIR)/package.mk

define Package/mpd15
  SECTION:=sound
  CATEGORY:=Sound
  TITLE:=MPD v0.15
  URL:=http://www.rsinsch.de/?id=7298b&s=k2&lang=en
endef

define Package/mpd15/description
   MPD 0.15.
endef

define Build/Configure
$(call Build/Configure/Default, \
   --disable-iconv \
)
endef

define Package/mpd15/install
   $(INSTALL_DIR) $(1)/usr/bin
   $(CP) $(PKG_BUILD_DIR)/mpd15 $(1)/usr/bin/
endef

$(eval $(call BuildPackage,mpd15))
I checked my Apache log files, and nothing.. :( I even created blank src and patches directories just in case.

Maybe by Christmas, OpenWRT will have compiled MPD 0.15 into their repository. I'm capable of compiling applications under linux, but this OpenWRT has me stumped.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: MPD 0.15 and MPC 0.16

Post by mightyohm »

You need to run "make menuconfig" and select the new package for it to compile. You can then build the package by either running "make" and waiting a while, or shortcut the build process by running "make package/<yourpackage>-compile V=99".

There are some notes about building packages here:
http://kamikaze.openwrt.org/docs/openwr ... 460002.1.2

and here:
http://vivekian2.wordpress.com/2007/03/ ... r-openwrt/

and here:
http://forum.openwrt.org/viewtopic.php?pid=31794

All of those pages were written for previous releases of OpenWrt, so the process they detail may not work 100%, but they are a good starting point anyway.
wiizard
Posts: 4
Joined: Tue Jul 14, 2009 10:57 am

Re: MPD 0.15 and MPC 0.16

Post by wiizard »

here's make file for mpd 0.15
compiled fine for kamikaze trunk 2.6 (wgt634u)

avail. in https://dev.openwrt.org/changeset/16880

Code: Select all

# 
# Copyright (C) 2007-2009 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:=mpd
PKG_VERSION:=0.15
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/musicpd
PKG_MD5SUM:=2ed93a60bd703ba46d6794e12cfb5f1d

include $(INCLUDE_DIR)/package.mk

define Package/mpd
  SECTION:=sound
  CATEGORY:=Sound
  DEPENDS:=+libflac +libid3tag +libmad +libvorbisidec +libpthread +glib2 +libcurl +libopenssl +libmms
  TITLE:=Music Player Daemon
  URL:=http://www.musicpd.org/
endef

define Package/mpd/description
	MPD is a music player supporting flac, mp3 and ogg files.
	It is typically controlled over a network using one of it's many
	clients including mpc(console), gmpc(gnome), phpmp(php) etc.
endef

define Package/mpd/conffiles
/etc/mpd.conf
endef

ifndef CONFIG_PACKAGE_kmod-sound-core
	EXTRA_CONFIG_PARAM:=--disable-alsa
endif
CONFIGURE_VARS += \
	CURL_LIBS="-L$(STAGING_DIR)/usr/lib -lcurl" \
	CURL_CFLAGS="-I$(STAGING_DIR)/usr/include" \
	ID3TAG_LIBS="$(TARGET_LDFLAGS) -lz -lid3tag" \
	ID3TAG_CFLAGS="$(TARGET_CPPFLAGS)" \
	FLAC_LIBS="$(TARGET_LDFLAGS) -lFLAC" \
	FLAC_CFLAGS="-I$(STAGING_DIR)/usr/include/FLAC" \
	MAD_LIBS="$(TARGET_LDFLAGS) -lmad" \
	MAD_CFLAGS="$(TARGET_CPPFLAGS)" \
	OGGVORBIS_LIBS="$(TARGET_LDLFAGS) -lvorbisidec" \
	OGGVORBIS_CFLAGS="$(TARGET_CPPFLAGS)" \
	GLIB_CFLAGS="-I$(STAGING_DIR)/usr/include/glib-2.0 -I$(STAGING_DIR)/usr/lib/glib-2.0/include" \
	GLIB_LIBS="$(TARGET_LDLFAGS) -L$(STAGING_DIR)/usr/lib/libintl/lib -lintl -L$(STAGING_DIR)/usr/lib/libiconv/lib -liconv -lglib-2.0 -lgthread-2.0 -pthread"

define Build/Configure
	$(call Build/Configure/Default, \
		$(EXTRA_CONFIG_PARAM) \
		--disable-audiofile \
		--disable-mpc \
		--disable-aac \
		--disable-lsr \
		--disable-ipv6 \
		--disable-ao \
		--disable-mvp \
		--disable-lame-encoder \
		--enable-flac \
		--enable-lastfm \
		--enable-mms \
		--with-tremor=$(STAGING_DIR)/usr/lib \
	)
endef

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

define Package/mpd/install
	$(INSTALL_DIR) $(1)/etc
	$(CP) $(PKG_BUILD_DIR)/doc/mpdconf.example $(1)/etc/mpd.conf
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/mpd $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/mpd.init $(1)/etc/init.d/mpd
endef

$(eval $(call BuildPackage,mpd))
libmms

avail. in https://dev.openwrt.org/changeset/16879

Code: Select all

# 
# Copyright (C) 2006 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:=libmms
PKG_VERSION:=0.4
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=http://code.launchpad.net/libmms/trunk/0.4/+download/
PKG_MD5SUM:=4a681a815186fe26bb1b02ccea57fb75

PKG_FIXUP:= libtool
PKG_INSTALL:= 1

include $(INCLUDE_DIR)/package.mk

define Package/libmms
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=MMS stream protocol library
  URL:=https://launchpad.net/libmms
endef

define Package/libmms/description
	LibMMS is a common library for parsing mms:// and mmsh:// type network streams. 
	These are commonly used to stream Windows Media Video content over the web. 
	LibMMS itself is only for receiving MMS stream, 
	it doesn't handle sending at all.
endef

TARGET_CFLAGS += $(FPIC)

define Build/Configure
	(cd $(PKG_BUILD_DIR); ./autogen.sh );
	$(call Build/Configure/Default, \
		--enable-shared \
		--enable-static \
	)
endef

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

define Build/InstallDev
	mkdir -p $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/libmms $(1)/usr/include/
	mkdir -p $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmms.{a,so*} $(1)/usr/lib/
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig $(1)/usr/lib/
endef

define Build/UninstallDev
	rm -rf \
		$(STAGING_DIR)/usr/include/libmms \
		$(STAGING_DIR)/usr/lib/libmms.{a,so*} \
		$(STAGING_DIR)/usr/lib/pkgconfig/libmms.pc
endef


define Package/libmms/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmms.so.* $(1)/usr/lib/
endef

$(eval $(call BuildPackage,libmms))
let me know if ya'll run into any problems
phood
Posts: 2
Joined: Fri Aug 14, 2009 5:11 pm

Re: MPD 0.15 and MPC 0.16

Post by phood »

Hi, just wondering if anyone has got this work yet. I managed to get MPD 0.15.1 compiled into an ipk and installed on the asus wl-520. However, when I ran 'mpd', it just gave me errors that it couldn't find libasound. I tried compiling it again without alsa support and it gave me libstdc++ errors.... kind of depressing. I'm getting the latest packages from svn now and trying it again. Would like to hear if anyone has got 0.15 working yet.
Post Reply