summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-03-09 20:23:13 +0000
committerjlam <jlam@pkgsrc.org>2006-03-09 20:23:13 +0000
commitdc0ed7d769156760b0dc84d5a42f1b3df8ea344d (patch)
tree188fc266d5ad5f60ff5b5da3578c4cf77c19ad37
parentafd3bd8212dacdd535d773318622e42b0cdc793a (diff)
downloadpkgsrc-dc0ed7d769156760b0dc84d5a42f1b3df8ea344d.tar.gz
Reimplement OSS audio handling in pkgsrc. Add two new files:
oss.buildlink3.mk oss.builtin.mk that work like modern buildlink3.mk and builtin.mk files do. We no longer support audio/oss (which will be removed shortly). Mark ossaudio.buildlink3.mk for deprecation after all references to it have been replaced with "oss.buildlink3.mk" in package Makefiles.
-rw-r--r--mk/oss.buildlink3.mk29
-rw-r--r--mk/oss.builtin.mk100
-rw-r--r--mk/ossaudio.buildlink3.mk83
3 files changed, 133 insertions, 79 deletions
diff --git a/mk/oss.buildlink3.mk b/mk/oss.buildlink3.mk
new file mode 100644
index 00000000000..33a4e23b80e
--- /dev/null
+++ b/mk/oss.buildlink3.mk
@@ -0,0 +1,29 @@
+# $NetBSD: oss.buildlink3.mk,v 1.1 2006/03/09 20:23:13 jlam Exp $
+#
+# This Makefile fragment is included by packages that require an Open Sound
+# System (OSS) implementation.
+#
+OSS_BUILDLINK3_MK:= ${OSS_BUILDLINK3_MK}+
+
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Noss}
+BUILDLINK_PACKAGES+= oss
+BUILDLINK_BUILTIN_MK.oss= ../../mk/oss.builtin.mk
+
+.if !empty(OSS_BUILDLINK3_MK:M+)
+LIBOSSAUDIO?= ${BUILDLINK_LDADD.oss}
+. if (${OPSYS} == "Linux") && exists(/dev/dsp)
+DEVOSSAUDIO?= /dev/dsp
+DEVOSSSOUND?= /dev/dsp
+. else
+DEVOSSAUDIO?= /dev/audio
+DEVOSSSOUND?= /dev/sound
+. endif
+
+CONFIGURE_ENV+= LIBOSSAUDIO=${LIBOSSAUDIO:Q}
+CONFIGURE_ENV+= DEVOSSAUDIO=${DEVOSSAUDIO:Q}
+CONFIGURE_ENV+= DEVOSSSOUND=${DEVOSSSOUND:Q}
+
+MAKE_ENV+= LIBOSSAUDIO=${LIBOSSAUDIO:Q}
+MAKE_ENV+= DEVOSSAUDIO=${DEVOSSAUDIO:Q}
+MAKE_ENV+= DEVOSSSOUND=${DEVOSSSOUND:Q}
+.endif # OSS_BUILDLINK3_MK
diff --git a/mk/oss.builtin.mk b/mk/oss.builtin.mk
new file mode 100644
index 00000000000..b658542fb36
--- /dev/null
+++ b/mk/oss.builtin.mk
@@ -0,0 +1,100 @@
+# $NetBSD: oss.builtin.mk,v 1.1 2006/03/09 20:23:13 jlam Exp $
+
+BUILTIN_PKG:= oss
+
+BUILTIN_FIND_LIBS:= ossaudio
+BUILTIN_FIND_FILES_VAR:= H_SOUNDCARD
+BUILTIN_FIND_FILES.H_SOUNDCARD= /usr/include/soundcard.h \
+ /usr/include/sys/soundcard.h
+
+.include "../../mk/buildlink3/bsd.builtin.mk"
+
+###
+### Determine if there is a built-in implementation of the package and
+### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
+###
+.if !defined(IS_BUILTIN.oss)
+IS_BUILTIN.oss= no
+. if empty(H_SOUNDCARD:M${LOCALBASE}/*) && empty(H_SOUNDCARD:M__nonexistent__)
+IS_BUILTIN.oss= yes
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.oss
+
+###
+### Determine whether we should use the built-in implementation if it
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+###
+.if !defined(USE_BUILTIN.oss)
+# XXX
+# XXX OSS support must always be native as it's provided by the OS.
+# XXX
+PREFER.oss= native
+. if ${PREFER.oss} == "pkgsrc"
+USE_BUILTIN.oss= no
+. else
+USE_BUILTIN.oss= ${IS_BUILTIN.oss}
+. if defined(BUILTIN_PKG.oss) && \
+ !empty(IS_BUILTIN.oss:M[yY][eE][sS])
+USE_BUILTIN.oss= yes
+. for _dep_ in ${BUILDLINK_DEPENDS.oss}
+. if !empty(USE_BUILTIN.oss:M[yY][eE][sS])
+USE_BUILTIN.oss!= \
+ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.oss:Q}; then \
+ ${ECHO} yes; \
+ else \
+ ${ECHO} no; \
+ fi
+. endif
+. endfor
+. endif
+. endif # PREFER.oss
+.endif
+MAKEVARS+= USE_BUILTIN.oss
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.oss?= no
+.if !empty(CHECK_BUILTIN.oss:M[nN][oO])
+
+. if !empty(USE_BUILTIN.oss:M[yY][eE][sS])
+BUILDLINK_PREFIX.oss= /usr
+. if !empty(BUILTIN_LIB_FOUND.ossaudio:M[yY][eE][sS])
+BUILDLINK_LDADD.oss= -lossaudio
+. else
+BUILDLINK_LDADD.oss= # empty
+BUILDLINK_TRANSFORM+= rm:-lossaudio
+. endif
+. endif
+
+# Many OSS-aware programs expect <soundcard.h> to be found as either
+# <sys/soundcard.h> or <machine/soundcard.h>, so create a dummy version.
+# Also include <sys/ioctl.h> prior to including <soundcard.h> since we
+# need definitions for _IOWR and friends.
+#
+BUILDLINK_TARGETS+= buildlink-oss-soundcard-h
+.PHONY: buildlink-oss-soundcard-h
+buildlink-oss-soundcard-h:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ sys_soundcard_h=${BUILDLINK_DIR}/include/sys/soundcard.h; \
+ soundcard_h=${BUILDLINK_PREFIX.oss}/include/soundcard.h; \
+ if ${TEST} ! -f $${sys_soundcard_h} -a -f $${soundcard_h}; then \
+ ${ECHO_BUILDLINK_MSG} "Creating $${sys_soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${sys_soundcard_h}`; \
+ ( ${ECHO} "#ifndef BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#define BUILDLINK_SYS_SOUNDCARD_H"; \
+ ${ECHO} "#include <sys/ioctl.h>"; \
+ ${ECHO} "#include <soundcard.h>"; \
+ ${ECHO} "#endif"; \
+ ) > $${sys_soundcard_h}; \
+ fi; \
+ mach_soundcard_h=${BUILDLINK_DIR}/include/machine/soundcard.h; \
+ if ${TEST} ! -f $${mach_soundcard_h} -a -f $${sys_soundcard_h}; then \
+ ${ECHO_BUILDLINK_MSG} "Creating $${mach_soundcard_h}."; \
+ ${MKDIR} `${DIRNAME} $${mach_soundcard_h}`; \
+ ${LN} -s $${sys_soundcard_h} $${mach_soundcard_h}; \
+ fi
+
+.endif # CHECK_BUILTIN.oss
diff --git a/mk/ossaudio.buildlink3.mk b/mk/ossaudio.buildlink3.mk
index 7222faa4067..e8c5b3cadd4 100644
--- a/mk/ossaudio.buildlink3.mk
+++ b/mk/ossaudio.buildlink3.mk
@@ -1,81 +1,6 @@
-# $NetBSD: ossaudio.buildlink3.mk,v 1.5 2005/12/05 22:07:07 rillig Exp $
+# $NetBSD: ossaudio.buildlink3.mk,v 1.6 2006/03/09 20:23:13 jlam Exp $
#
-# This file should be included by Makefiles for packages that use OSS.
-# By checking the value of HAVE_OSS after including this file, it's possible
-# to check whether audio/oss is installed, or if ossaudio OSS emulation
-# should be used instead:
+# This file is temporary and will be removed after references to
+# "ossaudio.buildlink3.mk" have been converted to "oss.buildlink3.mk".
#
-# .include "../../mk/ossaudio.buildlink3.mk"
-#
-# .if defined(HAVE_OSS) && (${HAVE_OSS} == "YES")
-# CONFIGURE_ENV+= ac_cv_libossaudio__oss_ioctl=no
-# .endif
-#
-OSSAUDIO_BUILDLINK3_MK:= ${OSSAUDIO_BUILDLINK3_MK}+
-
-.include "../../mk/bsd.prefs.mk"
-
-.if !empty(OSSAUDIO_BUILDLINK3_MK:M+)
-. if !defined(_HAVE_OSS)
-_HAVE_OSS!= if ${PKG_INFO} -qe oss; then ${ECHO} YES; else ${ECHO} NO; fi
-MAKEFLAGS+= _HAVE_OSS=${_HAVE_OSS:Q}
-. endif
-HAVE_OSS?= ${_HAVE_OSS}
-.endif # OSSAUDIO_BUILDLINK3_MK
-
-.if defined(HAVE_OSS) && (${HAVE_OSS} == "YES")
-. include "../../audio/oss/buildlink3.mk"
-.else
-BUILDLINK_PREFIX.oss= /usr
-. if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD"
-LIBOSSAUDIO?= -lossaudio
-DEVOSSAUDIO?= /dev/audio
-DEVOSSSOUND?= /dev/sound
-. elif ${OPSYS} == "Linux"
-LIBOSSAUDIO?= # empty
-DEVOSSAUDIO?= /dev/dsp
-DEVOSSSOUND?= /dev/dsp
-. else
-LIBOSSAUDIO?= # empty
-DEVOSSAUDIO?= /dev/audio
-DEVOSSSOUND?= /dev/sound
-. endif
-.endif
-
-.if !empty(OSSAUDIO_BUILDLINK3_MK:M+)
-CONFIGURE_ENV+= LIBOSSAUDIO=${LIBOSSAUDIO:Q}
-CONFIGURE_ENV+= DEVOSSAUDIO=${DEVOSSAUDIO:Q}
-CONFIGURE_ENV+= DEVOSSSOUND=${DEVOSSSOUND:Q}
-
-MAKE_ENV+= LIBOSSAUDIO=${LIBOSSAUDIO:Q}
-MAKE_ENV+= DEVOSSAUDIO=${DEVOSSAUDIO:Q}
-MAKE_ENV+= DEVOSSSOUND=${DEVOSSSOUND:Q}
-
-BUILDLINK_TARGETS+= buildlink-ossaudio-soundcard-h
-
-# Many programs expect <soundcard.h> to be found as <sys/soundcard.h>.
-# Also include <sys/ioctl.h> prior to include <soundcard.h> since we need
-# definitions for _IOWR and friends.
-#
-.PHONY: buildlink-ossaudio-soundcard-h
-buildlink-ossaudio-soundcard-h:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- sys_soundcard_h=${BUILDLINK_DIR}/include/sys/soundcard.h; \
- soundcard_h=${BUILDLINK_PREFIX.oss}/include/soundcard.h; \
- if [ ! -f $${sys_soundcard_h} -a -f $${soundcard_h} ]; then \
- ${ECHO_BUILDLINK_MSG} "Creating $${sys_soundcard_h}."; \
- ${MKDIR} `${DIRNAME} $${sys_soundcard_h}`; \
- ( ${ECHO} "#ifndef BUILDLINK_SYS_SOUNDCARD_H"; \
- ${ECHO} "#define BUILDLINK_SYS_SOUNDCARD_H"; \
- ${ECHO} "#include <sys/ioctl.h>"; \
- ${ECHO} "#include <soundcard.h>"; \
- ${ECHO} "#endif"; \
- ) > $${sys_soundcard_h}; \
- fi; \
- mach_soundcard_h=${BUILDLINK_DIR}/include/machine/soundcard.h; \
- if [ ! -f $${mach_soundcard_h} -a -f $${sys_soundcard_h} ]; then \
- ${ECHO_BUILDLINK_MSG} "Creating $${mach_soundcard_h}."; \
- ${MKDIR} `${DIRNAME} $${mach_soundcard_h}`; \
- ${LN} -s $${sys_soundcard_h} $${mach_soundcard_h}; \
- fi
-.endif # OSSAUDIO_BUILDLINK3_MK
+.include "../../mk/oss.buildlink3.mk"