Bug 145967 - New port: audio/alsa-utils Compatibility layer for ALSA support
Summary: New port: audio/alsa-utils Compatibility layer for ALSA support
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Dima Panov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-23 04:50 UTC by Aragon Gouveia
Modified: 2010-06-05 13:50 UTC (History)
0 users

See Also:


Attachments
alsa-utils.shar (5.76 KB, text/plain)
2010-04-23 04:50 UTC, Aragon Gouveia
no flags Details
alsa-utils-1.diff (1.11 KB, patch)
2010-05-28 22:59 UTC, Aragon Gouveia
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aragon Gouveia 2010-04-23 04:50:01 UTC
	This port provides FreeBSD with a compatibility layer for software that depends on ALSA support.  It is based entirely on ariff@'s work at http://people.freebsd.org/~ariff/libasound/, but has been updated for the latest version of ALSA.

	Chromium for FreeBSD is an immediate beneficiary of this.

	This depends on ports/145964 and ports/145965.

	Special thanks to sprewell@jaggeri.com for testing this, and ariff@ for making it!
Comment 1 Dima Panov freebsd_committer freebsd_triage 2010-04-23 08:04:59 UTC
Responsible Changed
From-To: freebsd-ports-bugs->fluffy

I'll take it.
Comment 2 swell.k 2010-05-11 10:59:58 UTC
- remove redundant HAS_CONFIGURE
- use REINPLACE_CMD to patch pre generated file, leaves us with only
  *.[ch] patches within files/patch-alsa-utils

--- a.diff begins here ---
diff --git a/audio/alsa-utils/Makefile b/audio/alsa-utils/Makefile
index 409247b..aa539ec 100644
--- a/audio/alsa-utils/Makefile
+++ b/audio/alsa-utils/Makefile
@@ -19,7 +19,6 @@ BUILD_DEPENDS=	xmlto:${PORTSDIR}/textproc/xmlto
 RUN_DEPENDS=	${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:${PORTSDIR}/audio/alsa-plugins
 USE_BZIP2=	yes
 USE_GMAKE=	yes
-HAS_CONFIGURE=	yes
 GNU_CONFIGURE=	yes
 CONFIGURE_ENV=	CFLAGS="-I${LOCALBASE}/include" \
 		LDFLAGS="-L${LOCALBASE}/lib"
@@ -33,4 +32,7 @@ MAN8_EN=	alsaconf.8
 MAN8_FR=	alsaconf.8
 MLINKS_EN=	aplay.1 arecord.1
 
+post-patch:	.SILENT
+	${REINPLACE_CMD} '/LIBS/s/-ldl//g' ${WRKSRC}/configure
+
 .include <bsd.port.mk>
diff --git a/audio/alsa-utils/files/patch-alsa-utils b/audio/alsa-utils/files/patch-alsa-utils
index a0f8bba..efd3ecd 100644
--- a/audio/alsa-utils/files/patch-alsa-utils
+++ b/audio/alsa-utils/files/patch-alsa-utils
@@ -63,17 +63,6 @@
  
  /* Definitions for .VOC files */
  
---- configure.orig	2009-08-31 23:14:25.000000000 +0800
-+++ configure	2009-09-14 12:36:45.000000000 +0800
-@@ -6480,7 +6480,7 @@
- 	LDFLAGS="$LDFLAGS $ALSA_LIBS"
- fi
- 
--ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
-+ALSA_LIBS="$ALSA_LIBS -lasound -lm -lpthread"
- LIBS="$ALSA_LIBS $LIBS"
- { echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5
- echo "${ECHO_T}$ALSA_LIBS" >&6; }
 --- speaker-test/speaker-test.c.orig	2009-08-31 23:13:36.000000000 +0800
 +++ speaker-test/speaker-test.c	2009-09-15 01:22:48.000000000 +0800
 @@ -44,7 +44,9 @@
--- a.diff ends here ---
Comment 3 Aragon Gouveia 2010-05-26 19:57:46 UTC
Tested.  Looks good.  Thank you!
Comment 4 swell.k 2010-05-27 13:50:56 UTC
I didn't test previously but now that I did there is dangling file
that's not in plist

   man/man1/arecord.1

Can you confirm?

--- a.diff begins here ---
  - move xmlto dependency to its OPTIONS knob
  - add nls support
  - use correct paths to alsa in man pages
  - workaround for MLINKS_EN
  - merge MAN8_EN and MAN8_FR into MAN8 (cosmetic)

diff --git audio/alsa-utils/Makefile audio/alsa-utils/Makefile
index aa539ec..6bdd032 100644
--- audio/alsa-utils/Makefile
+++ audio/alsa-utils/Makefile
@@ -15,24 +15,54 @@ MAINTAINER=	aragon@phat.za.net
 COMMENT=	ALSA compatibility utils
 
 LIB_DEPENDS=	asound.2:${PORTSDIR}/audio/alsa-lib
-BUILD_DEPENDS=	xmlto:${PORTSDIR}/textproc/xmlto
 RUN_DEPENDS=	${LOCALBASE}/lib/alsa-lib/libasound_module_pcm_oss.so:${PORTSDIR}/audio/alsa-plugins
 USE_BZIP2=	yes
 USE_GMAKE=	yes
 GNU_CONFIGURE=	yes
-CONFIGURE_ENV=	CFLAGS="-I${LOCALBASE}/include" \
-		LDFLAGS="-L${LOCALBASE}/lib"
-CONFIGURE_ARGS+=	--disable-nls
+CONFIGURE_ENV=	CFLAGS="-I${LOCALBASE}/include"
 
 MANLANG=	"" fr
 MAN1_EN=	aconnect.1 alsactl.1 alsamixer.1 amidi.1 amixer.1 aplay.1 aplaymidi.1 \
 		arecordmidi.1 aseqdump.1 aseqnet.1 iecset.1 speaker-test.1
-MAN7_EN=	alsactl_init.7
-MAN8_EN=	alsaconf.8
-MAN8_FR=	alsaconf.8
+MAN8=		alsaconf.8
 MLINKS_EN=	aplay.1 arecord.1
 
+OPTIONS=	XMLTO "Generate alsactl_init(7) man page using xmlto(1)" On
+
+.include <bsd.port.pre.mk>
+
+# workaround for MLINKS_EN
+PLIST_FILES+=	man/man1/arecord.1${MANEXT}
+
+.if defined(WITH_XMLTO)
+BUILD_DEPENDS+=	xmlto:${PORTSDIR}/textproc/xmlto
+MAN7_EN+=	alsactl_init.7
+.else
+CONFIGURE_ARGS+=--disable-xmlto
+.endif
+
+.if defined(WITHOUT_NLS)
+CONFIGURE_ENV+=	LDFLAGS="-L${LOCALBASE}/lib"
+CONFIGURE_ARGS+=--disable-nls
+PLIST_SUB+=	NLS="@comment "
+.else
+CONFIGURE_ENV+=	LDFLAGS="-L${LOCALBASE}/lib -lintl"
+USE_GETTEXT=	yes
+PLIST_SUB+=	NLS=""
+.endif
+
 post-patch:	.SILENT
 	${REINPLACE_CMD} '/LIBS/s/-ldl//g' ${WRKSRC}/configure
+	${FIND} -E ${WRKSRC} -type f -regex \
+		'.*\.([[:digit:]]|spec\.in|csv|xml)' -exec \
+		${REINPLACE_CMD} 's|/usr/share|${PREFIX}/share|g' {} +
+	${REINPLACE_CMD} -e '/man_MANS/s/arecord\.1//' \
+		-e '/install-data-hook:/,/^[[:space:]]*$$/d' \
+		${WRKSRC}/aplay/Makefile.in
+
+# workaround for MLINKS_EN
+post-install:
+	cd ${MAN1PREFIX}/man/man1 && \
+		${LN} -sf ${MLINKS_EN:C/\.([[:digit:]])/.\1${MANEXT}/g}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git audio/alsa-utils/pkg-plist audio/alsa-utils/pkg-plist
index e53df49..bb1e3e2 100644
--- audio/alsa-utils/pkg-plist
+++ audio/alsa-utils/pkg-plist
@@ -19,6 +19,10 @@ share/alsa/init/help
 share/alsa/init/info
 share/alsa/init/test
 share/alsa/speaker-test/sample_map.csv
+%%NLS%%share/locale/de/LC_MESSAGES/alsa-utils.mo
+%%NLS%%share/locale/ja/LC_MESSAGES/alsa-utils.mo
+%%NLS%%share/locale/ja/LC_MESSAGES/alsaconf.mo
+%%NLS%%share/locale/ru/LC_MESSAGES/alsaconf.mo
 share/sounds/alsa/Front_Center.wav
 share/sounds/alsa/Front_Left.wav
 share/sounds/alsa/Front_Right.wav
--- a.diff ends here ---
Comment 5 swell.k 2010-05-27 14:14:27 UTC
Anonymous <swell.k@gmail.com> writes:

>   - use correct paths to alsa in man pages

--- a.diff begins here ---
  - forgot to correct paths that start with /etc in amidi.1 and
    alsactl.1
  - use ${PREFIX}/etc in alsactl.c

diff --git audio/alsa-utils/Makefile audio/alsa-utils/Makefile
index 6bdd032..f765f3e 100644
--- audio/alsa-utils/Makefile
+++ audio/alsa-utils/Makefile
@@ -55,7 +55,10 @@ post-patch:	.SILENT
 	${REINPLACE_CMD} '/LIBS/s/-ldl//g' ${WRKSRC}/configure
 	${FIND} -E ${WRKSRC} -type f -regex \
 		'.*\.([[:digit:]]|spec\.in|csv|xml)' -exec \
-		${REINPLACE_CMD} 's|/usr/share|${PREFIX}/share|g' {} +
+		${REINPLACE_CMD} -e 's|/usr/share|${PREFIX}/share|g' \
+		-e 's|/etc/asound\.conf|${LOCALBASE}&|g' {} +
+	${REINPLACE_CMD} 's|/etc/asound\.state|${PREFIX}&|g' \
+		${WRKSRC}/alsactl/alsactl.[1c]
 	${REINPLACE_CMD} -e '/man_MANS/s/arecord\.1//' \
 		-e '/install-data-hook:/,/^[[:space:]]*$$/d' \
 		${WRKSRC}/aplay/Makefile.in
--- a.diff ends here ---
Comment 6 Aragon Gouveia 2010-05-28 22:59:11 UTC
Nice work, thanks.  I think I have a better fix for the arecord.1 
problem.  Also changed to bsd.port.options.mk instead.  Attached.

Comment 7 swell.k 2010-05-29 06:11:32 UTC
Aragon Gouveia <aragon@phat.za.net> writes:

> Nice work, thanks.  I think I have a better fix for the arecord.1
> problem.  Also changed to bsd.port.options.mk instead.  Attached.

Your arecord.1 fix doesn't work here because MLINKS is affected by MANLANG

  $ make install PREFIX=$HOME/aaa
  ...
  ===>   Compressing manual pages for alsa-utils-1.0.23
  ln: $HOME/aaa/man/fr/man1/arecord.1.gz: No such file or directory

  $ make -V _MLINKS PREFIX=$HOME/aaa | sed 'y/ /\n/' | sed '/^$/d'
  $HOME/aaa/man/man1/aplay.1.gz
  $HOME/aaa/man/man1/arecord.1.gz
  $HOME/aaa/man/fr/man1/aplay.1.gz
  $HOME/aaa/man/fr/man1/arecord.1.gz

Did you test it yourself?
Comment 8 Aragon Gouveia 2010-05-29 14:26:07 UTC
On 05/29/10 07:11, Anonymous wrote:
> Your arecord.1 fix doesn't work here because MLINKS is affected by MANLANG

I saw that, but what I've done is the only correct way of doing it with 
the current ports framework.  The fix for the MANLANG problem belongs in 
bsd.port.mk, not as a hack in every port Makefile, don't you think?
Comment 9 swell.k 2010-05-29 16:38:21 UTC
Aragon Gouveia <aragon@phat.za.net> writes:

> On 05/29/10 07:11, Anonymous wrote:
>> Your arecord.1 fix doesn't work here because MLINKS is affected by MANLANG
>
> I saw that, but what I've done is the only correct way of doing it
> with the current ports framework.  The fix for the MANLANG problem
> belongs in bsd.port.mk, not as a hack in every port Makefile, don't
> you think?

Agree. However, there is no fix for bsd.port.mk in gnats. Someone may
have a fix in a blue moon but do you plan to leave compress-man target
and plist broken until then? I don't think broken port will be committed.

Although I have one more broken port thanks to MANLANG & MAN<sect>_<lang>,
fixing bsd.port.mk still doesn't look very enticing to me.
Comment 10 Aragon Gouveia 2010-05-29 18:59:11 UTC
On 05/29/10 17:38, Anonymous wrote:
> Agree. However, there is no fix for bsd.port.mk in gnats. Someone may
> have a fix in a blue moon but do you plan to leave compress-man target
> and plist broken until then? I don't think broken port will be committed.

In what way is the port broken?  Over here it is creating an unresolved 
symlink, man falls back to english in the presence of an unresolved 
symlink, and when the port is removed the unresolved symlink is also 
removed.  I don't see any dangling files or extraneous plist entries?

If I'm missing something then fine.  Otherwise I think avoiding hacks is 
preferable...
Comment 11 Dima Panov freebsd_committer freebsd_triage 2010-06-05 13:49:11 UTC
State Changed
From-To: open->closed

New port added. Thanks!
Comment 12 dfilter service freebsd_committer freebsd_triage 2010-06-05 13:49:15 UTC
fluffy      2010-06-05 12:49:01 UTC

  FreeBSD ports repository

  Added files:
    audio/alsa-utils     Makefile distinfo pkg-descr pkg-plist 
    audio/alsa-utils/files patch-alsa-utils 
  Log:
  - New port: audio/alsa-utils Compatibility layer for ALSA support
  
  PR:             145967
  Submitted by:   Aragon Gouveia <aragon AT phat.za.net>
  
  Revision  Changes    Path
  1.1       +40 -0     ports/audio/alsa-utils/Makefile (new)
  1.1       +3 -0      ports/audio/alsa-utils/distinfo (new)
  1.1       +77 -0     ports/audio/alsa-utils/files/patch-alsa-utils (new)
  1.1       +3 -0      ports/audio/alsa-utils/pkg-descr (new)
  1.1       +35 -0     ports/audio/alsa-utils/pkg-plist (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"