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

[nas] Network audio system #6388

Merged
merged 16 commits into from
Aug 17, 2021
6 changes: 6 additions & 0 deletions recipes/nas/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sources:
"1.9.4":
- url: "https://downloads.sourceforge.net/nas/nas-1.9.4.src.tar.gz"
sha256: cf36ea63751ce86cfd3b76c1659ce0d6a361a2e7cb34069854e156532703b39d
jgsogo marked this conversation as resolved.
Show resolved Hide resolved
- url: "https://unlicense.org/UNLICENSE"
sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c"
83 changes: 83 additions & 0 deletions recipes/nas/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from conans import ConanFile, tools, AutoToolsBuildEnvironment
from conans.errors import ConanInvalidConfiguration
import os
import shutil


class NasRecipe(ConanFile):
name = "nas"
description = "The Network Audio System is a network transparent, client/server audio transport system."
topics = ("audio", "sound")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://www.radscan.com/nas.html"
license = "Unlicense"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

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

@property
def _build_subfolder(self):
return "build_subfolder"

def configure(self):
if self.options.shared:
del self.options.fPIC
del self.settings.compiler.libcxx
del self.settings.compiler.cppstd

def validate(self):
if self.settings.os != "Linux":
raise ConanInvalidConfiguration("Recipe supports Linux only")

def requirements(self):
self.requires("xorg/system")

def build_requirements(self):
self.build_requires("bison/3.7.1")
self.build_requires("flex/2.6.4")

def source(self):
tools.get(**self.conan_data["sources"][self.version][0], strip_root=True, destination=self._source_subfolder)
tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1])

def build(self):
with tools.chdir(self._source_subfolder):
env_build = AutoToolsBuildEnvironment(self)
self.run("xmkmf")
SSE4 marked this conversation as resolved.
Show resolved Hide resolved
env_build.make(target="World")

def package(self):
self.copy("LICENSE", dst="licenses")

tmp_install = os.path.join(self.build_folder, "tmp-install")
with tools.chdir(self._source_subfolder):
env_build = AutoToolsBuildEnvironment(self)
env_build_vars = env_build.vars
env_build_vars["DESTDIR"] = tmp_install
env_build.install(vars=env_build_vars)

self.copy("*", src=os.path.join(tmp_install, "usr"), dst=self.package_folder)

shutil.rmtree(os.path.join(self.package_folder, "lib", "X11"))
with tools.chdir(os.path.join(self.package_folder, "lib")):
files = os.listdir()
for f in files:
if (self.options.shared and f.endswith(".a")) or (not self.options.shared and not f.endswith(".a")):
os.unlink(f)

def package_info(self):
self.cpp_info.libs = ["audio"]
jgsogo marked this conversation as resolved.
Show resolved Hide resolved

bin_path = os.path.join(self.package_folder, "bin")
self.output.info('Appending PATH environment variable: %s' % bin_path)
self.env_info.path.append(bin_path)
8 changes: 8 additions & 0 deletions recipes/nas/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(PackageTest)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_executable(example test_package.c)
target_link_libraries(example ${CONAN_LIBS})
16 changes: 16 additions & 0 deletions recipes/nas/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
from conans import ConanFile, CMake, tools

class NasTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
jgsogo marked this conversation as resolved.
Show resolved Hide resolved
bin_path = os.path.join("bin", "example")
self.run(bin_path, run_environment=True)
11 changes: 11 additions & 0 deletions recipes/nas/all/test_package/test_package.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

#include <stdio.h>

#include <audio/audiolib.h>

int main(void)
{
printf("NAS test_package\n");
AuServer* aud = AuOpenServer(NULL, 0, NULL, 0, NULL, NULL);
return 0;
}
3 changes: 3 additions & 0 deletions recipes/nas/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.9.4":
folder: all