From c7a4f00fd701c7e1bd071c7a5aa8199f96833823 Mon Sep 17 00:00:00 2001 From: Jannis Pohlmann Date: Thu, 22 Mar 2012 13:55:30 +0000 Subject: Switch to a shared tbdiff library and make this an autotools project. This commit converts tbdiff to being an autotools-based project. This means that we now support the usual autoreconf -i && ./configure && make && make install process, plus we provide 'make check' for the tbdiff test suite. The tbdiff library is now build as a shared library and is also installed into the system for others to use. The library is libtool-versioned and ships a pkg-config file (tbdiff-1.pc). The headers were adjusted so that only tbdiff/tbdiff.h may be included directly; all others are considered internal. The tbdiff-create and tbdiff-deploy tools were changed to include this header file. The tbdiff library is still GPL, not LGPL. We might want to change this in the future. Thanks to switching to autotools we now have a way to make releases by means of 'make dist' and 'make distcheck'. Unfortunately, the latter currently fails, probably due to something being missing in tbdiff/Makefile.am. --- tbdiff-deploy/Makefile.am | 38 +++++++++++++++++++++++++++++++++++ tbdiff-deploy/main.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 tbdiff-deploy/Makefile.am create mode 100644 tbdiff-deploy/main.c (limited to 'tbdiff-deploy') diff --git a/tbdiff-deploy/Makefile.am b/tbdiff-deploy/Makefile.am new file mode 100644 index 0000000..b97cceb --- /dev/null +++ b/tbdiff-deploy/Makefile.am @@ -0,0 +1,38 @@ +# vi:set ts=8 sw=8 noet ai nocindent: +# - +# Copyright (c) 2011-2012 Codethink Ltd. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License Version 2 as +# published by the Free Software Foundation. +# +# 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, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# vi:set ts=8 sw=8 noet ai nocindent: + +bin_PROGRAMS = \ + tbdiff-deploy + +tbdiff_deploy_SOURCES = \ + main.c + +tbdiff_deploy_CFLAGS = \ + -I$(top_srcdir) \ + $(PLATFORM_CFLAGS) \ + $(PLATFORM_CPPFLAGS) + +tbdiff_deploy_LDFLAGS = \ + -no-undefined \ + $(PLATFORM_LDFLAGS) + +tbdiff_deploy_DEPENDENCIES = \ + $(top_builddir)/tbdiff/libtbdiff-$(TBDIFF_VERSION_API).la + +tbdiff_deploy_LDADD = \ + $(top_builddir)/tbdiff/libtbdiff-$(TBDIFF_VERSION_API).la diff --git a/tbdiff-deploy/main.c b/tbdiff-deploy/main.c new file mode 100644 index 0000000..b5b7ce9 --- /dev/null +++ b/tbdiff-deploy/main.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011-2012 Codethink Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License Version 2 as + * published by the Free Software Foundation. + * + * 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, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include +#include +#include +#include +#include +#include + +#include + +int +main(int argc, + char **argv) +{ + if(argc < 2) { + fprintf(stderr, "Error: No patch stream specified.\n"); + return EXIT_FAILURE; + } + + FILE* patch = fopen(argv[1], "rb"); + if(patch == NULL) { + fprintf(stderr, "Error: Can't open patch stream for reading.\n"); + return EXIT_FAILURE; + } + + int err; + if((err = tbd_apply(patch)) != 0) { + fclose(patch); + fprintf(stderr, "Error: Error applying patch stream (err=%d).\n", err); + return EXIT_FAILURE; + } + + fclose(patch); + return EXIT_SUCCESS; +} -- cgit v1.2.1