ports/123963: [New port] audio/wavegain
Denise H. G.
darcsis at gmail.com
Sat May 24 20:10:02 UTC 2008
>Number: 123963
>Category: ports
>Synopsis: [New port] audio/wavegain
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat May 24 20:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Denise H. G.
>Release: FreeBSD 7.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD pluton.xbsd.name 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue May 20 22:12:04 CST 2008 dhg at pluton.xbsd.name:/opt/obj/usr/src/sys/pluton-SMP-ULE amd64
>Description:
to make gnormalize happy.
>How-To-Repeat:
>Fix:
--- wavegain-1.2.6.shar begins here ---
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# wavegain
# wavegain/files
# wavegain/files/patch-audio.c
# wavegain/files/patch-wavegain.c
# wavegain/files/patch-Makefile.linux
# wavegain/Makefile
# wavegain/distinfo
# wavegain/pkg-descr
#
echo c - wavegain
mkdir -p wavegain > /dev/null 2>&1
echo c - wavegain/files
mkdir -p wavegain/files > /dev/null 2>&1
echo x - wavegain/files/patch-audio.c
sed 's/^X//' >wavegain/files/patch-audio.c << 'END-of-wavegain/files/patch-audio.c'
X--- audio.c 2005-11-27 16:55:24.000000000 +0800
X+++ audio.c 2008-05-24 22:12:15.000000000 +0800
X@@ -31,20 +31,8 @@
X #include <string.h>
X #include <sys/types.h>
X
X-#ifdef _WIN32
X-#include <io.h>
X-#else
X-# ifndef __MACOSX__
X-# include <sys/io.h>
X-# endif
X-#endif
X-
X #include <fcntl.h>
X
X-#ifndef __MACOSX__
X-#include <malloc.h>
X-#endif
X-
X #include <math.h>
X #include "config.h"
X #include "audio.h"
END-of-wavegain/files/patch-audio.c
echo x - wavegain/files/patch-wavegain.c
sed 's/^X//' >wavegain/files/patch-wavegain.c << 'END-of-wavegain/files/patch-wavegain.c'
X--- wavegain.c 2005-11-27 16:58:46.000000000 +0800
X+++ wavegain.c 2008-05-25 03:23:17.000000000 +0800
X@@ -19,20 +19,8 @@
X #include <string.h>
X #include <ctype.h>
X
X-#ifdef _WIN32
X-#include <io.h>
X-#else
X-# ifndef __MACOSX__
X-# include <sys/io.h>
X-# endif
X-#endif
X-
X #include <fcntl.h>
X
X-#ifndef __MACOSX__
X-#include <malloc.h>
X-#endif
X-
X #include "gain_analysis.h"
X #include "i18n.h"
X #include "config.h"
X@@ -58,6 +46,14 @@
X #define ROUND64(x) ( doubletmp = (x) + Dither.Add + (Int64_t)0x001FFFFD80000000L, *(Int64_t*)(&doubletmp) - (Int64_t)0x433FFFFD80000000L )
X #endif
X
X+
X+
X+# include <errno.h>
X+static int xrename(const char *oldpath, const char *newpath);
X+
X+
X+
X+
X extern int write_log;
X dither_t Dither;
X double doubletmp;
X@@ -584,16 +580,26 @@
X close_audio_file(infile, aufile, wg_opts);
X fclose(infile);
X
X- if (!settings->std_out) {
X+ if (!settings->std_out) {
X+
X if (remove(filename) != 0) {
X fprintf(stderr, " Error deleting old file '%s'\n", filename);
X goto exit;
X }
X-
X- if (rename(TEMP_NAME, filename) != 0) {
X+
X+ /*
X+ * int rename(const char *old, const char *new);
X+ * In POSIX, rename will fail if the 'old' and 'new' names are on different mounted file systems.
X+ * ( From http://en.wikipedia.org/wiki/Rename_%28C%29 )
X+ * Function 'xrename' from 'normalize-0.7.6' is one clever solution
X+ */
X+
X+ /*if (rename(TEMP_NAME, filename) != 0) { */
X+ if (xrename(TEMP_NAME, filename) != 0) {
X fprintf(stderr, " Error renaming '" TEMP_NAME "' to '%s' (uh-oh)\n", filename);
X goto exit;
X }
X+
X }
X
X result = 1;
X@@ -603,3 +609,65 @@
X }
X
X
X+
X+
X+/* From normalize-0.7.6/nid3lib/write.c
X+ * Move the file "oldpath" to "newpath", or copy and delete if they
X+ * are on different filesystems.
X+ */
X+static int
X+xrename(const char *oldpath, const char *newpath)
X+{
X+ FILE *in, *out;
X+ char buf[4096];
X+ size_t sz;
X+
X+ if (strcmp(oldpath, newpath) == 0)
X+ return 0;
X+
X+#ifdef __EMX__
X+ if (unlink(newpath) == -1 && errno != ENOENT)
X+ return -1;
X+#endif
X+
X+ if (rename(oldpath, newpath) == -1) {
X+ if (errno == EXDEV) {
X+ /* files are on different filesystems, so we have to copy */
X+ if (unlink(newpath) == -1 && errno != ENOENT)
X+ return -1;
X+
X+ in = fopen(oldpath, "rb");
X+ if (in == NULL)
X+ return -1;
X+ out = fopen(newpath, "wb");
X+ if (out == NULL) {
X+ fclose(in);
X+ return -1;
X+ }
X+
X+ while ((sz = fread(buf, 1, 4096, in)) > 0)
X+ fwrite(buf, 1, sz, out);
X+
X+ if (ferror(in) || ferror(out)) {
X+ fclose(in);
X+ fclose(out);
X+ return -1;
X+ }
X+ if (fclose(in) == EOF) {
X+ fclose(out);
X+ return -1;
X+ }
X+ if (fclose(out) == EOF)
X+ return -1;
X+
X+ if (unlink(oldpath) == -1)
X+ return -1;
X+ } else {
X+ return -1;
X+ }
X+ }
X+
X+ return 0;
X+}
X+
X+
END-of-wavegain/files/patch-wavegain.c
echo x - wavegain/files/patch-Makefile.linux
sed 's/^X//' >wavegain/files/patch-Makefile.linux << 'END-of-wavegain/files/patch-Makefile.linux'
X--- Makefile.linux 2005-11-30 11:17:14.000000000 +0800
X+++ Makefile.linux 2008-05-24 22:14:34.000000000 +0800
X@@ -1,5 +1,5 @@
X all:
X- gcc *.c -o wavegain -DHAVE_CONFIG_H -lm -lsndfile
X+ gcc *.c -o wavegain -DHAVE_CONFIG_H -lm -lsndfile -L/usr/local/lib
X
X install:
X install -d /usr/bin/
END-of-wavegain/files/patch-Makefile.linux
echo x - wavegain/Makefile
sed 's/^X//' >wavegain/Makefile << 'END-of-wavegain/Makefile'
X# New ports collection makefile for: wavegain
X# Date created: 24 May 2008
X# Whom: Denise H. G. <darcsis at gmail.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME= wavegain
XPORTVERSION= 1.2.6
XCATEGORIES= audio
XMASTER_SITES= http://www.rarewares.org/files/others/
XDISTNAME= ${PORTNAME}-${PORTVERSION}srcs${EXTRACT_SUFFIX}
X
XMAINTAINER= darcsis at gmail.com
XCOMMENT= A program that applies ReplayGain to wave files
X
XLIB_DEPENDS= sndfile.1:${PORTSDIR}/audio/libsndfile
X
XUSE_ZIP= yes
XUSE_GMAKE= yes
X
XPLIST_FILES= bin/wavegain
X
XWRKSRC= ${WRKDIR}/WaveGain-${PORTVERSION}
X
X.include <bsd.port.pre.mk>
X
Xdo-configure:
X @cd ${WRKSRC} && ${CP} Makefile.linux Makefile
X
Xdo-install:
X ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${PREFIX}/bin
X
X.include <bsd.port.post.mk>
END-of-wavegain/Makefile
echo x - wavegain/distinfo
sed 's/^X//' >wavegain/distinfo << 'END-of-wavegain/distinfo'
XMD5 (wavegain-1.2.6srcs.zip) = 37facb462a3ec4f9831cd00f597ee85e
XSHA256 (wavegain-1.2.6srcs.zip) = 32f3ea5252094c8443a54440ed5e815b044b9feeb82e6494eabbe84f95e6fc08
XSIZE (wavegain-1.2.6srcs.zip) = 160859
END-of-wavegain/distinfo
echo x - wavegain/pkg-descr
sed 's/^X//' >wavegain/pkg-descr << 'END-of-wavegain/pkg-descr'
XWaveGain is a program that applies ReplayGain to wave files.
XThe FreeBSD port of WaveGain is with a patch from gnormalize
Xwhose author is Claudio Fernandes de Souza Rodrigues.
X
XThe author of WaveGain is John Edwards.
X
XWWW: http://www.rarewares.org/others.html
END-of-wavegain/pkg-descr
exit
--- wavegain-1.2.6.shar ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list