Subject: Conversion of mplayer to options framework
To: None <tech-pkg@NetBSD.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-pkg
Date: 05/31/2005 20:49:17
--=-QOYZmNrXRtfnLgtgRJMr
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hi all,
the attached patch converts mplayer to the package options framework.
More specifically, it gets rid of the MPLAYER_DISABLE_DRIVERS,
MPLAYER_ENABLE_RUNTIME_CPU_DETECTION and MPLAYER_USE_MEDIALIB variables.
(How do I mark them as deprecated? mk/defaults/obsolete.mk does not
seem the right place, as it is says "global vars".)
Compared to the previous structure, which only allowed disabling arts,
esound, nas and sdl, I've seized the opportunity to make all other
dependencies optional (I, personally, don't want libdv in, as it
requires gtk1.) I hope this will please people that think that mplayer
is actually bloated (and my laptop will be happier, too ;).
However, note that I've not added neither arts, nor esound, nor nas to
the default options. I'm not sure this is the way to go, but reduces
the amount of dependencies by default. A reason in favor is that we
already have several packages that support options to enable these
backends, and they are disabled by default. The "bad" side is that
binary packages won't have any of these audio output plugins compiled in
(but we don't have binary packages in FTP yet, do we? See below,
anyway.)
Let me say that despite the initial "complexity" in options.mk, it seems
simpler than what we had before. All optional functionality is treated
the same way, except that depending on the package, you list the
supported options in PKG_SUPPORTED_OPTIONS (e.g., mencoder does not have
esound on the list, while mplayer does).
At last, note that win32 and real codecs are optional (enabled by
default). If these were disabled... maybe we could have mplayer binary
packages on FTP? Dunno if the restriction comes from somewhere else.
Any objections to this? Any detail I should improve?
Thanks,
PS: I've just seen that mplayer has a built-time option to enable
loadable plugins. Has anybody tried that? It may be a way to achieve
binary-friendly packages.
--
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/
--=-QOYZmNrXRtfnLgtgRJMr
Content-Disposition: attachment; filename=patch.diff
Content-Type: text/x-patch; name=patch.diff; charset=UTF-8
Content-Transfer-Encoding: 7bit
Index: mplayer/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/mplayer/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- mplayer/Makefile 18 Apr 2005 17:49:41 -0000 1.17
+++ mplayer/Makefile 31 May 2005 18:36:59 -0000
@@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.17 2005/04/18 17:49:41 drochner Exp $
PKGNAME= mplayer-${MPLAYER_PKG_VERSION}
+PKGREVISION= 1
COMMENT= Software-only MPEG-1/2/4 video decoder
Index: mplayer-share/Makefile.common
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/mplayer-share/Makefile.common,v
retrieving revision 1.21
diff -u -r1.21 Makefile.common
--- mplayer-share/Makefile.common 22 May 2005 20:08:22 -0000 1.21
+++ mplayer-share/Makefile.common 31 May 2005 18:36:59 -0000
@@ -53,49 +53,4 @@
.include "../../mk/bsd.prefs.mk"
-.if ${MACHINE_ARCH} == "i386"
-CONFIGURE_ARGS+= --with-win32libdir="${LOCALBASE}/lib/win32"
-. if ${MPLAYER_ENABLE_RUNTIME_CPU_DETECTION} == YES
-CONFIGURE_ARGS+= --enable-runtime-cpudetection
-. endif
-BUILD_DEFS+= MPLAYER_ENABLE_RUNTIME_CPU_DETECTION
-.endif
-
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "alpha"
-CONFIGURE_ARGS+= --with-reallibdir="${LOCALBASE}/lib/RealPlayer8-Codecs"
-.endif
-
-.if ${OPSYS} == "NetBSD" || ${OPSYS} == "Linux"
-CONFIGURE_ARGS+= --with-cdparanoiaincdir="${LOCALBASE}/include/cdparanoia"
-.endif
-
-.if ${OPSYS} == "SunOS" && !empty(MPLAYER_USE_MEDIALIB:M[Yy][Ee][Ss])
-CONFIGURE_ARGS+= --enable-mlib
-.else
-CONFIGURE_ARGS+= --disable-mlib
-.endif
-
-# Keep this list in sync with the one in bsd.pkg.defaults.mk, where
-# MPLAYER_DISABLE_DRIVERS is explained.
-MPLAYER_DRIVERS= arts audio/arts arts \
- esd audio/esound esd \
- nas audio/nas nas \
- sdl devel/SDL sdl
-
-# arts is currently broken on Solaris.
-.if ${OPSYS} == "SunOS"
-MPLAYER_DISABLE_DRIVERS+= arts
-.endif
-
-.if defined(PKGNAME) && !empty(PKGNAME:M*encoder*)
-MPLAYER_DISABLE_DRIVERS=arts esd nas sdl
-.else
-BUILD_DEFS+= MPLAYER_DISABLE_DRIVERS
-.endif
-.for drv pkg val in ${MPLAYER_DRIVERS}
-. if empty(MPLAYER_DISABLE_DRIVERS:M${drv})
-CONFIGURE_ARGS+= --enable-${val}
-. else
-CONFIGURE_ARGS+= --disable-${val}
-. endif
-.endfor
+.include "../../multimedia/mplayer-share/options.mk"
Index: mplayer-share/Makefile.depends
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/mplayer-share/Makefile.depends,v
retrieving revision 1.12
diff -u -r1.12 Makefile.depends
--- mplayer-share/Makefile.depends 18 Aug 2004 13:35:06 -0000 1.12
+++ mplayer-share/Makefile.depends 31 May 2005 18:36:59 -0000
@@ -5,44 +5,10 @@
GCC_REQD+= 2.95.3
-.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "Linux" || ${OPSYS} == "NetBSD"
-. include "../../audio/cdparanoia/buildlink3.mk"
-.endif
-
.if ${OPSYS} == "NetBSD"
. include "../../devel/binutils/buildlink3.mk"
.endif
-.if ${MACHINE_ARCH} == "i386"
-DEPENDS+= win32-codecs>=011227:../../multimedia/win32-codecs
-.endif
-
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "alpha"
-DEPENDS+= realplayer-codecs>=8nb2:../../multimedia/realplayer-codecs
-.endif
-
USE_X11= YES
-.for drv pkg val in ${MPLAYER_DRIVERS}
-. if empty(MPLAYER_DISABLE_DRIVERS:M${drv})
-. include "../../${pkg}/buildlink3.mk"
-. endif
-.endfor
-
-.include "../../audio/libmad/buildlink3.mk"
-.include "../../audio/libvorbis/buildlink3.mk"
.include "../../converters/libiconv/buildlink3.mk"
-.include "../../graphics/jpeg/buildlink3.mk"
-.include "../../graphics/libungif/buildlink3.mk"
-.include "../../graphics/png/buildlink3.mk"
-.include "../../multimedia/libdvdread/buildlink3.mk"
-.include "../../multimedia/libdv/buildlink3.mk"
-.include "../../multimedia/libtheora/buildlink3.mk"
-
-.if ${MACHINE_ARCH} == "i386"
-. include "../../multimedia/xvidcore/buildlink3.mk"
-.endif
-
-.if defined(USE_OSS)
-. include "../../mk/ossaudio.buildlink3.mk"
-.endif
Index: mplayer-share/options.mk
===================================================================
RCS file: mplayer-share/options.mk
diff -N mplayer-share/options.mk
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mplayer-share/options.mk 31 May 2005 18:36:59 -0000
@@ -0,0 +1,220 @@
+# $NetBSD$
+
+.if !empty(PKGNAME) && empty(PKGNAME:Mmplayer-share*)
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.${PKGNAME:C/-[0-9].*//}
+
+.include "../../mk/bsd.prefs.mk"
+
+# -------------------------------------------------------------------------
+# Define PKG_SUPPORTED_OPTIONS based on the current package and system.
+# -------------------------------------------------------------------------
+
+# Options supported by both mplayer* or mencoder*.
+PKG_SUPPORTED_OPTIONS= dv dvdread gif jpeg mad oss png theora vorbis
+
+# Set options based on the specific package being built.
+.if !empty(PKGNAME:M*mplayer*)
+PKG_SUPPORTED_OPTIONS+= esound nas sdl
+
+. if ${OPSYS} != "SunOS"
+PKG_SUPPORTED_OPTIONS+= arts
+. endif
+.elif !empty(PKGNAME:M*mencoder*)
+PKG_SUPPORTED_OPTIONS+= lame
+.endif
+
+# OS-specific options.
+.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "Linux" || ${OPSYS} == "NetBSD"
+PKG_SUPPORTED_OPTIONS+= cdparanoia
+.elif ${OPSYS} == "SunOS"
+PKG_SUPPORTED_OPTIONS+= mlib
+.endif
+
+# Platform-specific options.
+.if ${MACHINE_ARCH} == "i386"
+PKG_SUPPORTED_OPTIONS+= runtime-cpudetection win32 xvid
+.endif
+.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "powerpc" || \
+ ${MACHINE_ARCH} == "alpha"
+PKG_SUPPORTED_OPTIONS+= real
+.endif
+
+# -------------------------------------------------------------------------
+# Define PKG_DEFAULT_OPTIONS.
+# -------------------------------------------------------------------------
+
+PKG_DEFAULT_OPTIONS+= cdparanoia dv dvdread gif jpeg lame mad \
+ oss png real sdl theora vorbis win32 xvid
+
+# -------------------------------------------------------------------------
+# Define PKG_DEFAULT_OPTIONS based on deprecated variables.
+# -------------------------------------------------------------------------
+
+BUILD_DEFS+= MPLAYER_DISABLE_DRIVERS
+.for d in ${MPLAYER_DISABLE_DRIVERS}
+PKG_DEFAULT_OPTIONS+= -${d:S/esd/esound/}
+.endfor
+.undef d
+
+.if ${MACHINE_ARCH} == "i386"
+BUILD_DEFS+= MPLAYER_ENABLE_RUNTIME_CPU_DETECTION
+. if defined(MPLAYER_ENABLE_RUNTIME_CPU_DETECTION) && \
+ !empty(MPLAYER_ENABLE_RUNTIME_CPU_DETECTION:M[Yy][Ee][Ss])
+PKG_DEFAULT_OPTIONS+= runtime-cpudetection
+. endif
+.endif
+
+.if ${OPSYS} == "SunOS"
+BUILD_DEFS+= MPLAYER_USE_MEDIALIB
+. if defined(MPLAYER_USE_MEDIALIB) && \
+ !empty(MPLAYER_USE_MEDIALIB:M[Yy][Ee][Ss])
+PKG_DEFAULT_OPTIONS+= mlib
+. endif
+.endif
+
+# -------------------------------------------------------------------------
+# Handle chosen options.
+# -------------------------------------------------------------------------
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Marts)
+CONFIGURE_ARGS+= --enable-arts
+. include "../../audio/arts/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-arts
+.endif
+
+.if !empty(PKG_OPTIONS:Mcdparanoia)
+CONFIGURE_ARGS+= --enable-cdparanoia
+CONFIGURE_ARGS+= --with-cdparanoiaincdir="${BUILDLINK_PREFIX.cdparanoia}/include/cdparanoia"
+. include "../../audio/cdparanoia/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-cdparanoia
+.endif
+
+.if !empty(PKG_OPTIONS:Mdv)
+CONFIGURE_ARGS+= --enable-libdv
+. include "../../multimedia/libdv/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-libdv
+.endif
+
+.if !empty(PKG_OPTIONS:Mdvdread)
+CONFIGURE_ARGS+= --enable-dvdread
+. include "../../multimedia/libdvdread/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-dvdread
+.endif
+
+.if !empty(PKG_OPTIONS:Mesound)
+CONFIGURE_ARGS+= --enable-esd
+. include "../../audio/esound/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-esd
+.endif
+
+.if !empty(PKG_OPTIONS:Mgif)
+CONFIGURE_ARGS+= --enable-gif
+. include "../../graphics/libungif/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-gif
+.endif
+
+.if !empty(PKG_OPTIONS:Mjpeg)
+CONFIGURE_ARGS+= --enable-jpeg
+. include "../../graphics/jpeg/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-jpeg
+.endif
+
+.if !empty(PKG_OPTIONS:Mlame)
+#CONFIGURE_ARGS+= --enable-toolame
+. include "../../audio/lame/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-toolame
+.endif
+
+.if !empty(PKG_OPTIONS:Mmad)
+CONFIGURE_ARGS+= --enable-mad
+. include "../../audio/libmad/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-mad
+.endif
+
+.if !empty(PKG_OPTIONS:Mmlib)
+CONFIGURE_ARGS+= --enable-mlib
+.else
+CONFIGURE_ARGS+= --disable-mlib
+.endif
+
+.if !empty(PKG_OPTIONS:Mnas)
+CONFIGURE_ARGS+= --enable-nas
+. include "../../audio/nas/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-nas
+.endif
+
+.if !empty(PKG_OPTIONS:Moss)
+CONFIGURE_ARGS+= --enable-ossaudio
+. include "../../mk/ossaudio.buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-ossaudio
+.endif
+
+.if !empty(PKG_OPTIONS:Mpng)
+CONFIGURE_ARGS+= --enable-png
+. include "../../graphics/png/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-png
+.endif
+
+.if !empty(PKG_OPTIONS:Mreal)
+EVAL_PREFIX+= PREFIX.realplayer-codecs=realplayer-codecs
+PREFIX.realplayer-codecs_DEFAULT= ${LOCALBASE}
+CONFIGURE_ARGS+= --enable-real
+CONFIGURE_ARGS+= --with-reallibdir="${PREFIX.realplayer-codecs}/lib/RealPlayer8-Codecs"
+DEPENDS+= realplayer-codecs>=8nb2:../../multimedia/realplayer-codecs
+.else
+CONFIGURE_ARGS+= --disable-real
+.endif
+
+.if !empty(PKG_OPTIONS:Mruntime-cpudetection)
+CONFIGURE_ARGS+= --enable-runtime-cpudetection
+.else
+CONFIGURE_ARGS+= --disable-runtime-cpudetection
+.endif
+
+.if !empty(PKG_OPTIONS:Msdl)
+CONFIGURE_ARGS+= --enable-sdl
+. include "../../devel/SDL/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-sdl
+.endif
+
+.if !empty(PKG_OPTIONS:Mtheora)
+CONFIGURE_ARGS+= --enable-theora
+. include "../../multimedia/libtheora/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-theora
+.endif
+
+.if !empty(PKG_OPTIONS:Mvorbis)
+CONFIGURE_ARGS+= --enable-vorbis
+. include "../../audio/libvorbis/buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-vorbis
+.endif
+
+.if !empty(PKG_OPTIONS:Mwin32)
+EVAL_PREFIX+= PREFIX.win32-codecs=win32-codecs
+PREFIX.win32-codecs= ${LOCALBASE}
+CONFIGURE_ARGS+= --enable-win32
+CONFIGURE_ARGS+= --with-win32libdir="${PREFIX.win32-codecs}/lib/win32"
+DEPENDS+= win32-codecs>=011227:../../multimedia/win32-codecs
+.else
+CONFIGURE_ARGS+= --disable-win32
+.endif
+
+.endif # !empty(PKGNAME) && empty(PKGNAME:Mmplayer-share*)
Index: mencoder/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/multimedia/mencoder/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- mencoder/Makefile 18 Apr 2005 17:49:41 -0000 1.19
+++ mencoder/Makefile 31 May 2005 18:36:59 -0000
@@ -24,7 +24,5 @@
.include "../../multimedia/mplayer-share/Makefile.depends"
-.include "../../audio/lame/buildlink3.mk"
-
.include "../../mk/bsd.pkg.mk"
.include "../../multimedia/mplayer-share/Makefile.cflags"
--=-QOYZmNrXRtfnLgtgRJMr--