Add library.
authorRichard W.M. Jones <rjones@redhat.com>
Sat, 31 Dec 2011 18:26:57 +0000 (18:26 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Sat, 31 Dec 2011 18:40:46 +0000 (18:40 +0000)
.gitignore
Makefile.am
configure.ac
lib/LIB_MINOR [new file with mode: 0644]
lib/Makefile.am
lib/internal.h [new file with mode: 0644]
lib/wrappi.c [new file with mode: 0644]

index c302ff2..545b80a 100644 (file)
@@ -1,10 +1,13 @@
 .deps
+.libs
 *~
 *.cmi
 *.cmo
 *.cmx
 *.cma
 *.cmxa
+*.la
+*.lo
 *.o
 Makefile
 Makefile.in
index 941266e..ad12f31 100644 (file)
@@ -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
index bc8e520..79ed9c9 100644 (file)
@@ -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 (file)
index 0000000..00750ed
--- /dev/null
@@ -0,0 +1 @@
+3
index 5e79bf3..937c29f 100644 (file)
 # 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 (file)
index 0000000..2213d7b
--- /dev/null
@@ -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 (file)
index 0000000..ff223b3
--- /dev/null
@@ -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 <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#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);
+}