autoconfiscate

Add autoconf & automake metadata, plus required files for automake to
run without complaint.

Requires an update to ccan, to get the --build-type argument to
create-ccan-tree.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-05-24 15:14:28 +08:00
parent 42c7160576
commit 3def238360
7 changed files with 130 additions and 113 deletions

112
Makefile
View File

@ -1,112 +0,0 @@
# compile options
CC = gcc
CPPFLAGS = -I. $(ccan_includes)
CFLAGS = -Wall -Werror -Wextra -ggdb --std=c99
LDFLAGS = -fwhole-program
# build configuration
sbsign_objs = sbsign.o idc.o image.o
sbverify_objs = sbverify.o idc.o image.o
libs = -lbfd -lcrypto
objs = $(sort $(sbsign_objs) $(sbverify_objs))
docs = docs/sbsign.1 docs/sbverify.1
# ccan build configuration
ccan_dir = lib/ccan
ccan_objs = $(ccan_dir)/libccan.a
ccan_includes = -I./lib/ccan
ccan_modules = talloc
ccan_stamp = $(ccan_dir)/Makefile
ccan_config = $(ccan_dir)/config.h
# install paths
DESTDIR ?=
prefix ?= /usr
bindir ?= ${prefix}/bin
man1dir = ${prefix}/share/man/man1/
install_dirs = install -m 755 -d $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir)
install_bin = install -m 755 -t $(DESTDIR)$(bindir)
install_man1 = install -m 755 -t $(DESTDIR)$(man1dir)
# dist
package = sbsigntool
version = 0.1
pkgver = $(package)-$(version)
tarball = $(pkgver).tar.gz
tools = sbsign sbverify
all: $(tools)
sbsign: $(sbsign_objs) $(ccan_objs)
$(LINK.o) -o $@ $^ $(libs)
sbverify: $(sbverify_objs) $(ccan_objs)
$(LINK.o) -o $@ $^ $(libs)
sbsign.o sbverify.o: CPPFLAGS+=-DVERSION=\"$(version)\"
gen-keyfiles: gen-keyfiles.o $(ccan_objs)
$(LINK.o) -o $@ $^ $(libs)
gen-keyfiles: libs = -luuid
# ccan build
$(ccan_objs): $(ccan_stamp)
cd $(@D) && $(MAKE)
$(ccan_config): $(ccan_stamp)
cd $(@D) && $(MAKE) config.h
# doc build
docs: $(docs)
.PHONY: docs
$(docs): docs/%.1: docs/%.1.in %
help2man --no-info -i $< -o $@ $(patsubst %.1, ./%, $(@F))
# built objects may require headers from ccan
$(objs): $(ccan_stamp) $(ccan_config)
install: $(tools) $(docs)
$(install_dirs)
$(install_bin) $(tools)
$(install_man1) $(docs)
.PHONY: install
clean:
rm -f $(tools)
rm -f *.o
# tarball build
tarball: $(tarball)
$(tarball): $(ccan_stamp)
ln -s . $(pkgver)
tar -zhcvf $@ --exclude '*.tar.gz' \
--exclude $(pkgver)/$(pkgver) \
--exclude $(ccan_source_dir) \
--exclude '.*.swp' \
--exclude .git --exclude .gitmodules \
$(pkgver)
rm $(pkgver)
distclean: clean
rm -rf $(ccan_dir)
# ccan import
ccan_source_dir = lib/ccan.git
ccan_source_file = $(ccan_source_dir)/Makefile
# protect these rules with the DIST variable, as non-git checkouts will not be
# able to run the git submodule commands.
ifeq ($(DIST),1)
$(ccan_source_file):
git submodule init
git submodule update
$(ccan_stamp): $(ccan_source_file)
$(ccan_source_dir)/tools/create-ccan-tree --exclude-tests \
$(@D) $(ccan_modules)
endif

26
Makefile.am Normal file
View File

@ -0,0 +1,26 @@
bin_PROGRAMS = sbsign sbverify
coff_headers = coff/external.h coff/pe.h coff/i386.h coff/x86_64.h
common_SOURCES = idc.c idc.h image.c image.h $(coff_headers)
common_LDADD = lib/ccan/libccan.a $(libcrypto_LIBS)
common_CFLAGS = -I$(srcdir)/lib/ccan/
sbsign_SOURCES = sbsign.c $(common_SOURCES)
sbsign_LDADD = $(common_LDADD)
sbsign_CFLAGS = $(common_CFLAGS)
sbverify_SOURCES = sbverify.c $(common_SOURCES)
sbverify_LDADD = $(common_LDADD)
sbverify_CFLAGS = $(common_CFLAGS)
man1_MANS = docs/sbsign.1 docs/sbverify.1
EXTRA_DIST = docs/sbsign.1.in docs/sbverify.1.in
$(builddir)/docs/%.1: $(srcdir)/docs/%.1.in $(builddir)/%
$(MKDIR_P) $(@D)
$(HELP2MAN) --no-info -i $< -o $@ $(builddir)/$*
SUBDIRS = lib/ccan

2
NEWS Normal file
View File

@ -0,0 +1,2 @@
v0.1:
Initial version

14
README Normal file
View File

@ -0,0 +1,14 @@
sbsigntool - Signing utility for UEFI secure boot
Copyright (C) 2102 Jeremy Kerr <jeremy.kerr@canonical.com>
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
See file ./INSTALL for building and installation instructions.
Main git repository:
git://kernel.ubuntu.com/jk/sbsigntool.git
sbsigntool is free software. See the file COPYING for copying conditions.

33
autogen.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
ccan_modules=talloc
# Add ccan upstream sources
if [ ! -e lib/ccan.git/Makefile ]
then
git submodule init
git submodule update
fi
# create ccan build tree
if [ ! -e lib/ccan ]
then
lib/ccan.git/tools/create-ccan-tree \
--build-type=automake lib/ccan $ccan_modules
fi
# Create generatable docs from git
(
echo "Authors of sbsigntool:"
echo
git log --format='%an' | sort -u | sed 's,^,\t,'
) > AUTHORS
# Generate simple ChangeLog
git log --date=short --format='%ad %t %an <%ae>%n%n * %s%n' > ChangeLog
# automagic
aclocal
autoheader
autoconf
automake --add-missing -Wno-portability

54
configure.ac Normal file
View File

@ -0,0 +1,54 @@
AC_INIT([sbsigntool], [0.1], [jeremy.kerr@canonical.com])
AM_INIT_AUTOMAKE()
AC_PREREQ(2.60)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_SRCDIR(sbsign.c)
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_RANLIB
if test $cross_compiling = no; then
AM_MISSING_PROG(HELP2MAN, help2man)
else
HELP2MAN=:
fi
AC_MSG_CHECKING([build system endianness])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([[#include <endian.h>]],
[[#if __BYTE_ORDER != __LITTLE_ENDIAN]]
[[#error]]
[[#endif]])],
endian=little
little_endian=1
big_endian=0)
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([[#include <endian.h>]],
[[#if __BYTE_ORDER != __BIG_ENDIAN]]
[[#error]]
[[#endif]])],
endian=big
little_endian=0
big_endian=1)
if test x"$endian" != "xbig" -a x"$endian" != "xlittle"; then
AC_MSG_ERROR([Can't determine endianness; is endian.h present?])
fi
AC_MSG_RESULT($endian)
AC_DEFINE_UNQUOTED(HAVE_LITTLE_ENDIAN, $little_endian, [Little-endian system])
AC_DEFINE_UNQUOTED(HAVE_BIG_ENDIAN, $big_endian, [Big-endian system])
PKG_PROG_PKG_CONFIG()
PKG_CHECK_MODULES(libcrypto, libcrypto,
[],
AC_MSG_ERROR([libcrypto (from the OpenSSL package) is required]))
AC_CONFIG_FILES([Makefile lib/ccan/Makefile])
AC_OUTPUT

@ -1 +1 @@
Subproject commit ebcbbcfafce6a239724c841d30b9ba345cef41e4
Subproject commit b1f28e17227f2320d07fe052a8a48942fe17caa5