Skip to content

Commit

Permalink
media-video/makemkv: Fix building against Qt 5.7, closes bug #599228
Browse files Browse the repository at this point in the history
The -std=c++11 flag is needed for building against Qt 5.7. Trouble is
that upstream builds with CC rather than CXX. This only exhibits a
warning but if you try to force CXX, it fails to build the C parts,
which probably explains why upstream did this in the first place. I
thought -x none might work but it breaks unless you put it before
every C file. Possibly a GCC bug? Ideally upstream would just use
automake and avoid this whole mess. The easiest way out is to only
apply CXX and -std=c++11 to the makemkv binary, which doesn't have any
C sources.

The new patch also respects LDFLAGS. CFLAGS (not CXXFLAGS) is already
respected by upstream now so src_compile is no longer needed.

Some of the src_install stuff has also been dropped in favour of
default as we now want upstream behaviour.

Package-Manager: portage-2.3.3
  • Loading branch information
chewi committed Dec 17, 2016
1 parent ceba01e commit 2d2e270
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 20 deletions.
51 changes: 51 additions & 0 deletions media-video/makemkv/files/makemkv-flags.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff -Naur a/Makefile.in b/Makefile.in
--- a/Makefile.in 2016-12-11 16:14:27.000000000 +0000
+++ b/Makefile.in 2016-12-17 23:13:03.227251463 +0000
@@ -2,9 +2,11 @@
include makefile.common

GCC=@CC@
+GXX=@CXX@
MOC=@QT_MOC@

CFLAGS=@CFLAGS_OPT@ -D_linux_ -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
+LDFLAGS=@LDFLAGS@
DESTDIR=@DESTDIR@
PREFIX=@prefix@
ENABLE_GUI=@ENABLE_GUI@
@@ -51,13 +53,13 @@

out/libdriveio.so.0.full:
mkdir -p out
- $(GCC) $(CFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(LIBDRIVEIO_INC) $(LIBDRIVEIO_SRC) \
+ $(GCC) $(CFLAGS) $(LDFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(LIBDRIVEIO_INC) $(LIBDRIVEIO_SRC) \
-fPIC -Xlinker -dy -Xlinker --version-script=libdriveio/src/libdriveio.vers \
-Xlinker -soname=libdriveio.so.0 -lc -lstdc++

out/libmakemkv.so.1.full: tmp/gen_buildinfo.h
mkdir -p out
- $(GCC) $(CFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(LIBEBML_INC) $(LIBEBML_DEF) $(LIBMATROSKA_INC) \
+ $(GCC) $(CFLAGS) $(LDFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(LIBEBML_INC) $(LIBEBML_DEF) $(LIBMATROSKA_INC) \
$(LIBMAKEMKV_INC) $(SSTRING_INC) $(MAKEMKVGUI_INC) $(LIBABI_INC) $(LIBFFABI_INC) $(LIBDCADEC_DEF) \
$(LIBEBML_SRC) $(LIBMATROSKA_SRC) $(LIBMAKEMKV_SRC) $(GLIBC_SRC) $(SSTRING_SRC) \
$(LIBABI_SRC) $(LIBABI_SRC_LINUX) $(LIBFFABI_SRC) $(LIBDCADEC_SRC) \
@@ -67,16 +69,16 @@

out/libmmbd.so.0.full:
mkdir -p out
- $(GCC) $(CFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(MAKEMKVGUI_INC) $(LIBMMBD_INC) \
+ $(GCC) $(CFLAGS) $(LDFLAGS) -D_REENTRANT -shared -Wl,-z,defs -o$@ $(MAKEMKVGUI_INC) $(LIBMMBD_INC) \
$(LIBMAKEMKV_INC) $(SSTRING_INC) $(LIBABI_INC) $(LIBMMBD_SRC) $(LIBMMBD_SRC_LINUX) $(SSTRING_SRC) \
-fPIC -Xlinker -dy -Xlinker --version-script=libmmbd/src/libmmbd.vers \
-Xlinker -soname=libmmbd.so.0 -lc -lstdc++ -lrt -lpthread -lcrypto

out/makemkv.full: $(MAKEMKVGUI_GEN) $(MAKEMKVGUI_SRC_LINUX) tmp/gen_buildinfo.h
mkdir -p out
- $(GCC) $(CFLAGS) -o$@ $(MAKEMKVGUI_INC) $(LIBMAKEMKV_INC) $(SSTRING_INC) $(LIBDRIVEIO_INC) $(LIBABI_INC) \
+ $(GXX) $(CFLAGS) $(LDFLAGS) -o$@ $(MAKEMKVGUI_INC) $(LIBMAKEMKV_INC) $(SSTRING_INC) $(LIBDRIVEIO_INC) $(LIBABI_INC) \
$(MAKEMKVGUI_SRC) $(MAKEMKVGUI_SRC_LINUX) $(MAKEMKVGUI_GEN) $(SSTRING_SRC) $(LIBDRIVEIO_SRC_PUB) \
- -DHAVE_BUILDINFO_H -Itmp \
+ -std=c++11 -DHAVE_BUILDINFO_H -Itmp \
@QT_INC@ -lc -lstdc++ \
@QT_LIB@ -lpthread -lz -lrt

24 changes: 4 additions & 20 deletions media-video/makemkv/makemkv-1.10.3.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RDEPEND="${DEPEND}
S="${WORKDIR}/makemkv-oss-${PV}"

src_prepare() {
PATCHES+=( "${FILESDIR}"/${PN}-{makefile,path,sysmacros}.patch )
PATCHES+=( "${FILESDIR}"/${PN}-{makefile,path,sysmacros,flags}.patch )

# Qt5 always trumps Qt4 if it is available. There are no configure
# options or variables to control this and there is no publicly
Expand Down Expand Up @@ -75,33 +75,17 @@ src_configure() {
econf "${econf_args[@]}"
}

src_compile() {
emake GCC="$(tc-getCC) ${CFLAGS} ${LDFLAGS}"
}

src_install() {
# install oss package
dolib.so out/libdriveio.so.0
dolib.so out/libmakemkv.so.1
dolib.so out/libmmbd.so.0
default

# add missing symlinks for QA
dosym libdriveio.so.0 /usr/$(get_libdir)/libdriveio.so.0.${PV}
dosym libdriveio.so.0 /usr/$(get_libdir)/libdriveio.so
dosym libmakemkv.so.1 /usr/$(get_libdir)/libmakemkv.so.1.${PV}
dosym libmakemkv.so.1 /usr/$(get_libdir)/libmakemkv.so
dosym libmmbd.so.0 /usr/$(get_libdir)/libmmbd.so
dosym libmmbd.so.0 /usr/$(get_libdir)/libmmbd.so.0.${PV}

if use qt5 || use qt4; then
dobin out/makemkv

local res
for res in 16 22 32 64 128; do
newicon -s ${res} makemkvgui/share/icons/${res}x${res}/makemkv.png ${PN}.png
done

make_desktop_entry ${PN} MakeMKV ${PN} 'Qt;AudioVideo;Video'
fi

cd "${WORKDIR}"/${MY_PB} || die

# install prebuilt bins
Expand Down

0 comments on commit 2d2e270

Please sign in to comment.