Skip to content

Commit

Permalink
Update Linux build scripts, enable alsa, remove libpng dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjs committed Jul 30, 2021
1 parent 7563f2a commit 6572307
Show file tree
Hide file tree
Showing 84 changed files with 14,891 additions and 9 deletions.
5 changes: 4 additions & 1 deletion make-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ INSTALL_PATH=$(cd $INSTALL_DIR; pwd)
INSTALL_LIB_PATH=$INSTALL_PATH/lib/x86_64-linux-gnu
cd $CUR_DIR

meson --prefix=$INSTALL_PATH --default-library=static -Ddebug=false -Doptimization=s -Dintrospection=disabled -Dglib:default_library=shared -Dglib:tests=false -Dgst-plugins-good:cairo=disabled -Dgst-plugins-good:soup=disabled -Dgst-plugins-good:tests=disabled -Dgst-plugins-good:dv=disabled -Dgst-plugins-bad:openh264=disabled -Dgst-plugins-bad:openjpeg=disabled -Dgst-plugins-bad:tests=disabled -Dgst-plugins-base:pango=disabled -DFFmpeg:libfreetype=disabled -Dcairo:freetype=disabled -Dlibsoup:tests=false -Dugly=disabled -Dpython=disabled -Ddevtools=disabled -Dgst-examples=disabled -Dtls=disabled -Dqt5=disabled -Dtests=disabled -Dexamples=disabled -Dc_args="-DG_INTL_STATIC_COMPILATION -DFFI_STATIC_BUILD -DORC_STATIC_COMPILATION -DPSL_STATIC -DLIBXML_STATIC -DOPJ_STATIC -DPCRE_STATIC -fPIC" -Dcpp_args="-DG_INTL_STATIC_COMPILATION -DFFI_STATIC_BUILD -DORC_STATIC_COMPILATION -DPSL_STATIC -DLIBXML_STATIC -DOPJ_STATIC -DPCRE_STATIC -fPIC" -Dasm_args="-fPIC" -Dgst-full-version-script="" $BUILD_DIR
meson --prefix=$INSTALL_PATH --default-library=static -Ddebug=false --force-fallback-for=libffi -Doptimization=s --wrap-mode=nodownload -Dintrospection=disabled -Dges=disabled -Dglib:default_library=shared -Dglib:tests=false -Dgstreamer:gst_debug=false -Dgstreamer:glib-asserts=disabled -Dgstreamer:glib-checks=disabled -Dgstreamer:extra-checks=disabled -Dgst-plugins-good:gobject-cast-checks=disabled -Dgst-plugins-good:glib-asserts=disabled -Dgst-plugins-good:glib-checks=disabled -Dgst-plugins-base:gobject-cast-checks=disabled -Dgst-plugins-base:glib-asserts=disabled -Dgst-plugins-base:glib-checks=disabled -Dgst-plugins-bad:gobject-cast-checks=disabled -Dgst-plugins-bad:glib-asserts=disabled -Dgst-plugins-bad:glib-checks=disabled -Dgst-plugins-good:cairo=disabled -Dgst-plugins-good:soup=disabled -Dgst-plugins-good:tests=disabled -Dgst-plugins-good:dv=disabled -Dgst-plugins-bad:openh264=disabled -Dgst-plugins-bad:openjpeg=disabled -Dgst-plugins-bad:tests=disabled -Dgst-plugins-base:pango=disabled -DFFmpeg:libfreetype=disabled -Dcairo:freetype=disabled -Dlibsoup:tests=false -Dugly=disabled -Dpython=disabled -Ddevtools=disabled -Dgst-examples=disabled -Dtls=disabled -Dqt5=disabled -Dtests=disabled -Dexamples=disabled -Dc_args="-DG_INTL_STATIC_COMPILATION -DFFI_STATIC_BUILD -DORC_STATIC_COMPILATION -DPSL_STATIC -DLIBXML_STATIC -DOPJ_STATIC -DPCRE_STATIC" -Dcpp_args="-DG_INTL_STATIC_COMPILATION -DFFI_STATIC_BUILD -DORC_STATIC_COMPILATION -DPSL_STATIC -DLIBXML_STATIC -DOPJ_STATIC -DPCRE_STATIC" -Dgst-full-version-script="" $BUILD_DIR
cd $BUILD_DIR
ninja
ninja install

cd $INSTALL_LIB_PATH

patchelf --set-rpath '$ORIGIN' libgio-2.0.so
patchelf --set-rpath '$ORIGIN' libglib-2.0.so
patchelf --set-rpath '$ORIGIN' libgmodule-2.0.so
patchelf --set-rpath '$ORIGIN' libgobject-2.0.so
patchelf --set-rpath '$ORIGIN' libgstreamer-full-1.0.so
patchelf --set-rpath '$ORIGIN' libgthread-2.0.so

cd $CUR_DIR
18 changes: 13 additions & 5 deletions subprojects/FFmpeg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ if host_machine.system() == 'windows'
include_directories : ffmpeg_inc,
version : '56.70.100')
else
libavcodec_dep = declare_dependency(
link_args : ['-L' + ffmpeg_lib_dir, '-lavcodec', '-lswresample', '-liconv'],
include_directories : ffmpeg_inc,
version : '58.134.100')

if host_machine.system() == 'darwin'
libavcodec_dep = declare_dependency(
link_args : ['-L' + ffmpeg_lib_dir, '-lavcodec', '-lswresample', '-liconv'],
include_directories : ffmpeg_inc,
version : '58.134.100')
else
libavcodec_dep = declare_dependency(
link_args : ['-L' + ffmpeg_lib_dir, '-lavcodec', '-lswresample'],
include_directories : ffmpeg_inc,
version : '58.134.100')
endif

libavformat_dep = declare_dependency(
link_args : ['-L' + ffmpeg_lib_dir, '-lavformat'],
Expand All @@ -58,4 +66,4 @@ meson.override_dependency('libavformat', libavformat_dep)

meson.override_dependency('libavfilter', libavfilter_dep)

meson.override_dependency('libavutil', libavutil_dep)
meson.override_dependency('libavutil', libavutil_dep)
4 changes: 2 additions & 2 deletions subprojects/gst-plugins-base/ext/gl/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ if graphene_dep.found()
]
endif

png_dep = dependency('libpng', version : '>=1.0', required : get_option('gl-png'))
jpeg_dep = dependency('libjpeg', required : get_option('gl-jpeg'))
png_dep = dependency('libpngdummy', version : '>=1.0', required : get_option('gl-png'))
jpeg_dep = dependency('libjpegdummy', required : get_option('gl-jpeg'))

if png_dep.found()
optional_deps += png_dep
Expand Down
2 changes: 1 addition & 1 deletion subprojects/gst-plugins-good/ext/libpng/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ png_sources = [
'gstpngdec.c',
]

libpng_dep = dependency('libpng', version : '>=1.2', required : get_option('png'))
libpng_dep = dependency('libpngdummy', version : '>=1.2', required : get_option('png'))

if libpng_dep.found()
gstpng = library('gstpng',
Expand Down
23 changes: 23 additions & 0 deletions subprojects/tinyalsa/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/doxygen/html
/doxygen/man

/build

*.o
*.so
*.so.*
*.a

/libs
/obj

/examples/audio.raw
/examples/pcm-readi
/examples/pcm-writei

/utils/tinyplay
/utils/tinycap
/utils/tinymix
/utils/tinypcminfo

/bazel*
23 changes: 23 additions & 0 deletions subprojects/tinyalsa/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
os: linux
dist: bionic
sudo: false
language: c
compiler:
- gcc
- clang

addons:
apt:
packages:
- doxygen
- graphviz
- python3-pip
- python3-setuptools

before_script:
- pip3 install --upgrade pip
- pip3 install --user ninja
- pip3 install --user meson

script:
- scripts/travis-build.sh
104 changes: 104 additions & 0 deletions subprojects/tinyalsa/Android.bp
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
package {
default_applicable_licenses: ["external_tinyalsa_new_license"],
}

// Added automatically by a large-scale-change that took the approach of
// 'apply every license found to every target'. While this makes sure we respect
// every license restriction, it may not be entirely correct.
//
// e.g. GPL in an MIT project might only apply to the contrib/ directory.
//
// Please consider splitting the single license below into multiple licenses,
// taking care not to lose any license_kind information, and overriding the
// default license using the 'licenses: [...]' property on targets as needed.
//
// For unused files, consider creating a 'fileGroup' with "//visibility:private"
// to attach the license to, and including a comment whether the files may be
// used in the current project.
// See: http://go/android-license-faq
license {
name: "external_tinyalsa_new_license",
visibility: [":__subpackages__"],
license_kinds: [
"SPDX-license-identifier-BSD",
"SPDX-license-identifier-Unlicense",
],
license_text: [
"NOTICE",
],
}

cc_library {
name: "libtinyalsav2",
host_supported: true,
vendor_available: true,
srcs: [
"src/mixer.c",
"src/mixer_hw.c",
"src/mixer_plugin.c",
"src/pcm.c",
"src/pcm_hw.c",
"src/pcm_plugin.c",
"src/snd_card_plugin.c",
],
cflags: ["-Werror", "-Wno-macro-redefined"],
export_include_dirs: ["include"],
local_include_dirs: ["include"],

target: {
darwin: {
enabled: false,
},
},

system_shared_libs: ["libc", "libdl"],

sanitize: {
integer_overflow: true,
misc_undefined: ["bounds"],
diag: {
integer_overflow: true,
misc_undefined: ["bounds"],
},
},
}

cc_library_headers {
name: "libtinyalsav2_headers",
export_include_dirs: ["include"],
vendor_available: true,
}

cc_binary {
name: "tinyplay2",
host_supported: true,
srcs: ["utils/tinyplay.c"],
static_libs: ["libtinyalsav2"],
cflags: ["-Werror"],
target: {
darwin: {
enabled: false,
},
},
}

cc_binary {
name: "tinycap2",
srcs: ["utils/tinycap.c"],
static_libs: ["libtinyalsav2"],
cflags: ["-Werror"],
}

cc_binary {
name: "tinymix2",
srcs: ["utils/tinymix.c"],
static_libs: ["libtinyalsav2"],
cflags: ["-Werror", "-Wall"],
}

cc_binary {
name: "tinypcminfo2",
srcs: ["utils/tinypcminfo.c"],
static_libs: ["libtinyalsav2"],
cflags: ["-Werror"],
}
57 changes: 57 additions & 0 deletions subprojects/tinyalsa/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# BUILD
#
# Copyright 2020, The Android Open Source Project
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of The Android Open Source Project nor the names of
# its contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY The Android Open Source Project ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL The Android Open Source Project BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
# DAMAGE.
#

cc_library(
name = "tinyalsa",
srcs = glob(["src/*.c"]),
includes = ["include"],
hdrs = glob([
"include/**/*.h",
"src/*.h",
]),
visibility = ["//visibility:public"],
)

cc_test(
name = "tinyalsa_tests",
srcs = glob([
"tests/src/*.cc",
"tests/include/*.h",
]),
includes = ["tests/include"],
deps = [
"//:tinyalsa",
"@googletest//:gtest_main"
],
linkopts = [
"-ldl",
],
copts = [
"-std=c++17",
],
)
97 changes: 97 additions & 0 deletions subprojects/tinyalsa/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
cmake_minimum_required(VERSION 3.1)

execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/version.sh -s print
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE TINYALSA_VERSION)

project("TinyALSA" VERSION ${TINYALSA_VERSION} LANGUAGES C)

set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)

# Options
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(TINYALSA_USES_PLUGINS "Whether or not to build with plugin support" OFF)
option(TINYALSA_BUILD_EXAMPLES "Build examples" ON)
option(TINYALSA_BUILD_UTILS "Build utility tools" ON)

# Library
add_library("tinyalsa"
"src/pcm.c"
"src/pcm_hw.c"
"src/pcm_plugin.c"
"src/snd_card_plugin.c"
"src/mixer.c"
"src/mixer_hw.c"
"src/mixer_plugin.c")

set_property(TARGET "tinyalsa" PROPERTY PUBLIC_HEADER
"include/tinyalsa/attributes.h"
"include/tinyalsa/version.h"
"include/tinyalsa/asoundlib.h"
"include/tinyalsa/pcm.h"
"include/tinyalsa/plugin.h"
"include/tinyalsa/mixer.h")

set_target_properties("tinyalsa" PROPERTIES
VERSION ${TinyALSA_VERSION}
SOVERSION ${TinyALSA_VERSION_MAJOR})

target_include_directories("tinyalsa" PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_definitions("tinyalsa" PRIVATE
$<$<BOOL:${TINYALSA_USES_PLUGINS}>:TINYALSA_USES_PLUGINS>
PUBLIC _POSIX_C_SOURCE=200809L)
target_link_libraries("tinyalsa" PUBLIC ${CMAKE_DL_LIBS})

# Examples
if(TINYALSA_BUILD_EXAMPLES)
set(TINYALSA_EXAMPLES pcm-readi pcm-writei)
else()
set(TINYALSA_EXAMPLES)
endif()

foreach(EXAMPLE IN LISTS TINYALSA_EXAMPLES)
add_executable("${EXAMPLE}" "examples/${EXAMPLE}.c")
target_link_libraries("${EXAMPLE}" PRIVATE "tinyalsa")
endforeach()

# Utilities
if(TINYALSA_BUILD_UTILS)
set(TINYALSA_UTILS tinyplay tinycap tinypcminfo tinymix tinywavinfo)
else()
set(TINYALSA_UTILS)
endif()

foreach(UTIL IN LISTS TINYALSA_UTILS)
add_executable("${UTIL}" "utils/${UTIL}.c")
target_link_libraries("${UTIL}" PRIVATE "tinyalsa")
endforeach()

if(TINYALSA_BUILD_UTILS)
target_link_libraries("tinywavinfo" PRIVATE m)
endif()

# Add C warning flags
include(CheckCCompilerFlag)
foreach(FLAG IN ITEMS -Wall -Wextra -Wpedantic -Werror -Wfatal-errors)
string(TOUPPER "HAVE${FLAG}" HAVE_VAR)
string(REPLACE "-" "_" HAVE_VAR "${HAVE_VAR}")
check_c_compiler_flag("${FLAG}" "${HAVE_VAR}")
if("${${HAVE_VAR}}")
target_compile_options("tinyalsa" PRIVATE "${FLAG}")
foreach(UTIL IN LISTS TINYALSA_UTILS)
target_compile_options("${UTIL}" PRIVATE "${FLAG}")
endforeach()
endif()
endforeach()

# Install
include(GNUInstallDirs)
install(TARGETS "tinyalsa" ${TINYALSA_UTILS}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/tinyalsa)
1 change: 1 addition & 0 deletions subprojects/tinyalsa/LICENSE
3 changes: 3 additions & 0 deletions subprojects/tinyalsa/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
third_party {
license_type: NOTICE
}
Empty file.
Loading

0 comments on commit 6572307

Please sign in to comment.