build: use autoconf and automake
authorGiuseppe Scrivano <gscrivan@redhat.com>
Wed, 11 Feb 2015 14:36:21 +0000 (15:36 +0100)
committerGiuseppe Scrivano <gscrivan@redhat.com>
Thu, 26 Mar 2015 08:36:16 +0000 (09:36 +0100)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
.gitignore [new file with mode: 0644]
Makefile-bsdiff.am [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
README.md
autogen.sh [new file with mode: 0755]
bsdiff.c
configure.ac [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..4e13492
--- /dev/null
@@ -0,0 +1,11 @@
+.deps/*
+.libs/*
+*.lo
+*.o
+.dirstamp
+Makefile-bsdiff.am.inc
+AUTHORS
+NEWS
+README
+ChangeLog
+COPYING
diff --git a/Makefile-bsdiff.am b/Makefile-bsdiff.am
new file mode 100644 (file)
index 0000000..1d810ed
--- /dev/null
@@ -0,0 +1,32 @@
+# Copyright (C) 2015 Giuseppe Scrivano <gscrivan@redhat.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted providing that the following conditions 
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+EXTRA_DIST += $(libbsdiff_srcpath)/bsdiff.h $(libbsdiff_srcpath)/bspatch.h $(libbsdiff_srcpath)/LICENSE $(libbsdiff_srcpath)/README.md
+
+libbsdiff_la_SOURCES = \
+       $(libbsdiff_srcpath)/bsdiff.c \
+       $(libbsdiff_srcpath)/bspatch.c \
+       $(NULL)
+
+libbsdiff_la_CFLAGS = $(AM_CFLAGS)
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..abd3d7e
--- /dev/null
@@ -0,0 +1,11 @@
+bin_PROGRAMS = bsdiff bspatch
+
+bsdiff_SOURCES = bsdiff.c
+
+bspatch_SOURCES = bspatch.c
+
+bsdiff_CFLAGS = -DBSDIFF_EXECUTABLE
+bspatch_CFLAGS = -DBSPATCH_EXECUTABLE
+
+EXTRA_DIST = bsdiff.h bspatch.h
+
index 427ab23..a4b1d23 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,11 +33,6 @@ The overarching goal was to modify the original bsdiff/bspatch code from Colin
 and eliminate external dependencies and provide a simple interface to the core
 functionality.
 
-You can define `BSDIFF_HEADER_ONLY` or `BSPATCH_HEADER_ONLY` to only include
-the header parts of the file. If including a `.c` file makes you feel really
-dirty you can copy paste the header portion at the top of the file into your own
-`.h` file.
-
 I've exposed relevant functions via the `_stream` classes. The only external
 dependency not exposed is `memcmp` in `bsdiff`.
 
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..ce934ac
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+touch AUTHORS NEWS README ChangeLog
+cp LICENSE COPYING
+
+autoreconf -fis
index 5be4476..628f1c1 100644 (file)
--- a/bsdiff.c
+++ b/bsdiff.c
@@ -27,6 +27,9 @@
 
 #include "bsdiff.h"
 
+#include <limits.h>
+#include <string.h>
+
 #define MIN(x,y) (((x)<(y)) ? (x) : (y))
 
 static void split(int64_t *I,int64_t *V,int64_t start,int64_t len,int64_t h)
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..69de743
--- /dev/null
@@ -0,0 +1,30 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([bsdiff], [0.1])
+AC_CONFIG_SRCDIR([bsdiff.c])
+AC_CONFIG_HEADERS([config.h])
+AM_INIT_AUTOMAKE([1.9])
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lbz2':
+AC_CHECK_LIB([bz2], [BZ2_bzReadOpen])
+
+AC_CHECK_HEADERS([fcntl.h limits.h stddef.h stdint.h stdlib.h string.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_INT64_T
+AC_TYPE_OFF_T
+AC_TYPE_SIZE_T
+AC_TYPE_UINT8_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([memset])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT