From 4d44550d3dd7074c4fa19bc742cac38124f7a781 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 18 Dec 2018 13:45:14 +0200 Subject: [PATCH 1/4] Add Dockerfile for testing the build --- .dockerignore | 4 ++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5b840e9 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.dockerignore +/*.sh +/build +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab31554 --- /dev/null +++ b/Dockerfile @@ -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 \ No newline at end of file From 48336b536700eea762404c45a72203aa124dedf7 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 18 Dec 2018 13:57:02 +0200 Subject: [PATCH 2/4] Change libopustags to STATIC, not OBJECT: > CMake Error at CMakeLists.txt:27 (target_link_libraries): > Object library target "libopustags" may not link to anything. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0d389b..38cd6fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ include_directories(BEFORE src "${CMAKE_BINARY_DIR}") add_library( libopustags - OBJECT + STATIC src/cli.cc src/ogg.cc src/opus.cc From 40defdf2e1278f93e84eeed6fc207d54a3b78363 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 18 Dec 2018 13:34:49 +0200 Subject: [PATCH 3/4] Add headers required on macOS --- src/cli.cc | 1 + src/ogg.cc | 1 + src/system.cc | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/cli.cc b/src/cli.cc index 2ba1040..a4badb5 100644 --- a/src/cli.cc +++ b/src/cli.cc @@ -12,6 +12,7 @@ #include #include +#include #include #include #include diff --git a/src/ogg.cc b/src/ogg.cc index 281ee8e..84080fa 100644 --- a/src/ogg.cc +++ b/src/ogg.cc @@ -10,6 +10,7 @@ #include +#include #include using namespace std::literals::string_literals; diff --git a/src/system.cc b/src/system.cc index e9d6b01..1f28789 100644 --- a/src/system.cc +++ b/src/system.cc @@ -11,7 +11,9 @@ #include +#include #include +#include ot::status ot::partial_file::open(const char* destination) { From a9dd07ae1efa74ca6b3d9acf3d9a7ea77630eeeb Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 18 Dec 2018 13:35:28 +0200 Subject: [PATCH 4/4] Tweak CMakeLists.txt to build on macOS --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38cd6fc..a53606c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,9 +12,10 @@ 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 @@ -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)