soylent r147 - in trunk: . libsoylent libsoylent/test



Author: svenp
Date: Mon Jun  2 14:41:52 2008
New Revision: 147
URL: http://svn.gnome.org/viewvc/soylent?rev=147&view=rev

Log:
added libsoylent and libsoylent/test and integrated them with autotools (--enable-libsoylent=yes to build libsoylent and testcases)

Added:
   trunk/libsoylent/   (props changed)
   trunk/libsoylent/Makefile.am
   trunk/libsoylent/soylent-person.c
   trunk/libsoylent/soylent-person.h
   trunk/libsoylent/test/   (props changed)
   trunk/libsoylent/test/Makefile.am
   trunk/libsoylent/test/test.c
   trunk/libsoylent/test/test.h
Modified:
   trunk/Makefile.am
   trunk/configure.ac

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Mon Jun  2 14:41:52 2008
@@ -1,6 +1,13 @@
 SUBDIRS = src data
+if ENABLE_LIBSOYLENT
+SUBDIRS += libsoylent
+endif
+
 EXTRA_DIST =
 
+# TODO: does this work?
+TESTS = test
+
 # Generate Changelog, copied from dbus-glib
 #
 

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Jun  2 14:41:52 2008
@@ -6,6 +6,11 @@
 m4_define(soylent_version, soylent_major_version.soylent_minor_version.soylent_micro_version)
 m4_define(soylent_major_minor, soylent_major_version.soylent_minor_version)
 
+m4_define(libsoylent_major_version, 0)
+m4_define(libsoylent_minor_version, 0)
+m4_define(libsoylent_micro_version, 1)
+m4_define(libsoylent_version, libsoylent_major_version.libsoylent_minor_version.libsoylent.micro_version)
+
 AC_INIT(soylent, soylent_version)
 
 AC_CONFIG_SRCDIR([src/soylent.c])
@@ -15,6 +20,7 @@
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 AC_PROG_CC
+AC_PROG_LIBTOOL
 AC_STDC_HEADERS
 
 AM_PROG_CC_C_O
@@ -89,6 +95,33 @@
 AC_SUBST(SOYLENT_CFLAGS)
 AC_SUBST(SOYLENT_LIBS)
 
+# --- libsoylent ---
+
+AC_ARG_ENABLE(libsoylent, [  --enable-libsoylent     build libsoylent and libsoylent test-cases ])
+
+if test "x$enable_libsoylent" = "xyes"; then	
+
+	PKG_CHECK_MODULES(LIBSOYLENT,
+	[
+		glib-2.0
+	])
+	AC_SUBST(LIBSOYLENT_CLFAGS)
+	AC_SUBST(LIBSOYLENT_LIBS)
+	
+	PKG_CHECK_MODULES(TEST,
+	[
+		glib-2.0
+	])
+	AC_SUBST(TEST_CLFAGS)
+	AC_SUBST(TEST_LIBS)
+	
+	AC_DEFINE(ENABLE_LIBSOYLENT)
+fi
+
+AM_CONDITIONAL(ENABLE_LIBSOYLENT, test "x$enable_libsoylent" = "xyes")
+
+# ------------------
+
 SOYLENT_MAJOR_MINOR=soylent_major_minor
 
 dnl TODO
@@ -130,6 +163,8 @@
   data/icons/scalable/Makefile
   data/icons/scalable/apps/Makefile
   src/Makefile
+  libsoylent/Makefile
+  libsoylent/test/Makefile
 )
-AC_OUTPUT
 
+AC_OUTPUT

Added: trunk/libsoylent/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/libsoylent/Makefile.am	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,12 @@
+#
+
+SUBDIRS = . test
+
+lib_LTLIBRARIES = libsoylent.la
+
+libsoylent_la_SOURCES = \
+	soylent-person.h \
+	soylent-person.c
+
+libsoylent_la_CFLAGS = ${LIBSOYLENT_CFLAGS} ${WARN_CFLAGS}
+libsoylent_la_LIBADD = ${LIBSOYLENT_LIBS}

Added: trunk/libsoylent/soylent-person.c
==============================================================================
--- (empty file)
+++ trunk/libsoylent/soylent-person.c	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,9 @@
+//
+
+#include "soylent-person.h"
+
+gint soylent_person_foo(const gchar *bar) {
+	g_return_val_if_fail(bar != NULL, -1);
+	
+	return g_str_hash(bar);
+}

Added: trunk/libsoylent/soylent-person.h
==============================================================================
--- (empty file)
+++ trunk/libsoylent/soylent-person.h	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,12 @@
+//
+
+#ifndef SOYLENT_PERSON_H
+#define SOYLENT_PERSON_H
+
+#include <glib.h>
+
+#define SOYLENT_VERSION "0.0.1"
+
+gint soylent_person_foo(const gchar *bar);
+
+#endif

Added: trunk/libsoylent/test/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/libsoylent/test/Makefile.am	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,12 @@
+#
+
+noinst_PROGRAMS = test
+
+test_SOURCES = \
+	test.h \
+	test.c
+
+test_CFLAGS = ${WARN_CFLAGS} ${TEST_CFLAGS}
+test_LDADD = ../libsoylent.la ${TEST_LIBS}
+
+INCLUDES = -I${top_srcdir}

Added: trunk/libsoylent/test/test.c
==============================================================================
--- (empty file)
+++ trunk/libsoylent/test/test.c	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,19 @@
+//
+
+#include "test.h"
+
+#include <libsoylent/soylent-person.h>
+#include <glib.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+	g_print("welcome to libsoylent test v%s\n", SOYLENT_VERSION);
+	
+	g_print("starting test foo\n");
+	
+	g_print("hash: %d\n", soylent_person_foo("bar"));
+	
+	g_print("i can do so much more\n");
+	
+	return EXIT_SUCCESS;
+}

Added: trunk/libsoylent/test/test.h
==============================================================================
--- (empty file)
+++ trunk/libsoylent/test/test.h	Mon Jun  2 14:41:52 2008
@@ -0,0 +1,6 @@
+//
+
+#ifndef TEST_H
+#define TEST_H
+
+#endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]