Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulseaudio: enable FreeBSD #4071

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions recipes/pulseaudio/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ sources:
"14.0":
url: "https://www.freedesktop.org/software/pulseaudio/releases/pulseaudio-14.0.tar.xz"
sha256: "a834775d9382b055504e5ee7625dc50768daac29329531deb6597bf05e06c261"
patches:
"14.0":
- patch_file: "patches/pulseaudio-v14.0-92-0efae048.patch"
base_path: "source_subfolder"
- patch_file: "patches/277.patch"
base_path: "source_subfolder"
73 changes: 47 additions & 26 deletions recipes/pulseaudio/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from conans import ConanFile, tools, AutoToolsBuildEnvironment, RunEnvironment
from conans import ConanFile, tools, Meson, RunEnvironment
from conans.errors import ConanInvalidConfiguration
import os

Expand All @@ -24,43 +24,59 @@ class PulseAudioConan(ConanFile):
"with_openssl": [True, False],
# FIXME: enable when #2147 is merged
# "with_dbus": [True, False],
"database": ['gdbm', 'tdb', 'simple'],
"bluez5": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_alsa": True,
"with_glib": False,
"with_fftw": True,
"with_fftw": False,
"with_x11": True,
"with_openssl": True,
# FIXME: enable when #2147 is merged
# "with_dbus": False,
"database": 'simple',
"bluez5": False,
}

build_requires = "gettext/0.20.1", "libtool/2.4.6"

exports_sources = ["patches/*"]

@property
def _source_subfolder(self):
return "source_subfolder"

_autotools = None
@property
def _build_subfolder(self):
return "build_subfolder"

_meson = None

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
if self.settings.os == "FreeBSD":
self.options.with_alsa = False

def configure(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("pulseaudio supports only linux currently")
if self.settings.os not in ["Linux", "FreeBSD"]:
raise ConanInvalidConfiguration("pulseaudio supports only linux and FreeBSD currently")
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def build_requirements(self):
self.build_requires("meson/0.56.1")


def requirements(self):
self.requires("libsndfile/1.0.30")
self.requires("libcap/2.45")
if self.settings.os == "Linux":
self.requires("libcap/2.45")
if self.options.with_alsa:
self.requires("libalsa/1.2.4")
if self.options.with_glib:
Expand All @@ -80,38 +96,43 @@ def source(self):
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)

def _configure_autotools(self):
if not self._autotools:
self._autotools = AutoToolsBuildEnvironment(self)
args=[]
def _configure_meson(self):
if not self._meson:
self._meson = Meson(self)
defs={}

# FIXME: add dbus when #2147 is merged
for lib in ["alsa", "x11", "openssl"]:
args.append("--%s-%s" % ("enable" if getattr(self.options, "with_" + lib) else "disable", lib))
args.append("--%s-glib2" % ("enable" if self.options.with_glib else "disable"))
args.append("--%s-fftw" % ("with" if self.options.with_fftw else "without"))
if self.options.shared:
args.extend(["--enable-shared=yes", "--enable-static=no"])
else:
args.extend(["--enable-shared=no", "--enable-static=yes"])
args.append("--with-udev-rules-dir=%s" % os.path.join(self.package_folder, "bin", "udev", "rules.d"))
args.append("--with-systemduserunitdir=%s" % os.path.join(self.build_folder, "ignore"))
for lib in ["alsa", "x11", "openssl", "glib2", "fftw"]:
defs[lib] = ("enabled" if self.options.get_safe("with_" + lib) else "disabled")
defs["udevrulesdir"] = os.path.join(self.package_folder, "bin", "udev", "rules.d")
defs["systemduserunitdir"] = os.path.join(self.build_folder, "ignore")
defs["database"] = self.options.database
defs["bluez5"] = self.options.bluez5
defs["tests"] = False
if self.settings.os == "FreeBSD":
defs["b_lundef"] = False

with tools.environment_append({"PKG_CONFIG_PATH": self.build_folder}):
with tools.environment_append({
"FFTW_CFLAGS": tools.PkgConfig("fftw").cflags,
"FFTW_LIBS": tools.PkgConfig("fftw").libs}) if self.options.with_fftw else tools.no_op():
with tools.environment_append(RunEnvironment(self).vars):
self._autotools.configure(args=args, configure_dir=self._source_subfolder)
return self._autotools
self._meson.configure(defs=defs, source_folder=self._source_subfolder, build_folder = self._build_subfolder)
return self._meson

def build(self):
autotools = self._configure_autotools()
autotools.make()
for patch in self.conan_data.get("patches", {}).get(self.version, []):
tools.patch(**patch)
tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"),
"bash_completion_dep.found()",
"false")
meson = self._configure_meson()
meson.build()

def package(self):
self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder)
autotools = self._configure_autotools()
autotools.install()
meson = self._configure_meson()
meson.install()
tools.rmdir(os.path.join(self.package_folder, "etc"))
tools.rmdir(os.path.join(self.package_folder, "share"))
tools.rmdir(os.path.join(self.package_folder, "lib", "cmake"))
Expand Down
Loading