From f700dfbd1e9c9cfe74c19b2954821ef32142d90b Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 1 Jan 2018 14:31:36 +0100 Subject: [PATCH] build system: require cmark when building the GUIs --- NEWS.md | 5 ++++ README.md | 4 ++++ Rakefile | 8 ++++++- ac/cmark.m4 | 25 ++++++++++++++++++++ build-config.in | 2 ++ configure.ac | 1 + debian-upstream/control | 2 +- mkvtoolnix.spec | 2 +- tools/windows/setup_cross_compilation_env.sh | 2 +- 9 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 ac/cmark.m4 diff --git a/NEWS.md b/NEWS.md index 3efc5def2..0204b1bd4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -69,6 +69,11 @@ identifying MPLS files that refer to very short M2TS files caused mkvmerge to segfault. +## Build system changes + +* [cmark](https://github.com/commonmark/cmark), the CommonMark parsing and + rendering library in C, is now required when building the GUIs. + # Version 19.0.0 "Brave Captain" 2017-12-17 diff --git a/README.md b/README.md index f94a681d1..f918a346c 100644 --- a/README.md +++ b/README.md @@ -111,6 +111,10 @@ built. These include: toolkit. You need this if you want to use the MKVToolNix GUI or mkvinfo's GUI. +- [cmark](https://github.com/commonmark/cmark) — the CommonMark + parsing and rendering library in C is required when building the Qt + GUIs. + - [libFLAC](http://downloads.xiph.org/releases/flac/) for FLAC support (Free Lossless Audio Codec) diff --git a/Rakefile b/Rakefile index 1577272f2..b5507323e 100644 --- a/Rakefile +++ b/Rakefile @@ -125,7 +125,7 @@ def setup_globals cflags_common += " -fsanitize=undefined" if c?(:UBSAN) cflags_common += " -fsanitize=address -fno-omit-frame-pointer" if c?(:ADDRSAN) cflags_common += " -Ilib/libebml -Ilib/libmatroska" if c?(:EBML_MATROSKA_INTERNAL) - cflags_common += " #{c(:MATROSKA_CFLAGS)} #{c(:EBML_CFLAGS)} #{c(:PUGIXML_CFLAGS)} #{c(:EXTRA_CFLAGS)} #{c(:DEBUG_CFLAGS)} #{c(:PROFILING_CFLAGS)} #{c(:USER_CPPFLAGS)}" + cflags_common += " #{c(:MATROSKA_CFLAGS)} #{c(:EBML_CFLAGS)} #{c(:PUGIXML_CFLAGS)} #{c(:CMARK_CFLAGS)} #{c(:EXTRA_CFLAGS)} #{c(:DEBUG_CFLAGS)} #{c(:PROFILING_CFLAGS)} #{c(:USER_CPPFLAGS)}" cflags_common += " -mno-ms-bitfields -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 " if $building_for[:windows] # 0x0601 = Windows 7/Server 2008 R2 cflags_common += " -march=i686" if $building_for[:windows] && /i686/.match(c(:host)) cflags_common += " -fPIC " if c?(:USE_QT) && !$building_for[:windows] @@ -968,6 +968,12 @@ $common_libs = [ :boost_system, ] +if c?(:USE_QT) + $common_libs += [ + :cmark, + ] +end + # custom libraries $custom_libs = [ :static, diff --git a/ac/cmark.m4 b/ac/cmark.m4 new file mode 100644 index 000000000..0a6db3d81 --- /dev/null +++ b/ac/cmark.m4 @@ -0,0 +1,25 @@ +dnl +dnl Check for cmark +dnl + +if test x"$have_qt" = "xyes" ; then + PKG_CHECK_EXISTS([libcmark],[cmark_found=yes],[cmark_found=no]) + if test x"$cmark_found" = xyes; then + PKG_CHECK_MODULES([libcmark],[libcmark],[cmark_found=yes]) + CMARK_CFLAGS="`pkg-config --cflags libcmark`" + CMARK_LIBS="`pkg-config --libs libcmark`" + fi + + if test x"$cmark_found" != xyes; then + AC_MSG_ERROR([Could not find the cmark library]) + fi + + AC_DEFINE(HAVE_CMARK,,[define if building with cmark]) + +else + CMARK_CFLAGS="" + CMARK_LIBS="" +fi + +AC_SUBST(CMARK_CFLAGS) +AC_SUBST(CMARK_LIBS) diff --git a/build-config.in b/build-config.in index 679d9baf2..ef822f49f 100644 --- a/build-config.in +++ b/build-config.in @@ -76,6 +76,8 @@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@ BOOST_LDFLAGS = @BOOST_LDFLAGS@ BOOST_REGEX_LIB = @BOOST_REGEX_LIB@ BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@ +CMARK_CFLAGS = @CMARK_CFLAGS@ +CMARK_LIBS = @CMARK_LIBS@ COMPILER_TYPE = @COMPILER_TYPE@ COMPILER_VERSION = @COMPILER_VERSION@ DEBUG_CFLAGS = @DEBUG_CFLAGS@ diff --git a/configure.ac b/configure.ac index 45a7f0457..2b7f0e6a0 100644 --- a/configure.ac +++ b/configure.ac @@ -33,6 +33,7 @@ m4_include(ac/nlohmann_jsoncpp.m4) m4_include(ac/utf8cpp.m4) m4_include(ac/zlib.m4) m4_include(ac/qt5.m4) +m4_include(ac/cmark.m4) m4_include(ac/gnurx.m4) m4_include(ac/magic.m4) m4_include(ac/ax_boost_base.m4) diff --git a/debian-upstream/control b/debian-upstream/control index d43d9c646..ea497f779 100644 --- a/debian-upstream/control +++ b/debian-upstream/control @@ -13,7 +13,7 @@ Build-Depends: libboost-regex-dev (>= 1.46), libboost-date-time-dev (>= 1.46), libboost-system-dev (>= 1.46), qtbase5-dev, qtbase5-dev-tools, qtmultimedia5-dev, - base-files (<< 9.6) | nlohmann-json-dev (>= 2), + base-files (<< 9.6) | nlohmann-json-dev (>= 2), cmark, pkg-config, po4a, docbook-xsl, xsltproc, libgtest-dev diff --git a/mkvtoolnix.spec b/mkvtoolnix.spec index 47e4515d4..9267f22b6 100644 --- a/mkvtoolnix.spec +++ b/mkvtoolnix.spec @@ -10,7 +10,7 @@ Summary: Tools to create, alter and inspect Matroska files Source: %{name}-%{version}.tar.xz Requires: hicolor-icon-theme -BuildRequires: desktop-file-utils, fdupes, file-devel, flac, flac-devel, glibc-devel, libogg-devel, libstdc++-devel, libvorbis-devel, make, pkgconfig, zlib-devel, boost-devel >= 1.46.0, po4a +BuildRequires: desktop-file-utils, fdupes, file-devel, flac, flac-devel, glibc-devel, libogg-devel, libstdc++-devel, libvorbis-devel, make, pkgconfig, zlib-devel, boost-devel >= 1.46.0, cmark-devel, po4a %if 0%{?centos} BuildRequires: devtoolset-6-gcc-c++, rubygem-drake diff --git a/tools/windows/setup_cross_compilation_env.sh b/tools/windows/setup_cross_compilation_env.sh index df56db1ac..c107fa312 100755 --- a/tools/windows/setup_cross_compilation_env.sh +++ b/tools/windows/setup_cross_compilation_env.sh @@ -50,7 +50,7 @@ MXE_TARGETS = ${HOST} MXE_PLUGIN_DIRS += plugins/gcc6 JOBS = ${PARALLEL} -MKVTOOLNIX_DEPENDENCIES=gettext libiconv zlib boost file flac lzo ogg pthreads vorbis +MKVTOOLNIX_DEPENDENCIES=gettext libiconv zlib boost file flac lzo ogg pthreads vorbis cmark MKVTOOLNIX_DEPENDENCIES+=qtbase qttranslations qtwinextras mkvtoolnix-deps: \$(MKVTOOLNIX_DEPENDENCIES)