[tracker/tracker-0.10] Move tracker-encoding from libtracker-common to libtracker-extract
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] Move tracker-encoding from libtracker-common to libtracker-extract
- Date: Thu, 28 Apr 2011 11:11:07 +0000 (UTC)
commit 211d7485447a2fbc9302c9738853b45ee14c4846
Author: Jürg Billeter <j bitron ch>
Date: Thu Apr 21 17:04:23 2011 +0200
Move tracker-encoding from libtracker-common to libtracker-extract
Fixes NB#249787.
configure.ac | 8 +-
src/libtracker-common/Makefile.am | 16 +----
src/libtracker-common/tracker-common.h | 1 -
src/libtracker-extract/Makefile.am | 14 ++++
.../tracker-encoding-enca.c | 0
.../tracker-encoding-enca.h | 6 +-
.../tracker-encoding-meegotouch.cpp | 2 +-
.../tracker-encoding-meegotouch.h | 6 +-
.../tracker-encoding.c | 0
.../tracker-encoding.h | 14 ++--
src/libtracker-extract/tracker-extract.h | 1 +
tests/libtracker-common/Makefile.am | 2 +-
tests/libtracker-common/tracker-utils-test.c | 33 ----------
tests/libtracker-extract/.gitignore | 1 +
tests/libtracker-extract/Makefile.am | 6 ++
.../encoding-detect.bin | 0
tests/libtracker-extract/tracker-encoding-test.c | 65 ++++++++++++++++++++
17 files changed, 108 insertions(+), 67 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fc72fd8..6414f63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1056,8 +1056,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"
@@ -1341,8 +1341,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])
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index b2d9f09..c3d488b 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -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 \
@@ -45,18 +44,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
diff --git a/src/libtracker-common/tracker-common.h b/src/libtracker-common/tracker-common.h
index 9eb08b5..bcf4e98 100644
--- a/src/libtracker-common/tracker-common.h
+++ b/src/libtracker-common/tracker-common.h
@@ -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__
diff --git a/src/libtracker-extract/Makefile.am b/src/libtracker-extract/Makefile.am
index 34e2d39..962c81e 100644
--- a/src/libtracker-extract/Makefile.am
+++ b/src/libtracker-extract/Makefile.am
@@ -13,6 +13,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 \
@@ -27,6 +28,7 @@ noinst_HEADERS =
libtracker_extractinclude_HEADERS = \
tracker-data.h \
+ tracker-encoding.h \
tracker-exif.h \
tracker-extract.h \
tracker-guarantee.h \
@@ -34,6 +36,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_.*'
diff --git a/src/libtracker-common/tracker-encoding-enca.c b/src/libtracker-extract/tracker-encoding-enca.c
similarity index 100%
rename from src/libtracker-common/tracker-encoding-enca.c
rename to src/libtracker-extract/tracker-encoding-enca.c
diff --git a/src/libtracker-common/tracker-encoding-enca.h b/src/libtracker-extract/tracker-encoding-enca.h
similarity index 87%
rename from src/libtracker-common/tracker-encoding-enca.h
rename to src/libtracker-extract/tracker-encoding-enca.h
index 6a00c2b..af83978 100644
--- a/src/libtracker-common/tracker-encoding-enca.h
+++ b/src/libtracker-extract/tracker-encoding-enca.h
@@ -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__ */
diff --git a/src/libtracker-common/tracker-encoding-meegotouch.cpp b/src/libtracker-extract/tracker-encoding-meegotouch.cpp
similarity index 98%
rename from src/libtracker-common/tracker-encoding-meegotouch.cpp
rename to src/libtracker-extract/tracker-encoding-meegotouch.cpp
index 5d583cc..6b881e7 100644
--- a/src/libtracker-common/tracker-encoding-meegotouch.cpp
+++ b/src/libtracker-extract/tracker-encoding-meegotouch.cpp
@@ -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
diff --git a/src/libtracker-common/tracker-encoding-meegotouch.h b/src/libtracker-extract/tracker-encoding-meegotouch.h
similarity index 85%
rename from src/libtracker-common/tracker-encoding-meegotouch.h
rename to src/libtracker-extract/tracker-encoding-meegotouch.h
index 7ae95df..6b6a969 100644
--- a/src/libtracker-common/tracker-encoding-meegotouch.h
+++ b/src/libtracker-extract/tracker-encoding-meegotouch.h
@@ -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__ */
diff --git a/src/libtracker-common/tracker-encoding.c b/src/libtracker-extract/tracker-encoding.c
similarity index 100%
rename from src/libtracker-common/tracker-encoding.c
rename to src/libtracker-extract/tracker-encoding.c
diff --git a/src/libtracker-common/tracker-encoding.h b/src/libtracker-extract/tracker-encoding.h
similarity index 79%
rename from src/libtracker-common/tracker-encoding.h
rename to src/libtracker-extract/tracker-encoding.h
index e915ad3..3964452 100644
--- a/src/libtracker-common/tracker-encoding.h
+++ b/src/libtracker-extract/tracker-encoding.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__ */
diff --git a/src/libtracker-extract/tracker-extract.h b/src/libtracker-extract/tracker-extract.h
index ad25fdc..81b9151 100644
--- a/src/libtracker-extract/tracker-extract.h
+++ b/src/libtracker-extract/tracker-extract.h
@@ -25,6 +25,7 @@
#define __LIBTRACKER_EXTRACT_INSIDE__
#include "tracker-data.h"
+#include "tracker-encoding.h"
#include "tracker-exif.h"
#include "tracker-guarantee.h"
#include "tracker-iptc.h"
diff --git a/tests/libtracker-common/Makefile.am b/tests/libtracker-common/Makefile.am
index 5d51148..741226d 100644
--- a/tests/libtracker-common/Makefile.am
+++ b/tests/libtracker-common/Makefile.am
@@ -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
diff --git a/tests/libtracker-common/tracker-utils-test.c b/tests/libtracker-common/tracker-utils-test.c
index f1d5ae0..0f1f19a 100644
--- a/tests/libtracker-common/tracker-utils-test.c
+++ b/tests/libtracker-common/tracker-utils-test.c
@@ -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 ();
}
diff --git a/tests/libtracker-extract/.gitignore b/tests/libtracker-extract/.gitignore
index c7dd275..11d8932 100644
--- a/tests/libtracker-extract/.gitignore
+++ b/tests/libtracker-extract/.gitignore
@@ -1,2 +1,3 @@
+tracker-encoding
tracker-test-utils
tracker-test-xmp
diff --git a/tests/libtracker-extract/Makefile.am b/tests/libtracker-extract/Makefile.am
index d9146d3..8e78e50 100644
--- a/tests/libtracker-extract/Makefile.am
+++ b/tests/libtracker-extract/Makefile.am
@@ -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
diff --git a/tests/libtracker-common/encoding-detect.bin b/tests/libtracker-extract/encoding-detect.bin
similarity index 100%
rename from tests/libtracker-common/encoding-detect.bin
rename to tests/libtracker-extract/encoding-detect.bin
diff --git a/tests/libtracker-extract/tracker-encoding-test.c b/tests/libtracker-extract/tracker-encoding-test.c
new file mode 100644
index 0000000..59e712b
--- /dev/null
+++ b/tests/libtracker-extract/tracker-encoding-test.c
@@ -0,0 +1,65 @@
+/*
+ * 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 ();
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]