Menu

[r10141]: / trunk / patches / ports-firefly.patch  Maximize  Restore  History

Download this file

226 lines (215 with data), 6.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
diff -Naur FreeBSD/ports/audio/firefly/Makefile /usr/ports/audio/firefly/Makefile
--- audio/firefly/Makefile 2011-12-26 20:23:04.000000000 -0800
+++ audio/firefly/Makefile 2011-12-31 08:27:49.000000000 -0800
@@ -1,12 +1,12 @@
# New ports collection makefile for: mt-daapd-devel
# Date created: 26 Nov 2007
# Whom: Mark Foster <mark@foster.cc>
-# $FreeBSD: ports/audio/firefly/Makefile,v 1.9 2011/12/27 04:23:04 rm Exp $
+# $FreeBSD: ports/audio/firefly/Makefile,v 1.10 2011/12/31 16:27:49 rm Exp $
#
PORTNAME= firefly
PORTVERSION= 1696
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= audio
MASTER_SITES= http://nightlies.fireflymediaserver.org/nightlies/svn-${PORTVERSION}/ \
http://www.magnesium.net/~mdf/distfiles/
@@ -15,6 +15,8 @@
MAINTAINER= mark@foster.cc
COMMENT= Open-source media server for the Roku SoundBridge and iTunes
+LICENSE= GPLv2
+
BUILD_DEPENDS= ${LOCALBASE}/include/vorbis/codec.h:${PORTSDIR}/audio/libvorbis \
${LOCALBASE}/include/FLAC/metadata.h:${PORTSDIR}/audio/flac
RUN_DEPENDS= oggdec:${PORTSDIR}/audio/vorbis-tools \
@@ -23,8 +25,6 @@
sqlite3.8:${PORTSDIR}/databases/sqlite3 \
id3tag.0:${PORTSDIR}/audio/libid3tag
-CONFLICTS= mt-daapd-0.2.*
-
GNU_CONFIGURE= yes
CONFIGURE_ENV= LIBS="-L${LOCALBASE}/lib ${PTHREAD_LIBS}"
CFLAGS+= ${PTHREAD_CFLAGS}
@@ -45,15 +45,25 @@
USE_LDCONFIG= yes
+OPTIONS= JAPANESE "Japanese support in ID3 tags" off
+
+.include <bsd.port.options.mk>
+
+.if defined(WITH_JAPANESE)
+EXTRA_PATCHES= ${FILESDIR}/extra-patch-src_scan-mp3.c
+USE_ICONV= yes
+CONFIGURE_ARGS+= --enable-iconv
+.endif
+
pre-everything::
- @${ECHO_CMD} "Define vars bellow if you need:"
+ @${ECHO_CMD} "Define vars below if you need:"
@${ECHO_CMD} "DAAPD_USER=${DAAPD_USER} (default: daapd)"
@${ECHO_CMD} "DAAPD_GROUP=${DAAPD_GROUP} (default: daapd)"
@${ECHO_CMD} "DAAPD_DBDIR=${DAAPD_DBDIR} (default: ${PREFIX}/var/db/${PORTNAME})"
post-patch:
@${REINPLACE_CMD} -e 's|echo aout|echo elf|' \
- ${WRKSRC}/configure
+ ${WRKSRC}/configure
post-install:
.if !defined(NOPORTDOCS)
diff -Naur FreeBSD/ports/audio/firefly/files/extra-patch-src_scan-mp3.c /usr/ports/audio/firefly/files/extra-patch-src_scan-mp3.c
--- audio/firefly/files/extra-patch-src_scan-mp3.c 1969-12-31 16:00:00.000000000 -0800
+++ audio/firefly/files/extra-patch-src_scan-mp3.c 2011-12-31 08:27:49.000000000 -0800
@@ -0,0 +1,138 @@
+--- src/scan-mp3.c.orig 2007-09-25 16:55:23.000000000 +0900
++++ src/scan-mp3.c 2011-09-05 13:52:16.000000000 +0900
+@@ -18,6 +18,15 @@
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
++#define USE_CP932
++
++#ifdef USE_CP932
++ #define UNKNOWN_STR "UNKNOWN"
++ #ifndef FILESYSTEM_CES
++ #define FILESYSTEM_CES "CP932"
++ #endif
++#endif
++
+ #ifdef HAVE_CONFIG_H
+ # include "config.h"
+ #endif
+@@ -34,6 +43,10 @@
+ #include <string.h>
+ #include <time.h>
+
++#ifdef USE_CP932
++ #include <iconv.h>
++#endif
++
+ #include "daapd.h"
+ #include "conf.h"
+ #include "err.h"
+@@ -289,6 +302,96 @@
+ return 1;
+ }
+
++#ifdef USE_CP932
++#define MAX_ICONV_BUF 1024
++
++typedef enum {
++ ICONV_OK,
++ ICONV_TRYNEXT,
++ ICONV_FATAL
++} iconv_result;
++
++static iconv_result do_convert(const char* to_ces, const char* from_ces,
++ char *inbuf, size_t inbytesleft,
++ char *outbuf_orig, size_t outbytesleft_orig) {
++ size_t rc;
++ iconv_result ret = ICONV_OK;
++
++ size_t outbytesleft = outbytesleft_orig - 1;
++ char* outbuf = outbuf_orig;
++
++ iconv_t cd = iconv_open(to_ces, from_ces);
++ if (cd == (iconv_t)-1) {
++ return ICONV_FATAL;
++ }
++ rc = iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
++ if (rc == (size_t)-1) {
++ if (errno == E2BIG) {
++ ret = ICONV_FATAL;
++ } else {
++ ret = ICONV_TRYNEXT;
++ memset(outbuf_orig, '\0', outbytesleft_orig);
++ }
++ }
++ iconv_close(cd);
++
++ return ret;
++}
++
++static unsigned char* get_utf8_text(const id3_ucs4_t* native_text) {
++ unsigned char* utf8_text = NULL;
++ char * in, * in8, * iconv_buf;
++ iconv_result rc;
++
++ in = (char*)id3_ucs4_latin1duplicate(native_text);
++ if (!in) goto out;
++
++ in8 = (char*)id3_ucs4_utf8duplicate(native_text);
++ if (!in8) {
++ free(in);
++ goto out;
++ }
++
++ iconv_buf = (char*)calloc(MAX_ICONV_BUF, sizeof(char));
++ if (!iconv_buf) {
++ free(in); free(in8);
++ goto out;
++ }
++
++ /* (1) try utf8 -> cp932 */
++ rc = do_convert("CP932", "UTF-8", in8, strlen(in8), iconv_buf, MAX_ICONV_BUF);
++ if (rc == ICONV_OK) {
++ utf8_text = (unsigned char*)in8;
++ free(iconv_buf);
++ } else if (rc == ICONV_TRYNEXT) {
++ /* (2) try cp932 -> utf8 */
++ rc = do_convert("UTF-8", "CP932", in, strlen(in), iconv_buf, MAX_ICONV_BUF);
++ if (rc == ICONV_OK) {
++ utf8_text = (unsigned char*)iconv_buf;
++ } else if (rc == ICONV_TRYNEXT) {
++ /* (3) try euc-jp -> utf8 */
++ rc = do_convert("UTF-8", "EUC-JP", in, strlen(in), iconv_buf, MAX_ICONV_BUF);
++ if (rc == ICONV_OK) {
++ utf8_text = (unsigned char*)iconv_buf;
++ } else if (rc == ICONV_TRYNEXT) {
++ /* utf-8 including non-japanese char? fallback. */
++ utf8_text = (unsigned char*)id3_ucs4_utf8duplicate(native_text);
++ free(iconv_buf);
++ }
++ }
++ free(in8);
++ }
++ free(in);
++
++ out:
++ if (!utf8_text) {
++ utf8_text = (unsigned char*)strdup(UNKNOWN_STR);
++ }
++
++ return utf8_text;
++}
++#endif
++
+ int scan_mp3_get_mp3tags(char *file, MP3FILE *pmp3) {
+ struct id3_file *pid3file;
+ struct id3_tag *pid3tag;
+@@ -352,8 +455,11 @@
+ if(native_text) {
+ have_utf8=1;
+
+-
++#ifdef USE_CP932
++ utf8_text = (char *)get_utf8_text(native_text);
++#else
+ utf8_text = (char*)id3_ucs4_utf8duplicate(native_text);
++#endif
+ if(utf8_text)
+ mem_register(utf8_text,0);
diff -Naur FreeBSD/ports/audio/firefly/files/mt-daapd.in /usr/ports/audio/firefly/files/mt-daapd.in
--- audio/firefly/files/mt-daapd.in 2010-03-26 17:12:41.000000000 -0700
+++ audio/firefly/files/mt-daapd.in 2012-01-14 00:55:23.000000000 -0800
@@ -1,5 +1,5 @@
#!/bin/sh
-# $FreeBSD: ports/audio/firefly/files/mt-daapd.in,v 1.3 2010/03/27 00:12:41 dougb Exp $
+# $FreeBSD: ports/audio/firefly/files/mt-daapd.in,v 1.4 2012/01/14 08:55:23 dougb Exp $
# PROVIDE: firefly
# REQUIRE: LOGIN
@@ -9,7 +9,7 @@
: ${firefly_enable=NO}
name="firefly"
-rcvar="`set_rcvar`"
+rcvar=firefly_enable
command="%%PREFIX%%/sbin/mt-daapd"
command_args="-c %%PREFIX%%/etc/mt-daapd.conf"
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.