1 # $NetBSD: oss.builtin.mk,v 1.2 2006/04/06 06:23:06 reed Exp $
5 BUILTIN_FIND_LIBS
:= ossaudio
6 BUILTIN_FIND_FILES_VAR
:= H_SOUNDCARD
7 BUILTIN_FIND_FILES.H_SOUNDCARD
= /usr
/include/soundcard.h \
8 /usr
/include/sys
/soundcard.h
10 .
include "../../mk/buildlink3/bsd.builtin.mk"
13 ### Determine if there is a built-in implementation of the package and
14 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
16 .if
!defined
(IS_BUILTIN.oss
)
18 . if empty
(H_SOUNDCARD
:M
${LOCALBASE}/*) && empty
(H_SOUNDCARD
:M__nonexistent__
)
22 MAKEVARS
+= IS_BUILTIN.oss
25 ### Determine whether we should use the built-in implementation if it
26 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
28 .if
!defined
(USE_BUILTIN.oss
)
30 # XXX OSS support must always be native as it's provided by the OS.
33 . if
${PREFER.oss
} == "pkgsrc"
36 USE_BUILTIN.oss
= ${IS_BUILTIN.oss
}
37 . if defined
(BUILTIN_PKG.oss
) && \
38 !empty
(IS_BUILTIN.oss
:M
[yY
][eE
][sS
])
40 . for _dep_ in
${BUILDLINK_API_DEPENDS.oss
}
41 . if
!empty
(USE_BUILTIN.oss
:M
[yY
][eE
][sS
])
43 if
${PKG_ADMIN} pmatch
${_dep_
:Q
} ${BUILTIN_PKG.oss
:Q
}; then \
53 MAKEVARS
+= USE_BUILTIN.oss
56 ### The section below only applies if we are not including this file
57 ### solely to determine whether a built-in implementation exists.
59 CHECK_BUILTIN.oss?
= no
60 .if
!empty
(CHECK_BUILTIN.oss
:M
[nN
][oO
])
62 . if
!empty
(USE_BUILTIN.oss
:M
[yY
][eE
][sS
])
63 BUILDLINK_PREFIX.oss
= /usr
64 . if
!empty
(BUILTIN_LIB_FOUND.ossaudio
:M
[yY
][eE
][sS
])
65 BUILDLINK_LDADD.oss
= -lossaudio
67 BUILDLINK_LDADD.oss
= # empty
68 BUILDLINK_TRANSFORM
+= rm:-lossaudio
72 # Many OSS-aware programs expect <soundcard.h> to be found as either
73 # <sys/soundcard.h> or <machine/soundcard.h>, so create a dummy version.
74 # Also include <sys/ioctl.h> prior to including <soundcard.h> since we
75 # need definitions for _IOWR and friends.
77 BUILDLINK_TARGETS
+= buildlink-oss-soundcard-h
78 .PHONY
: buildlink-oss-soundcard-h
79 buildlink-oss-soundcard-h
:
81 sys_soundcard_h
=${BUILDLINK_DIR}/include/sys
/soundcard.h
; \
82 soundcard_h
=${BUILDLINK_PREFIX.oss
}/include/soundcard.h
; \
83 if
${TEST} ! -f
$${sys_soundcard_h} -a
-f
$${soundcard_h}; then \
84 ${ECHO_BUILDLINK_MSG} "Creating $${sys_soundcard_h}."; \
85 ${MKDIR} `${DIRNAME} $${sys_soundcard_h}`; \
86 ( ${ECHO} "#ifndef BUILDLINK_SYS_SOUNDCARD_H"; \
87 ${ECHO} "#define BUILDLINK_SYS_SOUNDCARD_H"; \
88 ${ECHO} "#include <sys/ioctl.h>"; \
89 ${ECHO} "#include <soundcard.h>"; \
91 ) > $${sys_soundcard_h}; \
93 mach_soundcard_h
=${BUILDLINK_DIR}/include/machine
/soundcard.h
; \
94 if
${TEST} ! -f
$${mach_soundcard_h} -a
-f
$${sys_soundcard_h}; then \
95 ${ECHO_BUILDLINK_MSG} "Creating $${mach_soundcard_h}."; \
96 ${MKDIR} `${DIRNAME} $${mach_soundcard_h}`; \
97 ${LN} -s
$${sys_soundcard_h} $${mach_soundcard_h}; \
100 .
endif # CHECK_BUILTIN.oss