From 9bc1d63c273099058929cce160bea0a871eb001a Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 31 Dec 2011 18:26:57 +0000 Subject: [PATCH] Add library. --- .gitignore | 3 +++ Makefile.am | 6 ++++++ configure.ac | 4 ++++ lib/LIB_MINOR | 1 + lib/Makefile.am | 13 +++++++++++++ lib/internal.h | 26 ++++++++++++++++++++++++++ lib/wrappi.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 95 insertions(+) create mode 100644 lib/LIB_MINOR create mode 100644 lib/internal.h create mode 100644 lib/wrappi.c diff --git a/.gitignore b/.gitignore index c302ff2..545b80a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,13 @@ .deps +.libs *~ *.cmi *.cmo *.cmx *.cma *.cmxa +*.la +*.lo *.o Makefile Makefile.in diff --git a/Makefile.am b/Makefile.am index 941266e..ad12f31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,3 +30,9 @@ SUBDIRS += lib SUBDIRS += examples CLEANFILES = *~ + +dist-hook: + rm -f lib/LIB_MINOR + echo $$(( ( $$(date +%s) - $$(date -d 2011-12-27 +%s) ) / 86400 )) \ + > lib/LIB_MINOR-t + mv lib/LIB_MINOR-t lib/LIB_MINOR diff --git a/configure.ac b/configure.ac index bc8e520..79ed9c9 100644 --- a/configure.ac +++ b/configure.ac @@ -55,6 +55,10 @@ if test "$OCAMLFIND" = "no"; then AC_MSG_ERROR([You must install OCaml findlib (the ocamlfind command)]) fi +dnl Library versioning. +LIB_MINOR=`cat $srcdir/lib/LIB_MINOR` +AC_SUBST(LIB_MINOR) + AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile APIs/Makefile diff --git a/lib/LIB_MINOR b/lib/LIB_MINOR new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/lib/LIB_MINOR @@ -0,0 +1 @@ +3 diff --git a/lib/Makefile.am b/lib/Makefile.am index 5e79bf3..937c29f 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -14,3 +14,16 @@ # 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_HEADERS = wrappi.h + +lib_LTLIBRARIES = libwrappi.la + +# This produces version numbers of the form libwrappi.so.0.LIB_MINOR.0 +# where LIB_MINOR is a number that always increments but is otherwise +# not interesting. +libwrappi_la_LDFLAGS = -version-info $(LIB_MINOR):0:$(LIB_MINOR) + +libwrappi_la_SOURCES = \ + wrappi.h \ + wrappi.c diff --git a/lib/internal.h b/lib/internal.h new file mode 100644 index 0000000..2213d7b --- /dev/null +++ b/lib/internal.h @@ -0,0 +1,26 @@ +/* wrappi + * Copyright (C) 2011-2012 Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WRAPPI_INTERNAL_H_ +#define WRAPPI_INTERNAL_H_ + +struct wrap_h { + int error_flag; +}; + +#endif /* WRAPPI_INTERNAL_H_ */ diff --git a/lib/wrappi.c b/lib/wrappi.c new file mode 100644 index 0000000..ff223b3 --- /dev/null +++ b/lib/wrappi.c @@ -0,0 +1,42 @@ +/* wrappi + * Copyright (C) 2011-2012 Red Hat Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include +#include + +#include "wrappi.h" + +#include "internal.h" + +wrap_h * +wrap_create (void) +{ + struct wrap_h *w = calloc (1, sizeof *w); + if (w == NULL) + return NULL; + + return w; +} + +void +wrap_close (wrap_h *w) +{ + free (w); +} -- 1.8.3.1