summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>2015-03-25 10:30:27 +0100
committerUli Schlachter <uli.schlachter@informatik.uni-oldenburg.de>2015-03-25 10:32:21 +0100
commit059bfdbed84a2c3e8274ca9bc99a103171cdeca5 (patch)
treef1b52ceb429d4e792460f00de8e97e42f10ac8d1
parent456a9a6f0c44bba9294ddae99e83463bef67ee95 (diff)
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>
-rw-r--r--.gitignore84
-rw-r--r--.gitmodules3
-rw-r--r--Makefile27
-rw-r--r--Makefile.am40
-rwxr-xr-xautogen.sh27
-rw-r--r--configure.ac29
m---------m40
-rwxr-xr-xsrc/extensions.py2
-rw-r--r--tests/test.c2
-rw-r--r--xcb-errors.pc.in11
10 files changed, 195 insertions, 30 deletions
diff --git a/.gitignore b/.gitignore
index 9e4cdf3..0b5282f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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
+test-driver
+test-suite.log
+test.log
+test.trs
tests/test
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..cff1b86
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "m4"]
+ path = m4
+ url = git://anongit.freedesktop.org/xcb/util-common-m4.git
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 0136815..0000000
--- a/Makefile
+++ /dev/null
@@ -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 > $@
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..4703f74
--- /dev/null
+++ b/Makefile.am
@@ -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 $@
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..afe5299
--- /dev/null
+++ b/autogen.sh
@@ -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 "$@"
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..cc2e83e
--- /dev/null
+++ b/configure.ac
@@ -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
+ ])
diff --git a/m4 b/m4
new file mode 160000
+Subproject f662e3a93ebdec3d1c9374382dcc070093a42fe
diff --git a/src/extensions.py b/src/extensions.py
index c7a1afe..c776935 100755
--- a/src/extensions.py
+++ b/src/extensions.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python
import sys
from xml.etree.cElementTree import parse
diff --git a/tests/test.c b/tests/test.c
index dcd96cc..964ce0a 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -122,7 +122,7 @@ static int test_valid_connection(void)
return err;
}
-int main()
+int main(void)
{
int err = 0;
err |= test_error_connection();
diff --git a/xcb-errors.pc.in b/xcb-errors.pc.in
new file mode 100644
index 0000000..f292712
--- /dev/null
+++ b/xcb-errors.pc.in
@@ -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}