
Index: files/configure.x11.patch
===================================================================
--- files/configure.x11.patch	(revision 75587)
+++ files/configure.x11.patch	(working copy)
@@ -1,46 +1,20 @@
---- configure.orig	2009-04-22 21:48:59.000000000 -0700
-+++ configure	2009-04-22 21:58:17.000000000 -0700
-@@ -3859,22 +3859,27 @@ echocheck "X11 headers presence"
-   for I in `echo $_inc_extra | sed s/-I//g` /usr/include ; do
-     if test -f "$I/X11/Xlib.h" ; then
-       _x11_headers="yes"
--      _res_comment=""
--      break
--    fi
--  done
--  for I in /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/openwin/include ; do
--    if test -f "$I/X11/Xlib.h" ; then
--      _inc_extra="$_inc_extra -I$I"
--      _x11_headers="yes"
-       _res_comment="using $I"
-       break
-     fi
-   done
-+  if test $_x11_headers = "no" ; then
-+    for I in /usr/X11/include /usr/X11R6/include /usr/include/X11R6 /usr/openwin/include ; do
-+      if test -f "$I/X11/Xlib.h" ; then
-+        _inc_extra="$_inc_extra -I$I"
-+        _x11_headers="yes"
-+        _res_comment="using $I"
-+        break
-+      fi
-+    done
-+  fi
- echores "$_x11_headers"
+--- configure.orig	2010-07-29 02:31:57.000000000 +0200
++++ configure	2011-01-31 23:29:54.000000000 +0100
+@@ -4373,6 +4373,9 @@
  
  
  echocheck "X11"
 +if test "$_x11" = yes ; then
-+  _libs_mplayer="$_libs_mplayer -lXext -lX11"
++  libs_mplayer="$libs_mplayer -lXext -lX11"
 +fi
  if test "$_x11" = auto && test "$_x11_headers" = yes ; then
    cat > $TMPC <<EOF
  #include <X11/Xlib.h>
-@@ -6232,6 +6237,7 @@ fi
+@@ -7104,6 +7107,7 @@
  if test "$_qtx" = yes ; then
-     _def_qtx='#define USE_QTX_CODECS 1'
-     _codecmodules="qtx $_codecmodules"
-+    _ld_extra="$_ld_extra -framework QuickTime -framework Carbon"
+     def_qtx='#define CONFIG_QTX_CODECS 1'
+     win32 && _qtx_codecs_win32=yes && def_qtx_win32='#define CONFIG_QTX_CODECS_WIN32 1'
++    darwin && extra_ldflags="$extra_ldflags -framework Carbon -framework QuickTime" && def_quicktime='#define CONFIG_QUICKTIME 1'
+     codecmodules="qtx $codecmodules"
+     darwin || win32 || _qtx_emulation=yes
  else
-     _def_qtx='#undef USE_QTX_CODECS'
-     _nocodecmodules="qtx $_nocodecmodules"
Index: files/gl_dlsym.patch
===================================================================
--- files/gl_dlsym.patch	(revision 75587)
+++ files/gl_dlsym.patch	(working copy)
@@ -1,11 +0,0 @@
---- libvo/gl_common.c.bak	2009-04-23 02:09:43.000000000 -0700
-+++ libvo/gl_common.c	2009-04-23 02:10:18.000000000 -0700
-@@ -1547,7 +1547,7 @@ static void *getdladdr(const char *s) {
-     handle = dlopen(NULL, RTLD_LAZY);
-   return dlsym(handle, s);
- #else
--  return dlsym(0, s);
-+  return dlsym(RTLD_DEFAULT, s);
- #endif
- #else
-   return NULL;
Index: files/qt.x11.patch
===================================================================
--- files/qt.x11.patch	(revision 75587)
+++ files/qt.x11.patch	(working copy)
@@ -1,30 +0,0 @@
---- libmpcodecs/ad_qtaudio.c.orig	2009-04-22 22:21:46.000000000 -0700
-+++ libmpcodecs/ad_qtaudio.c	2009-04-22 22:21:53.000000000 -0700
-@@ -5,6 +5,12 @@
- 
- #include "config.h"
- 
-+#ifndef MACOSX
-+#ifdef __APPLE__
-+#define MACOSX
-+#endif
-+#endif
-+
- #ifdef MACOSX
- #include <QuickTime/QuickTimeComponents.h>
- #endif
---- libmpcodecs/vd_qtvideo.c.orig	2009-04-22 22:20:34.000000000 -0700
-+++ libmpcodecs/vd_qtvideo.c	2009-04-22 22:21:15.000000000 -0700
-@@ -4,6 +4,12 @@
- 
- #include "config.h"
- 
-+#ifndef MACOSX
-+#ifdef __APPLE__
-+#define MACOSX
-+#endif
-+#endif
-+
- #ifdef MACOSX
- #include <QuickTime/ImageCodec.h>
- #define dump_ImageDescription(x)
Index: Portfile
===================================================================
--- Portfile	(revision 75587)
+++ Portfile	(working copy)
@@ -5,8 +5,7 @@
 PortSystem          1.0
 
 name                MPlayer
-version             1.0rc2
-revision            10
+version             1.0rc4
 categories          multimedia
 maintainers         ecronin \
                     openmaintainer
@@ -32,35 +31,11 @@
                 http://www1.mplayerhq.hu/MPlayer/releases/codecs/:codecs \
                 http://www2.mplayerhq.hu/MPlayer/releases/codecs/:codecs
 patch_sites     http://www.mplayerhq.hu/MPlayer/patches/
-patchfiles      stream_cddb_fix_20080120.diff \
-                url_fix_20080120.diff \
-                demux_mov_fix_20080129.diff \
-                demux_audio_fix_20080129.diff \
-                configure.x11.patch \
-                qt.x11.patch \
-                gl_dlsym.patch
+patchfiles      configure.x11.patch
 use_bzip2       yes
 checksums       ${distname}${extract.suffix} \
-                    md5 7e27e535c2d267637df34898f1b91707 \
-                    sha1 e9b496f3527c552004ec6d01d6b43f196b43ce2d \
-                    rmd160 3b5cba1529856a177a5191e22f8dcc00b5a83c52 \
-                stream_cddb_fix_20080120.diff \
-                    md5 c7d1bcdd61fcceb7598d61fe2213c587 \
-                    sha1 8d901c7a88fa120ed26492e741e1ae0fbe57e12d \
-                    rmd160 92999593ff6dfbb8c05f5c9f15efa992193030df \
-                url_fix_20080120.diff \
-                    md5 6a2c124586e1e6c44ae4ca1b4be9b6e4 \
-                    sha1 1e92ded6f27bf07601fa318e24ec468fe225ffe5 \
-                    rmd160 82b0ed4f4213767474c8ea7b011237caa24fc604 \
-                demux_mov_fix_20080129.diff \
-                    md5 ce999929155f509a3e6bee41d9d613ed \
-                    sha1 a17d82baff58e8cc569365341503273956fd26c8 \
-                    rmd160 69a71376ee817983d400fffde8e5c689156de50f \
-                demux_audio_fix_20080129.diff \
-                    md5 320af7daa1b248ee8e8c15d34d7923e3 \
-                    sha1 e25ba7d8d696d9c6365f105134ba723404adb4e1 \
-                    rmd160 68a98b6110b22c4f590f48a2464ba21af7f7faa0
-
+                    sha1    36dfaeda726896b6831d66b0fe179623e0385fbe \
+                    rmd160  f112c53e43143d6f02850ee3d8326e25e7396cff \
 livecheck.type      regex
 #livecheck.url       http://www1.mplayerhq.hu/MPlayer/releases/
 livecheck.url       http://www1.mplayerhq.hu/design7/dload.html
@@ -68,10 +43,9 @@
 
 
 depends_lib     port:jpeg port:lame port:libiconv port:libmad \
-                port:libogg port:libpng path:include/gif_lib.h:giflib \
-                port:libtheora port:libvorbis port:lzo2 port:ncurses \
-                port:zlib
-depends_build   port:pkgconfig
+                port:libogg port:libpng port:libtheora port:libvorbis \
+                port:lzo2 port:ncurses port:zlib port:bzip2
+depends_build   port:pkgconfig port:yasm
 
 # MPlayer's ./configure REALLY does not want you to use ENV for this
 configure.cflags    {}
@@ -88,29 +62,31 @@
 universal_variant no
 
 configure.args \
-        --with-extraincdir=${prefix}/include/lzo:${prefix}/include \
-        --with-extralibdir=${prefix}/lib:${prefix}/lib/samba3 \
-        --datadir=${prefix}/share/${name} \
-        --confdir=${prefix}/etc/${name} \
-        --mandir=${prefix}/share/man \
-        --enable-gif --enable-png --enable-jpeg --enable-liblzo \
-        --enable-theora --enable-libvorbis --enable-mad \
-        --disable-faad-external --enable-largefiles
+    --extra-cflags="-I${prefix}/include/lzo -I${prefix}/include" \
+    --extra-ldflags="-L${prefix}/lib -L${prefix}/lib/samba3" \
+    --datadir=${prefix}/share/${name} \
+    --confdir=${prefix}/etc/${name} \
+    --mandir=${prefix}/share/man \
+    --enable-png --enable-jpeg --enable-liblzo \
+    --enable-theora --enable-libvorbis --enable-mad \
+    --enable-largefiles
 
 # MPlayer autodetects many support libs.  To prevent undeclared
 # dependencies, explicitly disable everything optional first.
 # Later, let autodetect do its magic not explicit --enable
 configure.args-append \
-        --disable-smb --disable-live --disable-dvdnav \
-        --disable-dvdread --disable-cdparanoia --disable-freetype \
-        --disable-fontconfig --disable-unrarlib --disable-fribidi \
-        --disable-enca --disable-libcdio --disable-xvid \
-        --disable-x264 --disable-speex \
-        --disable-faac --disable-ladspa --disable-libdv \
-        --disable-toolame --disable-twolame --disable-xmms \
-        --disable-musepack --disable-sdl --disable-aa \
-        --disable-caca --disable-x11 --disable-gl --disable-arts \
-        --disable-esd --disable-lirc
+    --disable-smb --disable-live --disable-dvdnav \
+    --disable-dvdread --disable-cdparanoia --disable-freetype \
+    --disable-fontconfig --disable-fribidi \
+    --disable-enca --disable-libcdio --disable-xvid \
+    --disable-x264 --disable-speex \
+    --disable-faac --disable-libdv \
+    --disable-toolame --disable-twolame --disable-xmms \
+    --disable-musepack --disable-sdl --disable-aa \
+    --disable-caca --disable-x11 --disable-gl --disable-arts \
+    --disable-esd --disable-lirc --disable-mng --disable-libdirac-lavc \
+    --disable-libschroedinger-lavc --disable-liba52 \
+    --disable-gif
 
 post-destroot {
     xinstall -d -m 0755 ${destroot}${prefix}/share/doc/${name}
@@ -122,6 +98,10 @@
         xinstall -m 0644 ${worksrcpath}/etc/${etcfile} \
             ${destroot}${prefix}/etc/${name}/${etcfile}
     }
+    xinstall -d -m 0755 ${destroot}${prefix}/share/man/man1
+    xinstall -m 0644 ${worksrcpath}/DOCS/man/en/mplayer.1 \
+        ${destroot}${prefix}/share/man/man1/
+    xinstall -m 0755 ${worksrcpath}/TOOLS/midentify.sh ${destroot}${prefix}/bin/midentify
 }
 
 ##### Mplayer features
@@ -236,11 +216,11 @@
     configure.args-delete   --disable-caca
 }
 
-variant x11 {
+variant x11 description {Enable x11 support} {
     depends_lib-append \
-	port:xorg-libXinerama \
-	port:xorg-libXv \
-	port:xorg-libXxf86vm
+        port:xorg-libXinerama \
+        port:xorg-libXv \
+        port:xorg-libXxf86vm
 
     configure.args-delete   --disable-x11
     configure.args-append   --enable-x11 --enable-xv --enable-xinerama --enable-xshape 
@@ -254,31 +234,24 @@
 
 
 platform macosx {
-    configure.args-append   --enable-macosx 
-    if {([variant_isset universal] && ![string match *64* $universal_archs]) || (![variant_isset universal] && ![string match *64* $build_arch])} {
-        configure.args-append --enable-qtx --enable-macosx-finder-support
+    if { ${configure.build_arch} == "x86_64" } {
+        configure.args-append   --disable-qtx
     } else {
-        configure.args-append --disable-qtx
+        configure.args-append   --enable-qtx
     }
 }
 
 variant glx requires x11 description {Enable glx output support.  Due to a bug in Mplayer's build system, this disables Mac OS X-specific features} {
-    depends_lib-append port:mesa
+    depends_lib-append      port:mesa
     configure.args-delete   --disable-gl --enable-macosx --enable-macosx-finder-support --enable-macosx-bundle --enable-qtx
     configure.args-append   --enable-gl --disable-macosx
 }
 
 platform darwin {
-    post-patch {
-        reinplace "s|\$\(CC\) \$\(CFLAGS\) -o|\$\(LD\) \$\(CFLAGS\) -o|g" \
-            ${worksrcpath}/Makefile
-        reinplace "s|-isysroot /Developer/SDKs/MacOSX10.4u.sdk||g" \
-            ${worksrcpath}/configure
-    }
-    build.env           LD=${configure.cc}
     if { ${configure.build_arch} == "x86_64" } {
-        configure.args-append --target=${build_arch}-Darwin
+        configure.args-append --target=${configure.build_arch}-Darwin
     }
+    build.env           LD=${configure.cc}
 }
 
 platform darwin 8 {
@@ -287,9 +260,7 @@
     build.env           LD=${configure.cxx}
 }
 
-platform darwin 10 {
-    # Broken because 1.0rc2 is super old
-    pre-fetch {
-        return -code error "MPlayer does not compile on Snow Leopard.  Please use multimedia/mplayer-devel instead"
-    }
+platform darwin 9 {
+    configure.args-delete   --extra-cflags="-I${prefix}/include/lzo -I${prefix}/include"
+    configure.args-append   --extra-cflags="-fomit-frame-pointer -I${prefix}/include/lzo -I${prefix}/include"
 }
