Commit 0fe0425d authored by Max Kellermann's avatar Max Kellermann

disable archive API without plugins

When there are no archive plugins, we do not need the archive API at all. Drop all its overhead.
parent 4c13a276
......@@ -217,6 +217,16 @@ if test x$enable_iso = xyes; then
AC_DEFINE(HAVE_ISO, 1, [Define to have iso archive support])
fi
dnl archive API
if test x$enable_bz2 = xyes || test x$enable_zip = xyes || test x$enable_iso = xyes; then
enable_archive=yes
AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
else
enable_archive=no
fi
AM_CONDITIONAL(ENABLE_ARCHIVE, test x$enable_archive = xyes)
dnl
dnl decoder plugins
......
......@@ -158,10 +158,7 @@ mpd_SOURCES = \
volume.c \
locate.c \
stored_playlist.c \
timer.c \
archive_api.c \
archive_list.c \
input_archive.c
timer.c
if HAVE_LIBSAMPLERATE
mpd_SOURCES += pcm_resample_libsamplerate.c
......@@ -187,6 +184,14 @@ if HAVE_ISO
mpd_SOURCES += archive/iso_plugin.c
endif
if ENABLE_ARCHIVE
mpd_SOURCES += \
archive_api.c \
archive_list.c \
input_archive.c
endif
# decoder plugins
if HAVE_MAD
......
......@@ -20,7 +20,10 @@
#include "config.h"
#include "input_file.h"
#ifdef ENABLE_ARCHIVE
#include "input_archive.h"
#endif
#ifdef HAVE_CURL
#include "input_curl.h"
......@@ -31,7 +34,9 @@
static const struct input_plugin *const input_plugins[] = {
&input_plugin_file,
#ifdef ENABLE_ARCHIVE
&input_plugin_archive,
#endif
#ifdef HAVE_CURL
&input_plugin_curl,
#endif
......
......@@ -84,6 +84,7 @@ hasMusicSuffix(const char *utf8file, unsigned int next)
return ret;
}
#ifdef ENABLE_ARCHIVE
const struct archive_plugin *
get_archive_by_suffix(const char *utf8file)
{
......@@ -98,3 +99,4 @@ get_archive_by_suffix(const char *utf8file)
}
return ret;
}
#endif
......@@ -40,7 +40,6 @@
#include "permission.h"
#include "replay_gain.h"
#include "decoder_list.h"
#include "archive_list.h"
#include "audioOutput.h"
#include "input_stream.h"
#include "state_file.h"
......@@ -52,6 +51,10 @@
#include "main_notify.h"
#include "os_compat.h"
#ifdef ENABLE_ARCHIVE
#include "archive_list.h"
#endif
#include <glib.h>
#ifdef HAVE_LOCALE
......@@ -147,10 +150,12 @@ static void version(void)
"Supported outputs:\n");
printAllOutputPluginTypes(stdout);
#ifdef ENABLE_ARCHIVE
puts("\n"
"Supported archives:\n");
archive_plugin_init_all();
archive_plugin_print_all_suffixes(stdout);
#endif
}
static void parseOptions(int argc, char **argv, Options * options)
......@@ -421,7 +426,9 @@ int main(int argc, char *argv[])
mapper_init();
initPermissions();
initPlaylist();
#ifdef ENABLE_ARCHIVE
archive_plugin_init_all();
#endif
decoder_plugin_init_all();
update_global_init();
......@@ -507,7 +514,9 @@ int main(int argc, char *argv[])
command_finish();
update_global_finish();
decoder_plugin_deinit_all();
#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all();
#endif
music_pipe_free();
cleanUpPidFile();
finishConf();
......
......@@ -276,6 +276,7 @@ make_subdir(struct directory *parent, const char *name)
return directory;
}
#ifdef ENABLE_ARCHIVE
static void
update_archive_tree(struct directory *directory, char *name)
{
......@@ -308,6 +309,7 @@ update_archive_tree(struct directory *directory, char *name)
}
}
}
#endif
static bool
updateDirectory(struct directory *directory, const struct stat *st);
......@@ -316,7 +318,10 @@ static void
updateInDirectory(struct directory *directory,
const char *name, const struct stat *st)
{
#ifdef ENABLE_ARCHIVE
const struct archive_plugin *archive;
#endif
assert(strchr(name, '/') == NULL);
if (S_ISREG(st->st_mode) && hasMusicSuffix(name, 0)) {
......@@ -351,6 +356,7 @@ updateInDirectory(struct directory *directory,
ret = updateDirectory(subdir, st);
if (!ret)
delete_directory(subdir);
#ifdef ENABLE_ARCHIVE
} else if (S_ISREG(st->st_mode) && (archive = get_archive_by_suffix(name))) {
struct archive_file *archfile;
char pathname[MPD_PATH_MAX];
......@@ -380,6 +386,7 @@ updateInDirectory(struct directory *directory,
} else {
g_warning("unable to open archive %s\n", pathname);
}
#endif
} else {
g_debug("update: %s is not a directory, archive or music\n", name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment