Commit e030aefc authored by Jürg Billeter's avatar Jürg Billeter

Move tracker-encoding from libtracker-common to libtracker-extract

Fixes NB#249787.
parent 9a3fc5ba
......@@ -1051,8 +1051,8 @@ if test "x$enable_meegotouch" != "xno"; then
[have_meegotouch=yes],
[have_meegotouch=no])
LIBTRACKER_COMMON_CFLAGS="$LIBTRACKER_COMMON_CFLAGS $MEEGOTOUCH_CFLAGS"
LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS $MEEGOTOUCH_LIBS"
LIBTRACKER_EXTRACT_CFLAGS="$LIBTRACKER_EXTRACT_CFLAGS $MEEGOTOUCH_CFLAGS"
LIBTRACKER_EXTRACT_LIBS="$LIBTRACKER_EXTRACT_LIBS $MEEGOTOUCH_LIBS"
TRACKER_MINER_FS_CFLAGS="$TRACKER_MINER_FS_CFLAGS $MEEGOTOUCH_CFLAGS"
TRACKER_MINER_FS_LIBS="$TRACKER_MINER_FS_LIBS $MEEGOTOUCH_LIBS"
......@@ -1336,8 +1336,8 @@ AC_ARG_WITH(enca,
if test "x$enable_enca" != "xno" ; then
PKG_CHECK_MODULES(ENCA, [enca >= 1.9], have_enca=yes, have_enca=no)
LIBTRACKER_COMMON_CFLAGS="$LIBTRACKER_COMMON_CFLAGS $ENCA_CFLAGS"
LIBTRACKER_COMMON_LIBS="$LIBTRACKER_COMMON_LIBS $ENCA_LIBS"
LIBTRACKER_EXTRACT_CFLAGS="$LIBTRACKER_EXTRACT_CFLAGS $ENCA_CFLAGS"
LIBTRACKER_EXTRACT_LIBS="$LIBTRACKER_EXTRACT_LIBS $ENCA_LIBS"
if test "x$have_enca" = "xyes"; then
AC_DEFINE(HAVE_ENCA, [], [Enca language detection aid])
......
......@@ -28,8 +28,7 @@ libtracker_common_la_SOURCES = \
tracker-type-utils.c \
tracker-utils.c \
tracker-crc32.c \
tracker-locale.c \
tracker-encoding.c
tracker-locale.c
noinst_HEADERS = \
tracker-dbus.h \
......@@ -46,18 +45,7 @@ noinst_HEADERS = \
tracker-type-utils.h \
tracker-utils.h \
tracker-crc32.h \
tracker-locale.h \
tracker-encoding.h
if HAVE_ENCA
libtracker_common_la_SOURCES += tracker-encoding-enca.c
noinst_HEADERS += tracker-encoding-enca.h
endif
if HAVE_MEEGOTOUCH
libtracker_common_la_SOURCES += tracker-encoding-meegotouch.cpp
noinst_HEADERS += tracker-encoding-meegotouch.h
endif
tracker-locale.h
if HAVE_TRACKER_FTS
libtracker_common_la_SOURCES += tracker-language.c
......
......@@ -41,7 +41,6 @@
#include "tracker-type-utils.h"
#include "tracker-utils.h"
#include "tracker-locale.h"
#include "tracker-encoding.h"
#undef __LIBTRACKER_COMMON_INSIDE__
......
......@@ -14,6 +14,7 @@ libtracker_extractincludedir=$(includedir)/tracker-$(TRACKER_API_VERSION)/libtra
libtracker_extract_@TRACKER_API_VERSION@_la_SOURCES = \
tracker-data.h \
tracker-encoding.c \
tracker-exif.c \
tracker-exif.h \
tracker-guarantee.c \
......@@ -30,6 +31,7 @@ noinst_HEADERS =
libtracker_extractinclude_HEADERS = \
tracker-data.h \
tracker-encoding.h \
tracker-exif.h \
tracker-extract.h \
tracker-guarantee.h \
......@@ -38,6 +40,18 @@ libtracker_extractinclude_HEADERS = \
tracker-utils.h \
tracker-xmp.h
if HAVE_ENCA
libtracker_extract_@TRACKER_API_VERSION@_la_SOURCES += \
tracker-encoding-enca.c \
tracker-encoding-enca.h
endif
if HAVE_MEEGOTOUCH
libtracker_extract_@TRACKER_API_VERSION@_la_SOURCES += \
tracker-encoding-meegotouch.cpp \
tracker-encoding-meegotouch.h
endif
libtracker_extract_@TRACKER_API_VERSION@_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-export-symbols-regex '^tracker_.*'
......
......@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __LIBTRACKER_COMMON_ENCODING_ENCA_H__
#define __LIBTRACKER_COMMON_ENCODING_ENCA_H__
#ifndef __LIBTRACKER_EXTRACT_ENCODING_ENCA_H__
#define __LIBTRACKER_EXTRACT_ENCODING_ENCA_H__
#include <glib.h>
......@@ -30,4 +30,4 @@ gchar *tracker_encoding_guess_enca (const gchar *buffer,
G_END_DECLS
#endif /* __LIBTRACKER_COMMON_ENCODING_ENCA_H__ */
#endif /* __LIBTRACKER_EXTRACT_ENCODING_ENCA_H__ */
......@@ -23,8 +23,8 @@
#include <MCharsetMatch>
#include <glib.h>
#include <libtracker-common/tracker-locale.h>
#include "tracker-encoding-meegotouch.h"
#include "tracker-locale.h"
/*
* See http://apidocs.meego.com/git-tip/mtf/class_m_charset_detector.html
......
......@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __LIBTRACKER_COMMON_ENCODING_MEEGOTOUCH_H__
#define __LIBTRACKER_COMMON_ENCODING_MEEGOTOUCH_H__
#ifndef __LIBTRACKER_EXTRACT_ENCODING_MEEGOTOUCH_H__
#define __LIBTRACKER_EXTRACT_ENCODING_MEEGOTOUCH_H__
#include <glib.h>
......@@ -30,4 +30,4 @@ gchar *tracker_encoding_guess_meegotouch (const gchar *buffer,
G_END_DECLS
#endif /* __LIBTRACKER_COMMON_ENCODING_MEEGOTOUCH_H__ */
#endif /* __LIBTRACKER_EXTRACT_ENCODING_MEEGOTOUCH_H__ */
......@@ -17,17 +17,17 @@
* Boston, MA 02110-1301, USA.
*/
#ifndef __LIBTRACKER_COMMON_ENCODING_H__
#define __LIBTRACKER_COMMON_ENCODING_H__
#ifndef __LIBTRACKER_EXTRACT_ENCODING_H__
#define __LIBTRACKER_EXTRACT_ENCODING_H__
#if !defined (__LIBTRACKER_EXTRACT_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "only <libtracker-extract/tracker-extract.h> must be included directly."
#endif
#include <glib.h>
G_BEGIN_DECLS
#if !defined (__LIBTRACKER_COMMON_INSIDE__) && !defined (TRACKER_COMPILATION)
#error "only <libtracker-common/tracker-common.h> must be included directly."
#endif
/* Returns TRUE if there is some method available to guess encodings */
gboolean tracker_encoding_can_guess (void);
......@@ -37,4 +37,4 @@ gchar *tracker_encoding_guess (const gchar *buffer,
G_END_DECLS
#endif /* __LIBTRACKER_COMMON_ENCODING_H__ */
#endif /* __LIBTRACKER_EXTRACT_ENCODING_H__ */
......@@ -25,6 +25,7 @@
#define __LIBTRACKER_EXTRACT_INSIDE__
#include "tracker-data.h"
#include "tracker-encoding.h"
#include "tracker-exif.h"
#include "tracker-module-manager.h"
#include "tracker-guarantee.h"
......
......@@ -31,4 +31,4 @@ tracker_file_utils_SOURCES = tracker-file-utils-test.c
tracker_utils_SOURCES = tracker-utils-test.c
EXTRA_DIST = non-utf8.txt encoding-detect.bin
EXTRA_DIST = non-utf8.txt
......@@ -22,36 +22,6 @@
#include <glib-object.h>
#include <libtracker-common/tracker-utils.h>
#include <libtracker-common/tracker-encoding.h>
static void
test_encoding_guessing ()
{
gchar *output;
GMappedFile *file = NULL;
gchar *prefix, *filen;
prefix = g_build_path (G_DIR_SEPARATOR_S, TOP_SRCDIR, "tests", "libtracker-common", NULL);
filen = g_build_filename (prefix, "encoding-detect.bin", NULL);
file = g_mapped_file_new (filen, FALSE, NULL);
output = tracker_encoding_guess (g_mapped_file_get_contents (file),
g_mapped_file_get_length (file));
g_assert_cmpstr (output, ==, "UTF-8");
#if GLIB_CHECK_VERSION(2,22,0)
g_mapped_file_unref (file);
#else
g_mapped_file_free (file);
#endif
g_free (prefix);
g_free (filen);
g_free (output);
}
static void
test_seconds_to_string ()
......@@ -115,8 +85,5 @@ main (int argc, char **argv)
g_test_add_func ("/libtracker-common/tracker-utils/seconds_estimate_to_string",
test_seconds_estimate_to_string);
g_test_add_func ("/libtracker-common/tracker-encoding/encoding_guessing",
test_encoding_guessing);
return g_test_run ();
}
tracker-encoding
tracker-test-utils
tracker-test-xmp
......@@ -3,10 +3,13 @@ include $(top_srcdir)/Makefile.decl
noinst_PROGRAMS = $(TEST_PROGS)
TEST_PROGS += \
tracker-encoding \
tracker-test-utils \
tracker-test-xmp
AM_CPPFLAGS = \
-DTOP_SRCDIR=\"$(abs_top_srcdir)\" \
-DTOP_BUILDDIR=\"$(abs_top_builddir)\" \
$(BUILD_CFLAGS) \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
......@@ -21,7 +24,10 @@ LDADD = \
$(BUILD_LIBS) \
$(LIBTRACKER_EXTRACT_LIBS)
tracker_encoding_SOURCES = tracker-encoding-test.c
tracker_test_utils_SOURCES = tracker-test-utils.c
tracker_test_xmp_SOURCES = tracker-test-xmp.c
EXTRA_DIST = encoding-detect.bin
/*
* Copyright (C) 2010, Nokia <ivan.frade@nokia.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "config.h"
#include <glib-object.h>
#include <libtracker-extract/tracker-encoding.h>
static void
test_encoding_guessing ()
{
gchar *output;
GMappedFile *file = NULL;
gchar *prefix, *filen;
prefix = g_build_path (G_DIR_SEPARATOR_S, TOP_SRCDIR, "tests", "libtracker-extract", NULL);
filen = g_build_filename (prefix, "encoding-detect.bin", NULL);
file = g_mapped_file_new (filen, FALSE, NULL);
output = tracker_encoding_guess (g_mapped_file_get_contents (file),
g_mapped_file_get_length (file));
g_assert_cmpstr (output, ==, "UTF-8");
#if GLIB_CHECK_VERSION(2,22,0)
g_mapped_file_unref (file);
#else
g_mapped_file_free (file);
#endif
g_free (prefix);
g_free (filen);
g_free (output);
}
int
main (int argc, char **argv)
{
g_type_init ();
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/libtracker-extract/tracker-encoding/encoding_guessing",
test_encoding_guessing);
return g_test_run ();
}
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