Add an autotools-based build system

This is based on util-cursor's build system and libxcb/configure.ac for finding
xcb-proto's XML files.

Signed-off-by: Uli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>
This commit is contained in:
Uli Schlachter 2015-03-25 10:30:27 +01:00
parent 456a9a6f0c
commit 059bfdbed8
10 changed files with 196 additions and 30 deletions

84
.gitignore vendored
View file

@ -1,3 +1,85 @@
src/libxcb_errors.so #
# X.Org module default exclusion patterns
# The next section if for module specific patterns
#
# Do not edit the following section
# GNU Build System (Autotools)
aclocal.m4
autom4te.cache/
autoscan.log
ChangeLog
compile
config.guess
config.h
config.h.in
config.log
config-ml.in
config.py
config.status
config.status.lineno
config.sub
configure
configure.scan
depcomp
.deps/
INSTALL
install-sh
.libs/
libtool
libtool.m4
ltmain.sh
lt~obsolete.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
Makefile
Makefile.in
mdate-sh
missing
mkinstalldirs
*.pc
py-compile
stamp-h?
symlink-tree
texinfo.tex
ylwrap
# Do not edit the following section
# Edit Compile Debug Document Distribute
*~
*.[0-9]
*.[0-9]x
*.bak
*.bin
core
*.dll
*.exe
*-ISO*.bdf
*-JIS*.bdf
*-KOI8*.bdf
*.kld
*.ko
*.ko.cmd
*.lai
*.l[oa]
*.[oa]
*.obj
*.patch
*.so
*.pcf.gz
*.pdb
*.tar.bz2
*.tar.gz
#
# Add & Override patterns for xinit
#
# Edit the following section as needed
# For example, !report.pc overrides *.pc. See 'man gitignore'
#
.dirstamp
src/extensions.c src/extensions.c
test-driver
test-suite.log
test.log
test.trs
tests/test tests/test

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "m4"]
path = m4
url = git://anongit.freedesktop.org/xcb/util-common-m4.git

View file

@ -1,27 +0,0 @@
FLAGS=-std=gnu89 -Wall -Wextra -ggdb3
SHARED_FLAGS=$(FLAGS) -lxcb -fpic -shared -Wl,-no-undefined # -Wl,-export-symbols-regex,'^xcb_errors_'
TEST_FLAGS=$(FLAGS) -Isrc
.PHONY: check
all: src/libxcb-errors.so check
check: tests/test
LD_LIBRARY_PATH=src tests/test
src/libxcb-errors.so: $(wildcard src/*.c) $(wildcard *.h) src/extensions.c Makefile syms
gcc $(SHARED_FLAGS) -Wl,--retain-symbols-file=syms -o $@ $(wildcard src/*.c)
src/extensions.c: src/extensions.py
PYTHONPATH=/home/psychon/projects/proto/ src/extensions.py $@ /home/psychon/projects/proto/src/*xml
tests/test: tests/test.c src/libxcb-errors.so
gcc $(TEST_FLAGS) -lxcb -Lsrc -lxcb-errors -o $@ $<
syms:
echo xcb_errors_context_new > $@
echo xcb_errors_context_free > $@
echo xcb_errors_get_name_for_major_code > $@
echo xcb_errors_get_name_for_minor_code > $@
echo xcb_errors_get_name_for_event > $@
echo xcb_errors_get_name_for_error > $@

40
Makefile.am Normal file
View file

@ -0,0 +1,40 @@
ACLOCAL_AMFLAGS = -I m4
MAINTAINERCLEANFILES = ChangeLog INSTALL Makefile.in
.PHONY: ChangeLog INSTALL
INSTALL:
$(INSTALL_CMD)
ChangeLog:
$(CHANGELOG_CMD)
dist-hook: ChangeLog INSTALL
EXTRA_DIST = autogen.sh xcb-errors.pc.in src/errors.h src/extensions.py
lib_LTLIBRARIES = libxcb-errors.la
xcbinclude_HEADERS = src/xcb_errors.h
AM_CFLAGS = $(CWARNFLAGS)
libxcb_errors_la_SOURCES = src/xcb_errors.c src/extensions.c
libxcb_errors_la_CPPFLAGS = $(XCB_CFLAGS) $(XPROTO_CFLAGS)
libxcb_errors_la_LIBADD = $(XCB_LIBS) $(XPROTO_LIBS)
libxcb_errors_la_LDFLAGS = -version-info 0:0:0 -no-undefined -export-symbols-regex '^xcb_errors_'
pkgconfig_DATA = xcb-errors.pc
TESTS = tests/test
check_PROGRAMS = tests/test
tests_test_SOURCE = tests/test.c
tests_test_CPPFLAGS = -Isrc/
tests_test_LDADD = libxcb-errors.la
CLEANFILES = src/extensions.c
src/extensions.c: src/extensions.py
$(AM_V_GEN)src/extensions.py $@.tmp ${XCBPROTO_XCBINCLUDEDIR}/*.xml && \
mv $@.tmp $@

27
autogen.sh Executable file
View file

@ -0,0 +1,27 @@
#! /bin/sh
srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
ORIGDIR=`pwd`
cd $srcdir
# If this is a git checkout, verify that the submodules are initialized,
# otherwise autotools will just fail with an unhelpful error message.
if [ -d ".git" ] && [ -r ".gitmodules" ]
then
# If git is not in PATH, this will not return 0, thus not keeping us
# from building. Since the message is worthless when git is not
# installed, this is what we want.
if git submodule status 2>/dev/null | grep -q '^-'
then
echo "You have uninitialized git submodules." >&2
echo "Please run: git submodule update --init" >&2
exit 1
fi
fi
autoreconf -v --install || exit 1
cd $ORIGDIR || exit $?
$srcdir/configure --enable-maintainer-mode "$@"

29
configure.ac Normal file
View file

@ -0,0 +1,29 @@
dnl XCB_UTIL_M4_WITH_INCLUDE_PATH requires Autoconf >= 2.62
AC_PREREQ(2.62)
AC_INIT([xcb-util-errors],0.0,[xcb@lists.freedesktop.org])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_MACRO_DIR([m4])
# Set common system defines for POSIX extensions, such as _GNU_SOURCE
# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL)
# to avoid autoconf errors.
AC_USE_SYSTEM_EXTENSIONS
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects])
AM_MAINTAINER_MODE
AC_TYPE_SSIZE_T
XCB_UTIL_M4_WITH_INCLUDE_PATH
XCB_UTIL_COMMON([1.4], [1.6])
# Checks for xcb-proto's XML files, inspired from libxcb's configure.ac
PKG_CHECK_MODULES(XCBPROTO, xcb-proto)
AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
AC_OUTPUT([Makefile
xcb-errors.pc
])

1
m4 Submodule

@ -0,0 +1 @@
Subproject commit f662e3a93ebdec3d1c9374382dcc070093a42fed

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
import sys import sys
from xml.etree.cElementTree import parse from xml.etree.cElementTree import parse

View file

@ -122,7 +122,7 @@ static int test_valid_connection(void)
return err; return err;
} }
int main() int main(void)
{ {
int err = 0; int err = 0;
err |= test_error_connection(); err |= test_error_connection();

11
xcb-errors.pc.in Normal file
View file

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: XCB errors library
Description: XCB errors utility library
Version: @PACKAGE_VERSION@
Requires: xcb
Libs: -L${libdir} -lxcb-errors @LIBS@
Cflags: -I${includedir}