mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-02-26 08:22:31 +00:00
all: remove --check-for-updates command line option & dependency on CURL
This commit is contained in:
parent
05868d7882
commit
d7b691b6f5
@ -89,7 +89,7 @@ one, and increase `JOBS` if you have more than one core):
|
||||
cd $HOME/mxe
|
||||
make MXE_TARGETS=x86_64-w64-mingw32.static MXE_PLUGIN_DIRS=plugins/gcc6 \
|
||||
JOBS=2 \
|
||||
gettext libiconv zlib boost curl file flac lzo ogg pthreads vorbis \
|
||||
gettext libiconv zlib boost file flac lzo ogg pthreads vorbis \
|
||||
qtbase qttranslations qtwinextras
|
||||
|
||||
Append the installation directory to your `PATH` variable:
|
||||
|
@ -121,8 +121,6 @@ built. These include:
|
||||
- [libMagic](http://www.darwinsys.com/file/) from the "file" package
|
||||
for automatic content type detection
|
||||
|
||||
- [libcurl](http://curl.haxx.se/) for online update checks
|
||||
|
||||
## 2.3. Building libEBML and libMatroska
|
||||
|
||||
This is optional as MKVToolNix comes with its own set of the
|
||||
|
3
Rakefile
3
Rakefile
@ -128,7 +128,7 @@ def setup_globals
|
||||
|
||||
cxxflags = "#{cflags_common} #{c(:STD_CXX)}"
|
||||
cxxflags += " -Wnon-virtual-dtor -Woverloaded-virtual -Wextra -Wno-missing-field-initializers #{c(:WNO_MAYBE_UNINITIALIZED)}"
|
||||
cxxflags += " #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)} #{c(:CURL_CFLAGS)} #{c(:USER_CXXFLAGS)}"
|
||||
cxxflags += " #{c(:QT_CFLAGS)} #{c(:BOOST_CPPFLAGS)}"
|
||||
|
||||
ldflags = ""
|
||||
ldflags += " -Llib/libebml/src -Llib/libmatroska/src" if c?(:EBML_MATROSKA_INTERNAL)
|
||||
@ -866,7 +866,6 @@ $common_libs = [
|
||||
:pugixml,
|
||||
:intl,
|
||||
:iconv,
|
||||
:curl,
|
||||
:boost_regex,
|
||||
:boost_filesystem,
|
||||
:boost_system,
|
||||
|
32
ac/curl.m4
32
ac/curl.m4
@ -1,32 +0,0 @@
|
||||
dnl
|
||||
dnl Check for libcurl
|
||||
dnl
|
||||
|
||||
curl_found=no
|
||||
AC_ARG_WITH([curl], AC_HELP_STRING([--without-curl], [do not build with CURL support]),
|
||||
[ with_curl=${withval} ], [ with_curl=yes ])
|
||||
AC_ARG_WITH(curl_config,
|
||||
AC_HELP_STRING([--with-curl-config=prog],[use prog instead of looking for curl-config]),
|
||||
[ CURL_CONFIG="$with_curl_config" ],)
|
||||
|
||||
if test "x$with_curl" != "xno"; then
|
||||
AC_PATH_TOOL(CURL_CONFIG, curl-config, no)
|
||||
|
||||
if test x"$CURL_CONFIG" != "xno" ; then
|
||||
curl_found=yes
|
||||
CURL_CFLAGS="`"$CURL_CONFIG" --cflags`"
|
||||
CURL_LIBS="`"$CURL_CONFIG" --libs`"
|
||||
|
||||
else
|
||||
PKG_CHECK_MODULES([CURL], [libcurl], [curl_found=yes])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$curl_found" = "yes"; then
|
||||
opt_features_yes="$opt_features_yes\n * online update checks (via libcurl)"
|
||||
AC_DEFINE(HAVE_CURL_EASY_H, 1, [define if libcurl is found via pkg-config])
|
||||
else
|
||||
opt_features_no="$opt_features_no\n * online update checks (via libcurl)"
|
||||
CURL_CFLAGS=""
|
||||
CURL_LIBS=""
|
||||
fi
|
@ -75,8 +75,6 @@ BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
|
||||
BOOST_LDFLAGS = @BOOST_LDFLAGS@
|
||||
BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
|
||||
BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
|
||||
CURL_CFLAGS = @CURL_CFLAGS@
|
||||
CURL_LIBS = @CURL_LIBS@
|
||||
DEBUG_CFLAGS = @DEBUG_CFLAGS@
|
||||
DOCBOOK_MANPAGES_STYLESHEET = @DOCBOOK_MANPAGES_STYLESHEET@
|
||||
DOCBOOK_ROOT = @DOCBOOK_ROOT@
|
||||
|
@ -34,7 +34,6 @@ m4_include(ac/zlib.m4)
|
||||
m4_include(ac/qt5.m4)
|
||||
m4_include(ac/gnurx.m4)
|
||||
m4_include(ac/magic.m4)
|
||||
m4_include(ac/curl.m4)
|
||||
m4_include(ac/ax_boost_base.m4)
|
||||
m4_include(ac/ax_boost_check_headers.m4)
|
||||
m4_include(ac/ax_boost_filesystem.m4)
|
||||
|
@ -9,7 +9,6 @@ Build-Depends:
|
||||
ruby (>= 1.9) | ruby1.9 | ruby1.9.1 | ruby1.9.3,
|
||||
libbz2-dev, liblzo2-dev, zlib1g-dev, libmagic-dev,
|
||||
libflac-dev, libogg-dev, libvorbis-dev,
|
||||
libcurl4-gnutls-dev | libcurl4-openssl-dev,
|
||||
libboost-dev (>= 1.46), libboost-filesystem-dev (>= 1.46),
|
||||
libboost-regex-dev (>= 1.46), libboost-date-time-dev (>= 1.46),
|
||||
libboost-system-dev (>= 1.46), qtbase5-dev, qtbase5-dev-tools,
|
||||
|
@ -9,7 +9,7 @@ Release: 1
|
||||
Summary: Tools to create, alter and inspect Matroska files
|
||||
Source: %{name}-%{version}.tar.xz
|
||||
|
||||
BuildRequires: fdupes, file-devel, flac, flac-devel, libcurl-devel, libogg-devel, libstdc++-devel, libvorbis-devel, make, pkgconfig, zlib-devel
|
||||
BuildRequires: fdupes, file-devel, flac, flac-devel, libogg-devel, libstdc++-devel, libvorbis-devel, make, pkgconfig, zlib-devel
|
||||
|
||||
%if 0%{?centos} && 0%{?centos} < 7
|
||||
BuildRequires: devtoolset-1.1-gcc-c++ >= 4.6.3
|
||||
|
@ -124,7 +124,6 @@ class Target
|
||||
@libraries += list.collect do |entry|
|
||||
case entry
|
||||
when nil then nil
|
||||
when :curl then c(:CURL_LIBS)
|
||||
when :magic then c(:MAGIC_LIBS)
|
||||
when :flac then c(:FLAC_LIBS)
|
||||
when :iconv then c(:ICONV_LIBS)
|
||||
|
@ -183,9 +183,6 @@ cli_parser_c::add_common_options() {
|
||||
OPT("@option-file.json", YT("Reads additional command line options from the specified JSON file (see man page)."));
|
||||
OPT("h|help", YT("Show this help."));
|
||||
OPT("V|version", YT("Show version information."));
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
OPT("check-for-updates", YT("Check online for the latest release."));
|
||||
#endif // defined(HAVE_CURL_EASY_H)
|
||||
}
|
||||
|
||||
#undef OPT
|
||||
|
@ -344,26 +344,6 @@ handle_common_cli_args(std::vector<std::string> &args,
|
||||
} else if ((args[i] == "-h") || (args[i] == "-?") || (args[i] == "--help"))
|
||||
usage();
|
||||
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
else if (args[i] == "--check-for-updates") {
|
||||
mtx_release_version_t rel = get_latest_release_version();
|
||||
if (!rel.latest_source.valid)
|
||||
mxerror(boost::format(Y("The update information could not be retrieved from %1%.\n")) % MTX_VERSION_CHECK_URL);
|
||||
|
||||
std::vector<std::string> keys;
|
||||
brng::push_back(keys, rel.urls | badap::map_keys | badap::filtered(+[](std::string const &key) { return key != "general"; }));
|
||||
brng::sort(keys);
|
||||
|
||||
std::string urls;
|
||||
for (auto &key : keys)
|
||||
urls += key + "_download_url=" + rel.urls[key] + "\n";
|
||||
|
||||
mxinfo(boost::format("version_check_url=%1%\nrunning_version=%2%\navailable_version=%3%\ndownload_url=%4%\n%5%")
|
||||
% MTX_VERSION_CHECK_URL % rel.current_version.to_string() % rel.latest_source.to_string() % rel.urls["general"] % urls);
|
||||
mxexit(rel.current_version < rel.latest_source ? 1 : 0);
|
||||
}
|
||||
#endif // defined(HAVE_CURL_EASY_H)
|
||||
|
||||
else
|
||||
++i;
|
||||
}
|
||||
|
@ -1,109 +0,0 @@
|
||||
/*
|
||||
mkvmerge -- utility for splicing together matroska files
|
||||
from component media subtypes
|
||||
|
||||
Distributed under the GPL v2
|
||||
see the file COPYING for details
|
||||
or visit http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
even easier interface to CURL
|
||||
|
||||
Written by Moritz Bunkus <moritz@bunkus.org>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
|
||||
# include "common/common_pch.h"
|
||||
|
||||
# include "common/curl.h"
|
||||
# include "common/strings/parsing.h"
|
||||
|
||||
# include <curl/easy.h>
|
||||
|
||||
static size_t
|
||||
curl_write_data_cb(void *buffer,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void *user_data) {
|
||||
static_cast<url_retriever_c *>(user_data)->add_data(std::string(static_cast<char *>(buffer), size * nmemb));
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
static size_t
|
||||
curl_header_cb(void *buffer,
|
||||
size_t size,
|
||||
size_t nmemb,
|
||||
void *user_data) {
|
||||
static_cast<url_retriever_c *>(user_data)->parse_header(std::string(static_cast<char *>(buffer), size * nmemb));
|
||||
return size * nmemb;
|
||||
}
|
||||
|
||||
url_retriever_c::url_retriever_c()
|
||||
: m_connect_timeout(10)
|
||||
, m_download_timeout(0)
|
||||
, m_total_size(-1)
|
||||
, m_debug{"curl|url_retriever"}
|
||||
{
|
||||
}
|
||||
|
||||
url_retriever_c &
|
||||
url_retriever_c::set_timeout(int connect_timeout,
|
||||
int download_timeout) {
|
||||
m_connect_timeout = connect_timeout;
|
||||
m_download_timeout = download_timeout;
|
||||
return *this;
|
||||
}
|
||||
|
||||
url_retriever_c &
|
||||
url_retriever_c::set_progress_cb(progress_cb_t const &progress_cb) {
|
||||
m_progress_cb = progress_cb;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CURLcode
|
||||
url_retriever_c::retrieve(std::string const &url,
|
||||
std::string &data) {
|
||||
m_data = &data;
|
||||
m_total_size = -1;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
CURL *handle = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(handle, CURLOPT_VERBOSE, 0);
|
||||
curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 1);
|
||||
curl_easy_setopt(handle, CURLOPT_TIMEOUT, m_download_timeout);
|
||||
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, m_connect_timeout);
|
||||
curl_easy_setopt(handle, CURLOPT_URL, url.c_str());
|
||||
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, curl_write_data_cb);
|
||||
curl_easy_setopt(handle, CURLOPT_WRITEDATA, this);
|
||||
curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, curl_header_cb);
|
||||
curl_easy_setopt(handle, CURLOPT_HEADERDATA, this);
|
||||
|
||||
CURLcode result = curl_easy_perform(handle);
|
||||
|
||||
curl_easy_cleanup(handle);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
url_retriever_c::add_data(std::string const &data) {
|
||||
*m_data += data;
|
||||
|
||||
mxdebug_if(m_debug, boost::format("Data received: %1% bytes, now %2% total\n") % data.size() % m_data->size());
|
||||
|
||||
if (m_progress_cb)
|
||||
m_progress_cb(m_data->size(), m_total_size);
|
||||
}
|
||||
|
||||
void
|
||||
url_retriever_c::parse_header(std::string const &header) {
|
||||
boost::smatch matches;
|
||||
if (boost::regex_search(header, matches, boost::regex("^content-length\\s*:\\s*(\\d+)", boost::regex::perl | boost::regex::icase)))
|
||||
parse_number(matches[1].str(), m_total_size);
|
||||
mxdebug_if(m_debug, boost::format("Header received: %1% total size: %2%\n") % header % m_total_size);
|
||||
}
|
||||
|
||||
#endif // defined(HAVE_CURL_EASY_H)
|
@ -1,52 +0,0 @@
|
||||
/*
|
||||
mkvmerge -- utility for splicing together matroska files
|
||||
from component media subtypes
|
||||
|
||||
Distributed under the GPL v2
|
||||
see the file COPYING for details
|
||||
or visit http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
even easier interface to CURL
|
||||
|
||||
Written by Moritz Bunkus <moritz@bunkus.org>.
|
||||
*/
|
||||
|
||||
#ifndef MTX_COMMON_CURL_H
|
||||
# define MTX_COMMON_CURL_H
|
||||
|
||||
# include "common/common_pch.h"
|
||||
|
||||
# if defined(HAVE_CURL_EASY_H)
|
||||
|
||||
# if defined(SYS_WINDOWS)
|
||||
# include <ws2tcpip.h>
|
||||
# endif // defined(SYS_WINDOWS)
|
||||
# include <curl/curl.h>
|
||||
# include <string>
|
||||
|
||||
class url_retriever_c {
|
||||
public:
|
||||
using progress_cb_t = std::function<void(int64_t, int64_t)>;
|
||||
|
||||
protected:
|
||||
progress_cb_t m_progress_cb;
|
||||
std::string *m_data;
|
||||
int m_connect_timeout, m_download_timeout;
|
||||
int64_t m_total_size;
|
||||
debugging_option_c m_debug;
|
||||
|
||||
public:
|
||||
url_retriever_c();
|
||||
|
||||
url_retriever_c &set_timeout(int connect_timeout = 10, int download_timeout = 0);
|
||||
url_retriever_c &set_progress_cb(progress_cb_t const &progress_cb);
|
||||
|
||||
CURLcode retrieve(std::string const &url, std::string &data);
|
||||
|
||||
void add_data(std::string const &data);
|
||||
void parse_header(std::string const &header);
|
||||
};
|
||||
|
||||
# endif // defined(HAVE_CURL_EASY_H)
|
||||
|
||||
#endif // MTX_COMMON_CURL_H
|
@ -13,13 +13,6 @@
|
||||
|
||||
#include "common/common_pch.h"
|
||||
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
# include <sstream>
|
||||
|
||||
# include "common/compression.h"
|
||||
# include "common/curl.h"
|
||||
#endif // defined(HAVE_CURL_EASY_H)
|
||||
|
||||
#include "common/debugging.h"
|
||||
#include "common/strings/formatting.h"
|
||||
#include "common/strings/parsing.h"
|
||||
@ -173,7 +166,7 @@ parse_latest_release_version(mtx::xml::document_cptr const &doc) {
|
||||
for (auto package : std::vector<std::string>{ "installer", "portable" })
|
||||
release.urls[std::string{"windows_"} + arch + "_" + package] = doc->select_single_node((std::string{"/mkvtoolnix-releases/latest-windows-binary/"} + package + "-url/" + arch).c_str()).node().child_value();
|
||||
|
||||
if (debugging_c::requested("version_check|curl")) {
|
||||
if (debugging_c::requested("version_check")) {
|
||||
std::stringstream urls;
|
||||
brng::for_each(release.urls, [&urls](auto const &kv) { urls << " " << kv.first << ":" << kv.second; });
|
||||
mxdebug(boost::format("update check: current %1% latest source %2% latest winpre %3% URLs%4%\n")
|
||||
@ -182,63 +175,3 @@ parse_latest_release_version(mtx::xml::document_cptr const &doc) {
|
||||
|
||||
return release;
|
||||
}
|
||||
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
static mtx::xml::document_cptr
|
||||
retrieve_and_parse_xml(std::string const &url) {
|
||||
bool debug = debugging_c::requested("version_check|releases_info|curl");
|
||||
|
||||
std::string data;
|
||||
auto result = url_retriever_c().set_timeout(10, 20).retrieve(url, data);
|
||||
|
||||
if (0 != result) {
|
||||
mxdebug_if(debug, boost::format("CURL error for %2%: %1%\n") % static_cast<unsigned int>(result) % url);
|
||||
return mtx::xml::document_cptr();
|
||||
}
|
||||
|
||||
try {
|
||||
data = compressor_c::create_from_file_name(url)->decompress(data);
|
||||
|
||||
mtx::xml::document_cptr doc(new pugi::xml_document);
|
||||
std::stringstream sdata(data);
|
||||
auto xml_result = doc->load(sdata);
|
||||
|
||||
if (xml_result) {
|
||||
mxdebug_if(debug, boost::format("Doc loaded fine from %1%\n") % url);
|
||||
return doc;
|
||||
|
||||
} else
|
||||
mxdebug_if(debug, boost::format("Doc load error for %1%: %1% at %2%\n") % url % xml_result.description() % xml_result.offset);
|
||||
|
||||
} catch (mtx::compression_x &ex) {
|
||||
mxdebug_if(debug, boost::format("Decompression exception for %2%: %1%\n") % ex.what() % url);
|
||||
}
|
||||
|
||||
return mtx::xml::document_cptr();
|
||||
}
|
||||
|
||||
mtx_release_version_t
|
||||
get_latest_release_version() {
|
||||
bool debug = debugging_c::requested("version_check|curl");
|
||||
std::string url = MTX_VERSION_CHECK_URL;
|
||||
debugging_c::requested("version_check_url", &url);
|
||||
|
||||
mxdebug_if(debug, boost::format("Update check started with URL %1%\n") % url);
|
||||
|
||||
auto doc = retrieve_and_parse_xml(url + ".gz");
|
||||
if (!doc)
|
||||
doc = retrieve_and_parse_xml(url);
|
||||
if (!doc)
|
||||
return {};
|
||||
|
||||
return parse_latest_release_version(doc);
|
||||
}
|
||||
|
||||
mtx::xml::document_cptr
|
||||
get_releases_info() {
|
||||
std::string url = MTX_RELEASES_INFO_URL;
|
||||
debugging_c::requested("releases_info_url", &url);
|
||||
|
||||
return retrieve_and_parse_xml(url + ".gz");
|
||||
}
|
||||
#endif // defined(HAVE_CURL_EASY_H)
|
||||
|
@ -59,9 +59,4 @@ int compare_current_version_to(const std::string &other_version_str);
|
||||
version_number_t get_current_version();
|
||||
mtx_release_version_t parse_latest_release_version(mtx::xml::document_cptr const &doc);
|
||||
|
||||
# if defined(HAVE_CURL_EASY_H)
|
||||
mtx_release_version_t get_latest_release_version();
|
||||
mtx::xml::document_cptr get_releases_info();
|
||||
# endif // defined(HAVE_CURL_EASY_H)
|
||||
|
||||
#endif // MTX_COMMON_VERSION_H
|
||||
|
@ -344,9 +344,6 @@ set_usage() {
|
||||
" the specified JSON file (see man page).\n");
|
||||
usage_text += Y(" -h, --help Show this help.\n");
|
||||
usage_text += Y(" -V, --version Show version information.\n");
|
||||
#if defined(HAVE_CURL_EASY_H)
|
||||
usage_text += std::string(" --check-for-updates ") + Y("Check online for the latest release.") + "\n";
|
||||
#endif
|
||||
usage_text += "\n\n";
|
||||
usage_text += Y("Please read the man page/the HTML documentation to mkvmerge. It\n"
|
||||
"explains several details in great length which are not obvious from\n"
|
||||
|
@ -116,15 +116,6 @@ function build_boost {
|
||||
build_tarball command "./b2 ${args} ${properties} install"
|
||||
}
|
||||
|
||||
function build_curl {
|
||||
build_package curl-7.40.0.tar.xz --prefix=${TARGET} \
|
||||
--disable-shared --enable-static \
|
||||
--disable-ldap --disable-ldaps --disable-rtsp \
|
||||
--disable-dict --disable-telnet --disable-gopher \
|
||||
--disable-imap --disable-imaps --disable-pop3 --disable-pop3s \
|
||||
--disable-smb --disable-smbs --disable-smtp --disable-smtps --disable-tftp
|
||||
}
|
||||
|
||||
function build_qtbase {
|
||||
local -a args
|
||||
args=(--prefix=${TARGET} -opensource -confirm-license -release
|
||||
@ -389,7 +380,6 @@ if [[ -z $@ ]]; then
|
||||
build_zlib
|
||||
build_gettext
|
||||
build_boost
|
||||
build_curl
|
||||
build_qtbase
|
||||
build_qttools
|
||||
build_qttranslations
|
||||
|
@ -50,7 +50,7 @@ MXE_TARGETS = ${HOST}
|
||||
MXE_PLUGIN_DIRS += plugins/gcc6
|
||||
JOBS = ${PARALLEL}
|
||||
|
||||
MKVTOOLNIX_DEPENDENCIES=gettext libiconv zlib boost curl file flac lzo ogg pthreads vorbis
|
||||
MKVTOOLNIX_DEPENDENCIES=gettext libiconv zlib boost file flac lzo ogg pthreads vorbis
|
||||
MKVTOOLNIX_DEPENDENCIES+=qtbase qttranslations qtwinextras
|
||||
|
||||
mkvtoolnix-deps: \$(MKVTOOLNIX_DEPENDENCIES)
|
||||
|
Loading…
Reference in New Issue
Block a user