Index: files/patch-Makefile.diff
===================================================================
--- files/patch-Makefile.diff	(revision 81287)
+++ files/patch-Makefile.diff	(working copy)
@@ -1,11 +0,0 @@
---- Makefile.orig	2009-03-08 00:06:25.000000000 +0100
-+++ Makefile	2009-03-08 00:06:42.000000000 +0100
-@@ -46,7 +46,7 @@
- 
- 
- 
--CLIENTS = clients/despotify clients/gateway clients/simple
-+CLIENTS = clients/despotify
- SUBDIRS = lib $(CLIENTS)
- 
- .PHONY: all clean $(SUBDIRS) install uninstall
Index: files/patch-Makefile.local.mk.dist.diff
===================================================================
--- files/patch-Makefile.local.mk.dist.diff	(revision 81287)
+++ files/patch-Makefile.local.mk.dist.diff	(working copy)
@@ -1,10 +1,12 @@
---- Makefile.local.mk.dist.orig	2009-03-07 22:40:55.000000000 +0100
-+++ Makefile.local.mk.dist	2009-03-07 22:40:56.000000000 +0100
-@@ -15,3 +15,7 @@
- ## Add more CFLAGS
- # CFLAGS += -DDEBUG_SNDQUEUE
- # CFLAGS += -DDEBUG_PACKETS
+Index: Makefile.local.mk.dist
+===================================================================
+--- Makefile.local.mk.dist	(revision 515)
++++ Makefile.local.mk.dist	(working copy)
+@@ -31,5 +31,5 @@
+ 
+ ## If you're on Mac OS X and have installed libvorbisfile
+ ## via 'port install ..', try uncommenting these lines
+-# CFLAGS += -I/opt/local/include
+-# LDFLAGS += -L/opt/local/lib
 +CFLAGS += -I@PREFIX@/include
 +LDFLAGS += -L@PREFIX@/lib
-+
-+
Index: files/patch-clients-despotify-local.mk.diff
===================================================================
--- files/patch-clients-despotify-local.mk.diff	(revision 81287)
+++ files/patch-clients-despotify-local.mk.diff	(working copy)
@@ -1,13 +0,0 @@
---- clients/despotify/local.mk.orig	2009-03-07 23:17:52.000000000 +0100
-+++ clients/despotify/local.mk	2009-03-07 23:18:49.000000000 +0100
-@@ -36,8 +36,8 @@
- 	rm -f $(DESPOTIFY_OBJS) Makefile.dep
- 
- install: despotify 
--	@echo "Copying despotify binary to /usr/bin/despotify"
--	$(LT) --mode=install install despotify /usr/bin/despotify
-+	@echo "Copying despotify binary to @DESTROOT@@PREFIX@/bin/despotify"
-+	$(LT) --mode=install install despotify @DESTROOT@@PREFIX@/bin/despotify
- 
- uninstall:
- 	@echo "Removing despotify..."
Index: files/patch-lib-sndqueue.h.diff
===================================================================
--- files/patch-lib-sndqueue.h.diff	(revision 0)
+++ files/patch-lib-sndqueue.h.diff	(revision 0)
@@ -0,0 +1,19 @@
+Index: lib/sndqueue.h
+===================================================================
+--- lib/sndqueue.h	(revision 515)
++++ lib/sndqueue.h	(working copy)
+@@ -13,9 +13,12 @@
+ 
+ #if defined(__linux__) 
+ 	#include <endian.h>
+-#endif
+-#if defined(__FreeBSD__)
++#elif defined(__APPLE__)
+ 	#include <machine/endian.h>
++	#define __BYTE_ORDER BYTE_ORDER
++	#define __LITTLE_ENDIAN LITTLE_ENDIAN
++#elif defined(__FreeBSD__)
++	#include <machine/endian.h>
+ 	#define __BYTE_ORDER _BYTE_ORDER
+ 	#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+ #endif
Index: files/patch-lib-local.mk.diff
===================================================================
--- files/patch-lib-local.mk.diff	(revision 81287)
+++ files/patch-lib-local.mk.diff	(working copy)
@@ -1,23 +1,13 @@
---- lib/local.mk.orig	2009-03-08 01:20:15.000000000 +0100
-+++ lib/local.mk	2009-03-08 01:21:51.000000000 +0100
-@@ -5,7 +5,7 @@
- LIB_OBJS = aes.lo audio.lo auth.lo buffer.lo channel.lo commands.lo dns.lo esbuf.lo handlers.lo keyexchange.lo packet.lo playlist.lo puzzle.lo session.lo shn.lo sndqueue.lo util.lo xml.lo network.lo despotify.lo sha1.lo hmac.lo
+Index: lib/local.mk
+===================================================================
+--- lib/local.mk	(revision 515)
++++ lib/local.mk	(working copy)
+@@ -4,7 +4,7 @@
  
- CFLAGS += -Igstapp/
+ LIB_OBJS = aes.lo auth.lo buf.lo cache.lo channel.lo commands.lo dns.lo ezxml.lo handlers.lo keyexchange.lo packet.lo puzzle.lo session.lo shn.lo sndqueue.lo util.lo network.lo despotify.lo sha1.lo hmac.lo xml.lo 
+ 
 -LDFLAGS += -rpath /usr/lib
 +LDFLAGS += -rpath @PREFIX@/lib
+ LDCONFIG = ldconfig
  
  .PHONY: all clean install uninstall
- 
-@@ -83,9 +83,8 @@
- 	$(LT) --mode=clean rm -f $(LIB_OBJS) Makefile.dep
- 
- install: libdespotify.la
--	# install despotify.h /usr/include
--	$(LT) --mode=install install libdespotify.la /usr/lib/libdespotify.la
--	ldconfig -n /usr/lib
-+	# install despotify.h @DESTROOT@@PREFIX@/include
-+	$(LT) --mode=install install libdespotify.la @DESTROOT@@PREFIX@/lib/libdespotify.la
- 
- uninstall:
- 	# rm -f /usr/include/despotify.h 
Index: Portfile
===================================================================
--- Portfile	(revision 81287)
+++ Portfile	(working copy)
@@ -4,8 +4,7 @@
 PortSystem          1.0
 
 name                despotify
-version             20090307
-revision        1
+version             20110115
 categories          multimedia
 maintainers         carljohancrafoord.se:mail
 description         Open source Spotify client
@@ -21,26 +20,23 @@
 
 fetch.type          svn
 svn.url             https://despotify.svn.sourceforge.net/svnroot/despotify/src
-svn.revision        164
+svn.revision        515
 
 worksrcdir          src
 
-patchfiles          patch-Makefile.diff \
-                    patch-Makefile.local.mk.dist.diff \
-                    patch-clients-despotify-local.mk.diff \
-                    patch-lib-local.mk.diff
+patchfiles          patch-Makefile.local.mk.dist.diff \
+                    patch-lib-local.mk.diff \
+                    patch-lib-sndqueue.h.diff
 
 post-patch {
     reinplace s|@PREFIX@|${prefix}|g \
         ${worksrcpath}/Makefile.local.mk.dist \
-        ${worksrcpath}/clients/despotify/local.mk \
         ${worksrcpath}/lib/local.mk
 }
 
 use_configure       no
 
-pre-destroot {
-    reinplace s|@DESTROOT@|${destroot}|g \
-        ${worksrcpath}/clients/despotify/local.mk \
-        ${worksrcpath}/lib/local.mk
-}
+build.args          CC="${configure.cc} ${configure.cc_archflags}" \
+                    CLIENT_DESPOTIFY=1
+
+destroot.args       INSTALL_PREFIX=${destroot}${prefix}
