Skip to content

Commit

Permalink
media-sound/moc: Use pkgconfig to detect sys-libs/ncurses flags
Browse files Browse the repository at this point in the history
Gentoo-Bug: 521860
* EAPI=6
* Remove .la files unconditionally

Package-Manager: portage-2.2.27
  • Loading branch information
SoapGentoo committed Jan 27, 2016
1 parent 8d9b416 commit 3f0f37a
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 0 deletions.
180 changes: 180 additions & 0 deletions media-sound/moc/files/moc-2.6_alpha1-fix-ncurses-underlinking.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
Fix missing ncurses underlinking issue caused by broken detection mechanisms.
https://bugs.gentoo.org/show_bug.cgi?id=521860

--- moc-2.6-alpha1/configure.ac
+++ moc-2.6-alpha1/configure.ac
@@ -340,17 +340,13 @@
[Define if we have __attribute__ extension])])

dnl ncurses
-MP_WITH_CURSES
-if test -z "$CURSES_LIB"
-then
- AC_MSG_ERROR([You need curses/ncurses library and header files.])
-else
- AC_CHECK_LIB([$CURSES_LIB], [set_escdelay],
- AC_DEFINE([HAVE_SET_ESCDELAY], 1, [Define if you have set_escdelay.]),
- [AC_CHECK_FUNC([setenv], ,
- AC_MSG_ERROR([Required function setenv not found.]))])
- EXTRA_LIBS="$EXTRA_LIBS -l$CURSES_LIB"
-fi
+AC_ARG_WITH([ncursesw],
+ AS_HELP_STRING([--without-ncursesw], [Don't use ncursesw (UTF-8 support)]))
+AS_IF([test "x$with_ncursesw" != "xno"],
+ [PKG_CHECK_MODULES([CURSES],[ncursesw])
+ AC_DEFINE([HAVE_NCURSESW], [1], [Define if you have ncursesw])],
+ [PKG_CHECK_MODULES([CURSES],[ncurses])
+ AC_DEFINE([HAVE_CURSES], [1], [Define if you have curses])])

dnl popt
AC_CHECK_LIB([popt], [poptGetContext], [true], [POPT_MISSING="yes"])
--- moc-2.6-alpha1/interface_elements.c
+++ moc-2.6-alpha1/interface_elements.c
@@ -37,11 +37,10 @@
# define _XOPEN_SOURCE_EXTENDED /* for wget_wch() */
#endif

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/interface_elements.h
+++ moc-2.6-alpha1/interface_elements.h
@@ -1,11 +1,10 @@
#ifndef INTERFACE_ELEMENTS_H
#define INTERFACE_ELEMENTS_H

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/keys.c
+++ moc-2.6-alpha1/keys.c
@@ -17,11 +17,10 @@
#include <strings.h>
#include <assert.h>

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/Makefile.am
+++ moc-2.6-alpha1/Makefile.am
@@ -2,6 +2,7 @@
SUBDIRS = themes decoder_plugins
AM_CPPFLAGS = -DSYSTEM_THEMES_DIR=\"$(pkgdatadir)/themes\" \
-DPLUGIN_DIR=\"$(plugindir)/$(DECODER_PLUGIN_DIR)\"
+AM_CFLAGS = @CURSES_CFLAGS@

bin_PROGRAMS = mocp
mocp_SOURCES = log.c \
@@ -81,7 +82,7 @@
jack.c \
jack.h
man_MANS = mocp.1
-mocp_LDADD = @EXTRA_OBJS@ -lltdl
+mocp_LDADD = @EXTRA_OBJS@ -lltdl @CURSES_LIBS@
mocp_DEPENDENCIES = @EXTRA_OBJS@
mocp_LDFLAGS = @EXTRA_LIBS@ $(RCC_LIBS) -export-dynamic
EXTRA_DIST = README_equalizer mocp.1 THANKS keymap.example Doxyfile \
--- moc-2.6-alpha1/menu.c
+++ moc-2.6-alpha1/menu.c
@@ -17,11 +17,10 @@
#include <stdlib.h>
#include <string.h>

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/menu.h
+++ moc-2.6-alpha1/menu.h
@@ -1,11 +1,10 @@
#ifndef MENU_H
#define MENU_H

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/themes.c
+++ moc-2.6-alpha1/themes.c
@@ -13,11 +13,10 @@
# include "config.h"
#endif

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#elif HAVE_CURSES_H
+#elif HAVE_CURSES
# include <curses.h>
#endif

--- moc-2.6-alpha1/utf8.c
+++ moc-2.6-alpha1/utf8.c
@@ -30,13 +30,13 @@
# include <langinfo.h>
#endif

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#else
+#elif HAVE_CURSES
# include <curses.h>
#endif
+
#include <assert.h>
#include <string.h>
#include <errno.h>
--- moc-2.6-alpha1/utf8.h
+++ moc-2.6-alpha1/utf8.h
@@ -1,11 +1,10 @@
#ifndef UTF8_H
#define UTF8_H

-#ifdef HAVE_NCURSESW_H
+#ifdef HAVE_NCURSESW
# include <ncursesw/curses.h>
-#elif HAVE_NCURSES_H
# include <ncurses.h>
-#else
+#elif HAVE_CURSES
# include <curses.h>
#endif

90 changes: 90 additions & 0 deletions media-sound/moc/moc-2.6_alpha1-r1.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=6

inherit autotools eutils versionator

MY_PV="$(replace_version_separator 2 -)"
DESCRIPTION="Music On Console - ncurses interface for playing audio files"
HOMEPAGE="http://moc.daper.net"
SRC_URI="http://ftp.daper.net/pub/soft/moc/unstable/${PN}-${MY_PV}.tar.xz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="aac alsa +cache curl debug ffmpeg flac jack libsamplerate mad +magic modplug musepack
oss sid sndfile speex timidity tremor +unicode vorbis wavpack"

RDEPEND=">=dev-libs/libltdl-2:0
sys-libs/ncurses:0=[unicode?]
aac? ( media-libs/faad2 )
alsa? ( media-libs/alsa-lib )
cache? ( >=sys-libs/db-4:* )
curl? ( net-misc/curl )
ffmpeg? ( virtual/ffmpeg )
flac? ( media-libs/flac )
jack? ( media-sound/jack-audio-connection-kit )
libsamplerate? ( media-libs/libsamplerate )
mad? ( media-libs/libmad sys-libs/zlib media-libs/libid3tag )
magic? ( sys-apps/file )
modplug? ( media-libs/libmodplug )
musepack? ( media-sound/musepack-tools media-libs/taglib )
sid? ( >=media-libs/libsidplay-2 )
sndfile? ( media-libs/libsndfile )
speex? ( media-libs/speex )
timidity? ( media-libs/libtimidity media-sound/timidity++ )
vorbis? (
media-libs/libogg
tremor? ( media-libs/tremor )
!tremor? ( media-libs/libvorbis )
)
wavpack? ( media-sound/wavpack )"
DEPEND="${RDEPEND}
app-arch/xz-utils
virtual/pkgconfig"
PATCHES=(
"${FILESDIR}/${P}-fix-ncurses-underlinking.patch"
)
S="${WORKDIR}/${PN}-${MY_PV}"

src_prepare() {
mv configure.{in,ac} || die
default
eautoreconf
}

src_configure() {
local myconf=(
--without-rcc
$(use_enable debug)
$(use_enable cache)
$(use_with oss)
$(use_with alsa)
$(use_with jack)
$(use_with magic)
$(use_with unicode ncursesw)
$(use_with libsamplerate samplerate)
$(use_with aac)
$(use_with ffmpeg)
$(use_with flac)
$(use_with modplug)
$(use_with mad mp3)
$(use_with musepack)
$(use_with sid sidplay2)
$(use_with sndfile)
$(use_with speex)
$(use_with timidity)
$(use_with vorbis vorbis $(usex tremor tremor ""))
$(use_with wavpack)
$(use_with curl)
)

econf "${myconf[@]}"
}

src_install() {
default
prune_libtool_files --all
}

0 comments on commit 3f0f37a

Please sign in to comment.