forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add SDK mode where apulse acts as drop-in replacement for pulseaudio: headers and pkg-config files are provided, libraries are installed in standard path. Signed-off-by: Andrew Savchenko <[email protected]> Package-Manager: Portage-2.3.49, Repoman-2.3.10
- Loading branch information
Showing
3 changed files
with
149 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright 1999-2018 Gentoo Foundation | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=6 | ||
|
||
inherit multilib cmake-multilib | ||
|
||
DESCRIPTION="PulseAudio emulation for ALSA" | ||
HOMEPAGE="https://github.com/i-rinat/apulse" | ||
SRC_URI="https://github.com/i-rinat/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" | ||
|
||
LICENSE="MIT LGPL-2.1" | ||
SLOT="0" | ||
KEYWORDS="~amd64 ~x86" | ||
|
||
IUSE="debug sdk test" | ||
|
||
DEPEND="dev-libs/glib:2[${MULTILIB_USEDEP}] | ||
media-libs/alsa-lib[${MULTILIB_USEDEP}] | ||
sdk? ( !media-sound/pulseaudio ) " | ||
RDEPEND="${DEPEND} | ||
!!media-plugins/alsa-plugins[pulseaudio]" | ||
|
||
MULTILIB_CHOST_TOOLS=( /usr/bin/apulse ) | ||
|
||
PATCHES=( "${FILESDIR}/sdk.patch" ) | ||
|
||
src_prepare() { | ||
cmake-utils_src_prepare | ||
|
||
if ! use sdk; then | ||
# Ensure all relevant libdirs are added, to support all ABIs | ||
DIRS= | ||
_add_dir() { DIRS="${EPREFIX}/usr/$(get_libdir)/apulse${DIRS:+:${DIRS}}"; } | ||
multilib_foreach_abi _add_dir | ||
sed -e "s#@@DIRS@@#${DIRS}#g" "${FILESDIR}"/apulse > "${T}"/apulse || die | ||
fi | ||
} | ||
|
||
multilib_src_configure() { | ||
local mycmakeargs=( | ||
"-DINSTALL_SDK=$(usex sdk)" | ||
"-DLOG_TO_STDERR=$(usex debug)" | ||
"-DWITH_TRACE=$(usex debug)" | ||
) | ||
cmake-utils_src_configure | ||
} | ||
|
||
multilib_src_test() { | ||
emake check | ||
} | ||
|
||
multilib_src_install_all() { | ||
cmake-utils_src_install | ||
einstalldocs | ||
use sdk || dobin "${T}"/apulse | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 072f3b1..eff028d 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -28,6 +28,8 @@ else() | ||
include_directories(${PA_INCLUDE_DIRECTORIES}) | ||
endif() | ||
|
||
+set(INSTALL_SDK 0 CACHE BOOLEAN "Install SDK files to build applications with apulse (Pulse Audio headers and pkg-config files) instead of system ones") | ||
+ | ||
link_directories(${REQ_LIBRARY_DIRS}) | ||
|
||
add_library(trace-helper STATIC | ||
@@ -72,12 +74,30 @@ target_link_libraries(pulse-simple ${SYMBOLMAP} trace-helper ${REQ_LIBRARIES}) | ||
|
||
add_subdirectory(tests) | ||
|
||
-set(APULSEPATH "${CMAKE_INSTALL_PREFIX}/lib/apulse" CACHE PATH "library installation directory") | ||
+if (${INSTALL_SDK}) | ||
+ set(APULSEPATH "${CMAKE_INSTALL_LIBDIR}" CACHE PATH "library installation directory") | ||
+else() | ||
+ set(APULSEPATH "${CMAKE_INSTALL_LIBDIR}/apulse" CACHE PATH "library installation directory") | ||
+endif() | ||
+ | ||
set(APULSE_SEARCH_PATHS "${APULSEPATH}" CACHE PATH "directory list for LD_LIBRARY_PATH") | ||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/apulse.template" | ||
"${CMAKE_CURRENT_BINARY_DIR}/apulse" @ONLY) | ||
+if (${INSTALL_SDK}) | ||
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse.pc.in" | ||
+ "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse.pc" @ONLY) | ||
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse-simple.pc.in" | ||
+ "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse-simple.pc" @ONLY) | ||
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pkgconfig/libpulse-mainloop-glib.pc.in" | ||
+ "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/libpulse-mainloop-glib.pc" @ONLY) | ||
+endif() | ||
|
||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/apulse" DESTINATION bin | ||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||
install(TARGETS pulse-simple pulse pulse-mainloop-glib DESTINATION "${APULSEPATH}") | ||
install(FILES "${CMAKE_SOURCE_DIR}/man/apulse.1" DESTINATION share/man/man1) | ||
+ | ||
+if (${INSTALL_SDK}) | ||
+ install(DIRECTORY "${CMAKE_SOURCE_DIR}/3rdparty/pulseaudio-headers/pulse" DESTINATION include) | ||
+ install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig" DESTINATION "${CMAKE_INSTALL_LIBDIR}") | ||
+endif() | ||
diff --git a/pkgconfig/libpulse-mainloop-glib.pc.in b/pkgconfig/libpulse-mainloop-glib.pc.in | ||
new file mode 100644 | ||
index 0000000..957e3b2 | ||
--- /dev/null | ||
+++ b/pkgconfig/libpulse-mainloop-glib.pc.in | ||
@@ -0,0 +1,9 @@ | ||
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@ | ||
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ | ||
+ | ||
+Name: libpulse-mainloop-glib | ||
+Description: PulseAudio GLib 2.0 Main Loop Wrapper (apulse) | ||
+Version: 5.0 | ||
+Libs: -L${libdir} -lpulse-mainloop-glib -pthread | ||
+Cflags: -I${includedir} | ||
+Requires: glib-2.0 | ||
diff --git a/pkgconfig/libpulse-simple.pc.in b/pkgconfig/libpulse-simple.pc.in | ||
new file mode 100644 | ||
index 0000000..3809d50 | ||
--- /dev/null | ||
+++ b/pkgconfig/libpulse-simple.pc.in | ||
@@ -0,0 +1,9 @@ | ||
+libdir=@CMAKE_INSTALL_FULL__LIBDIR@ | ||
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ | ||
+ | ||
+Name: libpulse-simple | ||
+Description: PulseAudio Simplified Synchronous Client Interface (apulse) | ||
+Version: 5.0 | ||
+Libs: -L${libdir} -lpulse-simple -pthread | ||
+Cflags: -I${includedir} | ||
+Requires: glib-2.0 | ||
diff --git a/pkgconfig/libpulse.pc.in b/pkgconfig/libpulse.pc.in | ||
new file mode 100644 | ||
index 0000000..edcbbd8 | ||
--- /dev/null | ||
+++ b/pkgconfig/libpulse.pc.in | ||
@@ -0,0 +1,9 @@ | ||
+libdir=@CMAKE_INSTALL_FULL_LIBDIR@ | ||
+includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ | ||
+ | ||
+Name: libpulse | ||
+Description: PulseAudio Client Interface (apulse) | ||
+Version: 5.0 | ||
+Libs: -L${libdir} -lpulse -pthread | ||
+Cflags: -I${includedir} | ||
+Requires: glib-2.0 alsa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters