summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore26
-rw-r--r--Makefile.am34
-rwxr-xr-xautogen.sh29
-rw-r--r--configure.ac144
-rw-r--r--endless-0.pc.in15
-rw-r--r--endless/Makefile.am27
-rw-r--r--endless/apiversion.h12
-rw-r--r--endless/endless.h25
-rw-r--r--endless/enums.h12
-rw-r--r--endless/hello.c69
-rw-r--r--endless/macros.h12
-rw-r--r--endless/types.h16
-rw-r--r--m4/as-compiler-flag.m462
13 files changed, 483 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index d2d6f36..6877869 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,33 @@
+# Build products
+endless-0.pc
+
*.py[cod]
# C extensions
+*.o
*.so
+*.la
+*.lo
+
+# Autotools droppings
+.deps
+.libs
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.*
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/missing
+/m4/libtool.m4
+/m4/lt~obsolete.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
# Packages
*.egg
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..544ef5b
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,34 @@
+## Process this file with automake to produce Makefile.in
+
+# Copyright 2013 Endless Mobile, Inc.
+
+## -----------
+## Makefile.am
+## -----------
+## Please keep this file well-commented.
+
+# Our Autoconf macros are kept in the m4/ directory
+ACLOCAL_AMFLAGS = -I m4
+
+# Extra files to distribute in the tarball
+EXTRA_DIST = @EOS_SDK_API_NAME@.pc.in
+
+AM_CFLAGS = @STRICT_CFLAGS@
+
+DISTCLEANFILES =
+
+# # # LIBRARY # # #
+
+# Main Open Endless SDK library
+include $(top_srcdir)/endless/Makefile.am
+
+# Public header files
+endlessincludedir = $(includedir)/@EOS_SDK_API_NAME@
+nobase_endlessinclude_HEADERS = \
+ $(endless_public_installed_headers) \
+ $(endless_private_installed_headers)
+
+# Pkg-config file
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = @EOS_SDK_API_NAME@.pc
+DISTCLEANFILES += @EOS_SDK_API_NAME@.pc
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..4c5ae11
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,29 @@
+# Bootstrap script for Open Endless SDK
+# Run this script on a clean source checkout to get ready for building.
+
+FILE_MUST_EXIST=endless/endless.h
+
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
+olddir=`pwd`
+
+cd $srcdir
+test -f $FILE_MUST_EXIST || {
+ echo "You must run this script in the top-level checkout directory"
+ exit 1
+}
+
+# NOCONFIGURE is used by gnome-common
+if test -z "$NOCONFIGURE"; then
+ echo "This script will run ./configure automatically. If you wish to pass "
+ echo "any arguments to it, please specify them on the $0 "
+ echo "command line. To disable this behavior, have NOCONFIGURE=1 in your "
+ echo "environment."
+fi
+
+# Run the actual tools to prepare the clean checkout
+autoreconf -fi || exit $?
+rm -f po/Makevars.template
+
+cd "$olddir"
+test -n "$NOCONFIGURE" || "./configure" "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..b2404b5
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,144 @@
+dnl Process this file with autoconf to produce configure
+
+# Copyright 2013 Endless Mobile, Inc.
+
+dnl ------------
+dnl configure.ac
+dnl ------------
+dnl Please keep this file well-commented. Autotools involve a lot of magical
+dnl incantations, and it is easy to mess things up if you don't know what you
+dnl are doing.
+
+# Version numbers
+# ---------------
+# API name and version for pkg-config; increment when breaking API/ABI.
+# This version number is also the major version number.
+m4_define([_EOS_SDK_API_VERSION_MACRO], [0])
+
+# Minor and micro versions: increment micro version when making a release. Minor
+# version is even for a stable release and odd for a development release.
+# When making any release, if the API changes, set the interface age to 0.
+m4_define([_EOS_SDK_MINOR_VERSION_MACRO], [0])
+m4_define([_EOS_SDK_MICRO_VERSION_MACRO], [0])
+m4_define([_EOS_SDK_INTERFACE_AGE_MACRO], [0])
+
+# Full version, for use in AC_INIT
+m4_define([_EOS_SDK_VERSION_MACRO],
+ [_EOS_SDK_API_VERSION_MACRO._EOS_SDK_MINOR_VERSION_MACRO._EOS_SDK_MICRO_VERSION_MACRO])
+
+# Initialization
+# --------------
+# Initialize Autoconf: package name, version, bug report address, tarball name,
+# website
+AC_INIT([Open Endless SDK], [_EOS_SDK_VERSION_MACRO],
+ [], [eos-sdk], [http://endlessm.com])
+# Verify that the source directory can be found
+dnl AC_CONFIG_SRCDIR([src/hello.c])
+# Initialize Automake: enable all warnings and do not insist on GNU standards
+# Automake >= 1.11 required for silent rules
+AM_INIT_AUTOMAKE([-Wall foreign 1.11])
+# Avoid spewing garbage over the terminal ('make V=1' to see the garbage)
+AM_SILENT_RULES([yes])
+# Initialize Libtool; don't build static libraries
+LT_INIT([disable-static])
+# Keep Autotools macros local to this source tree
+AC_CONFIG_MACRO_DIR([m4])
+
+# Variables to define
+# -------------------
+# Version numbers and macros
+EOS_SDK_API_VERSION=_EOS_SDK_API_VERSION_MACRO
+AC_SUBST(EOS_SDK_API_VERSION)
+AC_DEFINE([EOS_SDK_MAJOR_VERSION], [_EOS_SDK_API_VERSION_MACRO], [Major (API) version])
+EOS_SDK_API_NAME="endless-$EOS_SDK_API_VERSION"
+AC_SUBST(EOS_SDK_API_NAME)
+EOS_SDK_MINOR_VERSION=_EOS_SDK_MINOR_VERSION_MACRO
+EOS_SDK_MICRO_VERSION=_EOS_SDK_MICRO_VERSION_MACRO
+EOS_SDK_INTERFACE_AGE=_EOS_SDK_INTERFACE_AGE_MACRO
+AC_DEFINE([EOS_SDK_MINOR_VERSION], [_EOS_SDK_MINOR_VERSION_MACRO], [Minor version])
+AC_DEFINE([EOS_SDK_MICRO_VERSION], [_EOS_SDK_MICRO_VERSION_MACRO], [Micro version])
+AC_DEFINE([EOS_SDK_VERSION], [_EOS_SDK_VERSION_MACRO], [Full version number])
+
+# Shared library versioning; calculated automatically.
+# See http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
+EOS_SDK_LT_CURRENT=m4_eval(100 * _EOS_SDK_MINOR_VERSION_MACRO + _EOS_SDK_MICRO_VERSION_MACRO - _EOS_SDK_INTERFACE_AGE_MACRO)
+EOS_SDK_LT_REVISION=$EOS_SDK_INTERFACE_AGE
+EOS_SDK_LT_AGE=$EOS_SDK_LT_CURRENT
+EOS_SDK_LT_VERSION_INFO="$EOS_SDK_LT_CURRENT:$EOS_SDK_LT_REVISION:$EOS_SDK_LT_AGE"
+AC_SUBST(EOS_SDK_LT_VERSION_INFO)
+
+# Required versions of libraries
+# Update these whenever you use a function that requires a certain API version
+GLIB_REQUIREMENT="glib-2.0 >= 2.20"
+GOBJECT_REQUIREMENT="gobject-2.0"
+GIO_REQUIREMENT="gio-2.0"
+GTK_REQUIREMENT="gtk+-3.0 >= 3.0"
+# These go into the pkg-config file as Requires: and Requires.private:
+# (Generally, use Requires.private: instead of Requires:)
+EOS_REQUIRED_MODULES=
+EOS_REQUIRED_MODULES_PRIVATE="$GLIB_REQUIREMENT $GOBJECT_REQUIREMENT $GIO_REQUIREMENT $GTK_REQUIREMENT"
+AC_SUBST(EOS_REQUIRED_MODULES)
+AC_SUBST(EOS_REQUIRED_MODULES_PRIVATE)
+
+# Configure options
+# -----------------
+# --enable-strict-flags: Compile with strict compiler flags. Done automatically
+# during 'make distcheck'.
+AC_ARG_ENABLE([strict-flags],
+ [AS_HELP_STRING([--enable-strict-flags=@<:@no/yes/error@:>@],
+ [Use strict compiler flags @<:@default=no@:>@])],
+ [],
+ [enable_strict_flags=no])
+# Emmanuele's list of flags
+STRICT_COMPILER_FLAGS="$STRICT_COMPILER_FLAGS
+ -Wall
+ -Wcast-align
+ -Wuninitialized
+ -Wno-strict-aliasing
+ -Werror=pointer-arith
+ -Werror=missing-declarations
+ -Werror=redundant-decls
+ -Werror=empty-body
+ -Werror=format
+ -Werror=format-security
+ -Werror=format-nonliteral
+ -Werror=init-self
+ -Werror=declaration-after-statement
+ -Werror=vla"
+AS_CASE([$enable_strict_flags],
+ [yes],
+ [AS_COMPILER_FLAGS([STRICT_CFLAGS], [$STRICT_COMPILER_FLAGS])],
+ [no],
+ [],
+ [error],
+ [
+ STRICT_COMPILER_FLAGS="$STRICT_COMPILER_FLAGS -Werror"
+ AS_COMPILER_FLAGS([STRICT_CFLAGS], [$STRICT_COMPILER_FLAGS])
+ ],
+ [AC_MSG_ERROR([Invalid option for --enable-strict-flags])])
+STRICT_CFLAGS=${STRICT_CFLAGS#* } dnl Strip spaces
+AC_SUBST(STRICT_CFLAGS)
+
+# Required build tools
+# --------------------
+# C compiler
+AC_PROG_CC
+# Library configuration tool
+PKG_PROG_PKG_CONFIG
+
+# Required libraries
+# ------------------
+PKG_CHECK_MODULES([EOS_SDK], [
+ $EOS_REQUIRED_MODULES
+ $EOS_REQUIRED_MODULES_PRIVATE])
+
+# Output
+# ------
+# List files here that the configure script should output
+AC_CONFIG_FILES([
+ Makefile
+ $EOS_SDK_API_NAME.pc
+])
+# Do the output
+AC_OUTPUT
+
diff --git a/endless-0.pc.in b/endless-0.pc.in
new file mode 100644
index 0000000..083f995
--- /dev/null
+++ b/endless-0.pc.in
@@ -0,0 +1,15 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: @PACKAGE_NAME@
+Version: @PACKAGE_VERSION@
+Description: Software development kit for applications for the developing world
+URL: @PACKAGE_URL@
+
+Requires: @EOS_REQUIRED_MODULES@
+Requires.private: @EOS_REQUIRED_MODULES_PRIVATE@
+Cflags: -I${includedir}/@EOS_SDK_API_NAME@
+Libs: -L${libdir} -l@EOS_SDK_API_NAME@
+
diff --git a/endless/Makefile.am b/endless/Makefile.am
new file mode 100644
index 0000000..92c9ab3
--- /dev/null
+++ b/endless/Makefile.am
@@ -0,0 +1,27 @@
+# Copyright 2013 Endless Mobile, Inc.
+
+endless_public_installed_headers = endless/endless.h
+
+endless_private_installed_headers = \
+ endless/apiversion.h \
+ endless/enums.h \
+ endless/macros.h \
+ endless/types.h
+
+endless_library_sources = \
+ endless/hello.c
+
+# Endless GUI library
+lib_LTLIBRARIES = libendless-@EOS_SDK_API_VERSION@.la
+libendless_@EOS_SDK_API_VERSION@_la_SOURCES = \
+ $(endless_public_installed_headers) \
+ $(endless_private_installed_headers) \
+ $(endless_library_sources)
+libendless_@EOS_SDK_API_VERSION@_la_CPPFLAGS = \
+ @EOS_SDK_CFLAGS@ \
+ -DCOMPILING_EOS_SDK
+libendless_@EOS_SDK_API_VERSION@_la_CFLAGS = $(AM_CFLAGS)
+libendless_@EOS_SDK_API_VERSION@_la_LIBADD = @EOS_SDK_LIBS@
+libendless_@EOS_SDK_API_VERSION@_la_LDFLAGS = \
+ -version-info @EOS_SDK_LT_VERSION_INFO@ \
+ -export-symbols-regex "^eos_"
diff --git a/endless/apiversion.h b/endless/apiversion.h
new file mode 100644
index 0000000..5b9b292
--- /dev/null
+++ b/endless/apiversion.h
@@ -0,0 +1,12 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#if !(defined(_EOS_SDK_INSIDE_ENDLESS_H) || defined(COMPILING_EOS_SDK))
+#error "Please do not include this header file directly."
+#endif
+
+#ifndef API_VERSION_H
+#define API_VERSION_H
+
+#define EOS_SDK_ALL_API_VERSIONS
+
+#endif /* API_VERSION_H */
diff --git a/endless/endless.h b/endless/endless.h
new file mode 100644
index 0000000..84a33b0
--- /dev/null
+++ b/endless/endless.h
@@ -0,0 +1,25 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#ifndef ENDLESS_H
+#define ENDLESS_H
+
+#include <glib.h>
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define _EOS_SDK_INSIDE_ENDLESS_H
+
+/* Pull in other header files */
+#include "types.h"
+
+#undef _EOS_SDK_INSIDE_ENDLESS_H
+
+EOS_SDK_ALL_API_VERSIONS
+gboolean eos_hello_sample_function (GFile *file,
+ GError **error);
+
+G_END_DECLS
+
+#endif
+
diff --git a/endless/enums.h b/endless/enums.h
new file mode 100644
index 0000000..b85cde3
--- /dev/null
+++ b/endless/enums.h
@@ -0,0 +1,12 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#if !(defined(_EOS_SDK_INSIDE_ENDLESS_H) || defined(COMPILING_EOS_SDK))
+#error "Please do not include this header file directly."
+#endif
+
+#ifndef EOS_ENUMS_H
+#define EOS_ENUMS_H
+
+/* Shared typedefs for enumerations */
+
+#endif /* EOS_ENUMS_H */
diff --git a/endless/hello.c b/endless/hello.c
new file mode 100644
index 0000000..1db6f90
--- /dev/null
+++ b/endless/hello.c
@@ -0,0 +1,69 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#include <string.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <endless/endless.h>
+
+/**
+ * SECTION:hello
+ * @short_description: Sample skeleton function
+ * @title: Hello
+ *
+ * This is a sample skeleton function that says hello either to the terminal or
+ * a file.
+ */
+
+/**
+ * eos_hello_sample_function:
+ * @file: (allow-none): #GFile to write to, or %NULL
+ * @error: (allow-none): Return location for a #GError, or %NULL to ignore.
+ *
+ * A sample API function to say hello with. Prints on the terminal if @file is
+ * %NULL, or else appends it to @file.
+ *
+ * Returns: %TRUE on success, %FALSE on error.
+ */
+gboolean
+eos_hello_sample_function(GFile *file,
+ GError **error)
+{
+ char hello_string[] = "Hello, world!\n";
+ GFileOutputStream *stream;
+ ssize_t write_count;
+ gboolean success;
+
+ g_return_val_if_fail (G_IS_FILE (file) || file == NULL, FALSE);
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ /* Print to terminal */
+ if (file == NULL)
+ {
+ g_print ("%s", hello_string);
+ return TRUE;
+ }
+
+ stream = g_file_append_to (file,
+ G_FILE_CREATE_NONE,
+ NULL, /* cancellable */
+ error);
+ if(!stream)
+ return FALSE;
+
+ write_count = g_output_stream_write (G_OUTPUT_STREAM (stream),
+ hello_string,
+ strlen (hello_string),
+ NULL, /* cancellable */
+ error);
+ success = g_output_stream_close (G_OUTPUT_STREAM (stream),
+ NULL, /* cancellable */
+ error);
+ g_object_unref (stream);
+
+ if (write_count == -1 || !success)
+ return FALSE;
+
+ return TRUE;
+}
+
diff --git a/endless/macros.h b/endless/macros.h
new file mode 100644
index 0000000..1a3fc44
--- /dev/null
+++ b/endless/macros.h
@@ -0,0 +1,12 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#if !(defined(_EOS_SDK_INSIDE_ENDLESS_H) || defined(COMPILING_EOS_SDK))
+#error "Please do not include this header file directly."
+#endif
+
+#ifndef EOS_MACROS_H
+#define EOS_MACROS_H
+
+/* Shared preprocessor macros */
+
+#endif /* EOS_MACROS_H */
diff --git a/endless/types.h b/endless/types.h
new file mode 100644
index 0000000..a572d7c
--- /dev/null
+++ b/endless/types.h
@@ -0,0 +1,16 @@
+/* Copyright 2013 Endless Mobile, Inc. */
+
+#if !(defined(_EOS_SDK_INSIDE_ENDLESS_H) || defined(COMPILING_EOS_SDK))
+#error "Please do not include this header file directly."
+#endif
+
+#ifndef EOS_TYPES_H
+#define EOS_TYPES_H
+
+#include "enums.h"
+#include "macros.h"
+#include "apiversion.h"
+
+/* Shared typedefs for structures */
+
+#endif /* EOS_TYPES_H */
diff --git a/m4/as-compiler-flag.m4 b/m4/as-compiler-flag.m4
new file mode 100644
index 0000000..0f660cf
--- /dev/null
+++ b/m4/as-compiler-flag.m4
@@ -0,0 +1,62 @@
+dnl as-compiler-flag.m4 0.1.0
+
+dnl autostars m4 macro for detection of compiler flags
+
+dnl David Schleef <ds@schleef.org>
+
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/12/15 23:35:19 ds Exp $
+
+dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given CFLAGS.
+dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
+dnl and ACTION-IF-NOT-ACCEPTED otherwise.
+
+AC_DEFUN([AS_COMPILER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler understands $1])
+
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+
+ AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ m4_ifvaln([$2],[$2])
+ true
+ else
+ m4_ifvaln([$3],[$3])
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+dnl AS_COMPILER_FLAGS(VAR, FLAGS)
+dnl Tries to compile with the given CFLAGS.
+
+AC_DEFUN([AS_COMPILER_FLAGS],
+[
+ list=$2
+ flags_supported=""
+ flags_unsupported=""
+ AC_MSG_CHECKING([for supported compiler flags])
+ for each in $list
+ do
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $each"
+ AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ flags_supported="$flags_supported $each"
+ else
+ flags_unsupported="$flags_unsupported $each"
+ fi
+ done
+ AC_MSG_RESULT([$flags_supported])
+ if test "X$flags_unsupported" != X ; then
+ AC_MSG_WARN([unsupported compiler flags: $flags_unsupported])
+ fi
+ $1="$$1 $flags_supported"
+])
+