Merge pull request #24 from akx/macos-compat

macOS compatibility (sort of)
This commit is contained in:
Frédéric Mangano-Tarumi 2019-01-26 17:04:29 -05:00 committed by GitHub
commit da8f8a343b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 2 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
.dockerignore
/*.sh
/build
Dockerfile

View File

@ -12,13 +12,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(PkgConfig REQUIRED)
pkg_check_modules(OGG REQUIRED ogg)
add_compile_options(${OGG_CFLAGS})
link_directories(${OGG_LIBRARY_DIRS})
configure_file(src/config.h.in config.h @ONLY)
include_directories(BEFORE src "${CMAKE_BINARY_DIR}")
include_directories(BEFORE src "${CMAKE_BINARY_DIR}" ${OGG_INCLUDE_DIRS})
add_library(
libopustags
OBJECT
STATIC
src/cli.cc
src/ogg.cc
src/opus.cc
@ -26,6 +27,10 @@ add_library(
)
target_link_libraries(libopustags PUBLIC ${OGG_LIBRARIES})
if (APPLE)
target_link_libraries(libopustags PUBLIC iconv)
endif()
add_executable(opustags src/opustags.cc)
target_link_libraries(opustags libopustags)

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# This dockerfile can be used to both build a containerized version of the application
# and to self-test its build.
# * To self-test, simply `docker build -t opustags .`; `make check` is run as the final step anyway.
# * To use the dockerized version, `docker run -it opustags opustags -h` (etc.)
FROM ubuntu:18.04
RUN apt-get update
RUN apt-get install --no-install-recommends -y make cmake g++ libogg-dev pkg-config ffmpeg liblist-moreutils-perl locales
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ADD . /src
WORKDIR /build
RUN env CXX=g++ cmake /src && make && make install
# We need to run tests as a regular user, since on Docker /dev is a writable directory
# for root (it's backed by a tmpfs). This would make the "device as partial file" test fail.
RUN useradd ubuntu
RUN mkdir -p /build && chown -R ubuntu:ubuntu /build /src
USER ubuntu
RUN env CXX=g++ make check

View File

@ -12,6 +12,7 @@
#include <config.h>
#include <opustags.h>
#include <errno.h>
#include <getopt.h>
#include <limits.h>
#include <string.h>

View File

@ -10,6 +10,7 @@
#include <opustags.h>
#include <errno.h>
#include <string.h>
using namespace std::literals::string_literals;

View File

@ -11,7 +11,9 @@
#include <opustags.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
ot::status ot::partial_file::open(const char* destination)
{