Skip to content

Commit

Permalink
Really fix the statx usage by using Qt version 5.9.8.
Browse files Browse the repository at this point in the history
Also, build against Ubuntu 18.04 LTS.
  • Loading branch information
jlesage committed Oct 2, 2019
1 parent b996b4c commit 44e722e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#

# Build MakeMKV.
FROM ubuntu:cosmic
FROM ubuntu:bionic
COPY makemkv-builder /tmp/makemkv-builder
RUN /tmp/makemkv-builder/builder/build.sh /tmp/

Expand Down
86 changes: 80 additions & 6 deletions makemkv-builder/builder/build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#!/bin/bash
#
# NOTE: The latest Qt version from the 5.9 branch is used. Recent Qt versions
# are using the `statx` system call, which is not whitelisted by default
# on Docker versions < 8.6.
#

set -e
set -o pipefail

export DEBIAN_FRONTEND=noninteractive

SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(realpath "$(dirname "${BASH_SOURCE[0]}")")"

MAKEMKV_VERSION=1.14.5
FFMPEG_VERSION=4.1
FDK_AAC_VERSION=2.0.0
QT_VERSION=5.9.8

MAKEMKV_OSS_URL=https://www.makemkv.com/download/makemkv-oss-${MAKEMKV_VERSION}.tar.gz
MAKEMKV_BIN_URL=https://www.makemkv.com/download/makemkv-bin-${MAKEMKV_VERSION}.tar.gz
FFMPEG_URL=https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.xz
FDK_AAC_URL=https://github.com/mstorsjo/fdk-aac/archive/v${FDK_AAC_VERSION}.tar.gz
QT_URL=http://download.qt.io/official_releases/qt/5.9/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz

usage() {
echo "usage: $(basename $0) OUTPUT_DIR [ROOT_EXEC_DIR]
Expand Down Expand Up @@ -51,6 +58,8 @@ mkdir -p "$INSTALL_DIR"
echo "Updating APT cache..."
apt-get update

# NOTE: zlib is needed by Qt and MakeMKV.
# NOTE: xkb-data is needed for Qt to detect the correct XKB config path.
echo "Installing build prerequisites..."
apt-get install -y --no-install-recommends \
curl \
Expand All @@ -60,11 +69,16 @@ apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
dh-autoreconf \
python \
libc6-dev \
libssl-dev \
libexpat1-dev \
zlib1g-dev \
qtbase5-dev
libdrm-dev \
libxcb1-dev \
libx11-dev \
libx11-xcb-dev \
xkb-data

#
# fdk-aac
Expand Down Expand Up @@ -100,6 +114,66 @@ PKG_CONFIG_PATH="$BUILD_DIR/fdk-aac/lib/pkgconfig" ./configure \
--disable-programs
make -j$(nproc) install

#
# Qt
#
# NOTE: fontconfig is disabled to avoid potential config files
# incompatibilities. The version used by the builder may differ from the
# one used at runtime.
#
cd "$BUILD_DIR"
echo "Downloading qt..."
mkdir qt-src
curl -# -L ${QT_URL} | tar -xJ --strip 1 -C qt-src
echo "Compiling qt..."
cd qt-src
# Create the configure options file.
echo "\
-opensource
-confirm-license
-prefix
$BUILD_DIR/qt
-sysconfdir
/etc/xdg
-release
-strip
-ltcg
-no-pch
-nomake
tools
-nomake
tests
-nomake
examples
-sql-sqlite
-no-sql-odbc
-system-zlib
-qt-freetype
-qt-pcre
-qt-libpng
-qt-libjpeg
-qt-xcb
-qt-xkbcommon-x11
-qt-harfbuzz
-qt-sqlite
-no-fontconfig
-no-compile-examples
-no-cups
-no-iconv
-no-opengl
-no-qml-debug
-no-feature-xml
-no-feature-testlib
-no-openssl
" > config.opt
# Skip all modules (except qtbase).
find . -maxdepth 1 -type d -printf "%f\n" | grep qt | grep -v qtbase | xargs -n1 printf "-skip\n%s\n" >> config.opt
# Run configure with new options.
./configure -redo
# Compile.
make -j$(nproc)
make -j$(nproc) install

#
# MakeMKV OSS
#
Expand All @@ -109,7 +183,7 @@ curl -# -L ${MAKEMKV_OSS_URL} | tar -xz
echo "Compiling MakeMKV OSS..."
cd makemkv-oss-${MAKEMKV_VERSION}
patch -p0 < "$SCRIPT_DIR/launch-url.patch"
DESTDIR="$INSTALL_DIR" PKG_CONFIG_PATH="$BUILD_DIR/ffmpeg/lib/pkgconfig" ./configure --prefix=
DESTDIR="$INSTALL_DIR" PKG_CONFIG_PATH="$BUILD_DIR/ffmpeg/lib/pkgconfig:$BUILD_DIR/qt/lib/pkgconfig" ./configure --prefix=
make -j$(nproc) install

#
Expand All @@ -135,7 +209,7 @@ cp -v "$BUILD_DIR"/umask_wrapper.so "$INSTALL_DIR/lib/"
# QT Plugins
#
echo "Adding QT platform plugins..."
QT_PLUGINS="/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so"
QT_PLUGINS="$BUILD_DIR/qt/plugins/platforms/libqxcb.so"
mkdir "$INSTALL_DIR/lib/platforms"
for lib in $QT_PLUGINS
do
Expand All @@ -159,7 +233,7 @@ EXTRA_LIBS="/lib/x86_64-linux-gnu/libnss_compat.so.2 \
echo "Extracting shared library dependencies..."
find "$INSTALL_DIR" -type f -executable -or -name 'lib*.so*' | while read BIN
do
RAW_DEPS="$(LD_LIBRARY_PATH="$INSTALL_DIR/lib:$BUILD_DIR/jdk/lib:$BUILD_DIR/jdk/lib/jli" ldd "$BIN")"
RAW_DEPS="$(LD_LIBRARY_PATH="$INSTALL_DIR/lib:$BUILD_DIR/jdk/lib/jli:$BUILD_DIR/qt/lib" ldd "$BIN")"
echo "Dependencies for $BIN:"
echo "================================"
echo "$RAW_DEPS"
Expand All @@ -170,7 +244,7 @@ do
exit 1
fi

DEPS="$(LD_LIBRARY_PATH="$INSTALL_DIR/lib" ldd "$BIN" | (grep " => " || true) | cut -d'>' -f2 | sed 's/^[[:space:]]*//' | cut -d'(' -f1)"
DEPS="$(LD_LIBRARY_PATH="$INSTALL_DIR/lib:$BUILD_DIR/qt/lib" ldd "$BIN" | (grep " => " || true) | cut -d'>' -f2 | sed 's/^[[:space:]]*//' | cut -d'(' -f1)"
for dep in $DEPS $EXTRA_LIBS
do
dep_real="$(realpath "$dep")"
Expand Down
2 changes: 1 addition & 1 deletion makemkv-builder/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
SCRIPT_DIR="$(readlink -f "$(dirname "$0")")"
BUILDER_DOCKER_IMAGE="ubuntu:cosmic"
BUILDER_DOCKER_IMAGE="ubuntu:bionic"

exec docker run --rm \
-v "$SCRIPT_DIR:/output" \
Expand Down
1 change: 1 addition & 0 deletions rootfs/opt/makemkv/lib/fonts

0 comments on commit 44e722e

Please sign in to comment.