From ab6d4b583bb2ede938da93719ccd8242cdb3c91e Mon Sep 17 00:00:00 2001 From: Michael Rasmussen Date: Mon, 31 Dec 2018 01:53:13 +0100 Subject: [PATCH] initial commit Signed-off-by: Michael Rasmussen --- .gitignore | 2 + AUTHORS | 1 + ChangeLog | 1 + Makefile.am | 15 +++++ NEWS | 0 README | 0 TODO | 0 autogen.sh | 16 +++++ configure.ac | 122 ++++++++++++++++++++++++++++++++++ sqlite_plugin/Makefile.am | 26 ++++++++ sqlite_plugin/sqlite-plugin.c | 29 ++++++++ sqlite_plugin/sqlite-plugin.h | 33 +++++++++ src/Makefile.am | 17 +++++ src/addressbook.c | 4 ++ 14 files changed, 266 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 ChangeLog create mode 100644 Makefile.am create mode 100644 NEWS create mode 100644 README create mode 100644 TODO create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 sqlite_plugin/Makefile.am create mode 100644 sqlite_plugin/sqlite-plugin.c create mode 100644 sqlite_plugin/sqlite-plugin.h create mode 100644 src/Makefile.am create mode 100644 src/addressbook.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..369a1f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.o +*.in diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..0ca70c3 --- /dev/null +++ b/AUTHORS @@ -0,0 +1 @@ +Michael Rasmussen diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..8160d2f --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +0.1 Framework diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..0759647 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,15 @@ +AUTOMAKE_OPTIONS = gnu + +ACLOCAL_AMFLAGS = -I m4 + +SUBDIRS = \ + src + +EXTRA_DIST = \ + AUTHORS \ + ChangeLog \ + NEWS \ + README \ + TODO \ + autogen.sh + diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/TODO b/TODO new file mode 100644 index 0000000..e69de29 diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..a10227f --- /dev/null +++ b/autogen.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +if [ ! -e m4 ]; then + mkdir m4 +fi + +if [ ! -e auxdir ]; then + mkdir auxdir +fi + +aclocal -I m4 \ + && libtoolize --force --copy \ + && autoheader \ + && automake --add-missing --gnu --copy \ + && autoconf \ + && ./configure --enable-maintainer-mode $@ diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..7b2987d --- /dev/null +++ b/configure.ac @@ -0,0 +1,122 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.61) +AC_INIT(addressbook, 0.1, [mir@datanom.net]) +AC_COPYRIGHT([Copyright (c) 2018 Michael Rasmussen.]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR(auxdir) +AC_CANONICAL_SYSTEM + +AC_CONFIG_SRCDIR([src/addressbook.c]) +AM_INIT_AUTOMAKE([gnu no-dist-gzip dist-bzip2 1.10]) +AC_CONFIG_HEADERS([config.h]) +AM_MAINTAINER_MODE + +CFLAGS="-g -Wall" + +if test "x$USE_MAINTAINER_MODE" = "xyes"; then + CFLAGS="${CFLAGS} -Werror -DDEBUG" + AC_DEFINE_UNQUOTED(DEBUG, [1], [Enable debug mode.]) +else + CFLAGS="${CFLAGS} -O -O2" +fi + +GLIB_REQUIRED=2.26.0 +GOBJECT_REQUIRED=2.26.0 +GTK_REQUIRED=2.18.0 +SQLITE3_REQUIRED=3.5.0 + +AC_SUBST(GLIB_REQUIRED) +AC_SUBST(GOBJECT_REQUIRED) +AC_SUBST(GTK_REQUIRED) + +# Checks for programs. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_LIBTOOL +if test -n "$lt_prog_compiler_pic"; then + CFLAGS="$CFLAGS $lt_prog_compiler_pic" +fi + +PKG_PROG_PKG_CONFIG +AC_LIB_PREFIX + +# Checks for libraries. +PKG_CHECK_MODULES([GLIB], + [glib-2.0 >= $GLIB_REQUIRED + gobject-2.0 >= $GOBJECT_REQUIRED + gmodule-2.0] +) +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + +PKG_CHECK_MODULES([GTK], gtk+-2.0 >= $GTK_REQUIRED) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) + +AC_ARG_ENABLE(sqlite, + [AC_HELP_STRING([--enable-sqlite],[Build the included SQLite plugin [default=yes]])], + [ac_enable_sqlite=$enableval], + [ac_enable_sqlite=yes]) + +AC_MSG_CHECKING([whether to compile SQLite3 module]) +if test x"$ac_enable_sqlite" = xyes; then + AC_MSG_RESULT(yes) + PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $SQLITE3_REQUIRED], + [ac_enable_sqlite=yes], + [ac_enable_sqlite=no]) + AC_SUBST(SQLITE3_LIBS) + AC_SUBST(SQLITE3_CFLAGS) + if test x"$ac_enable_sqlite" = "xno"; then + AC_MSG_RESULT([$SQLITE3_PKG_ERRORS]) + fi +fi +AM_CONDITIONAL(BUILD_SQLITE, test x"$ac_enable_sqlite" = "xyes") + +AC_ARG_WITH([moduledir], + [AC_HELP_STRING([--with-moduledir[[=DIR]]],[Build the included SQLite plugin [default=yes]])], + [with_moduledir=$withval], + [with_moduledir=check]) + +if test "x$with_moduledir" = "xcheck"; then + if test "x$USE_MAINTAINER_MODE" = "xyes"; then + PLUGINDIR="${ac_pwd}/src/libaddressbook" + plugindir="${ac_pwd}/src/libaddressbook" + else + if test "x$prefix" = "xNONE"; then + prefix=$ac_default_prefix + fi + PLUGINDIR="${prefix}/lib/addressbook/plugins" + plugindir="${prefix}/lib/addressbook/plugins" + fi +else + PLUGINDIR="$with_moduledir" + plugindir="$with_moduledir" +fi +AC_SUBST(PLUGINDIR) +AC_DEFINE_UNQUOTED(PLUGINDIR, "$plugindir", [Define plugin dir.]) + +# Checks for header files. +AC_CHECK_HEADER([assert.h], + AC_DEFINE([HAVE_ASSERT_H], [1], [Define to 1 if you have the header file.])) + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. + +AC_CONFIG_FILES([ + Makefile + src/Makefile + sqlite_plugin/Makefile +]) + +AC_OUTPUT +echo " +Configuration: + + Source code: ${ac_pwd} + Plugin dir: ${plugindir} + Compiler: ${CC} $($CC -dumpversion) + CFLAGS: ${CFLAGS} +" diff --git a/sqlite_plugin/Makefile.am b/sqlite_plugin/Makefile.am new file mode 100644 index 0000000..64c8578 --- /dev/null +++ b/sqlite_plugin/Makefile.am @@ -0,0 +1,26 @@ +AUTOMAKE_OPTIONS = gnu + +plugindir = @PLUGINDIR@ + +if BUILD_SQLITE +plugin_LTLIBRARIES = sqlite_plugin.la +endif + +sqlite_plugin_la_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_builddir} \ + $(AM_CPPFLAGS) + +sqlite_plugin_la_CFLAGS = \ + @GLIB_CFLAGS@ \ + @SQLITE3_CFLAGS@ \ + $(AM_CFLAGS) + +sqlite_plugin_la_SOURCES = \ + sqlite-plugin.h \ + sqlite-plugin.c + +sqlite_plugin_la_LDFLAGS = \ + -module -avoid-version \ + $(AM_LDFLAGS) + diff --git a/sqlite_plugin/sqlite-plugin.c b/sqlite_plugin/sqlite-plugin.c new file mode 100644 index 0000000..47ce332 --- /dev/null +++ b/sqlite_plugin/sqlite-plugin.c @@ -0,0 +1,29 @@ +/* + * addressbook is Copyright (C) 2009 by Michael Rasmussen. + * + * 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 3 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, see . + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif +#include +#include +#include + +#include + +#include "sqlite-plugin.h" + diff --git a/sqlite_plugin/sqlite-plugin.h b/sqlite_plugin/sqlite-plugin.h new file mode 100644 index 0000000..913abbc --- /dev/null +++ b/sqlite_plugin/sqlite-plugin.h @@ -0,0 +1,33 @@ +/* + * addressbook is Copyright (C) 2009 by Michael Rasmussen. + * + * 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 3 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, see . + * + */ + +#ifndef __SQLITE_PLUGIN_H__ +#define __SQLITE_PLUGIN_H__ + +#include + +G_BEGIN_DECLS + +#ifdef HAVE_CONFIG_H +# include +#endif +#include + +G_END_DECLS + +#endif /* __SQLITE_PLUGIN_H__ */ diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..9d3e2de --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,17 @@ +AUTOMAKE_OPTIONS = gnu + +AM_CPPFLAGS = \ + -I${top_srcdir} \ + -I${top_builddir} \ + @GLIB_CFLAGS@ \ + @GTK_CFLAGS@ + +bin_PROGRAMS = addressbook + +addressbook_SOURCES = \ + addressbook.c + +addressbook_LDADD = \ + @GLIB_LIBS@ \ + @GTK_LIBS@ + diff --git a/src/addressbook.c b/src/addressbook.c new file mode 100644 index 0000000..2b8c6ac --- /dev/null +++ b/src/addressbook.c @@ -0,0 +1,4 @@ + +int main() { + return 0; +} -- 2.39.2