diff --git a/.travis/before_install.sh b/.travis/before_install.sh index f6ab0ba..1a41217 100755 --- a/.travis/before_install.sh +++ b/.travis/before_install.sh @@ -2,6 +2,6 @@ if brew --version 2>/dev/null 2>&1; then # FIXME: no ncurses formula for now; also add ruby - brew install slang doxygen + brew install slang doxygen fi diff --git a/Makefile.am b/Makefile.am index 29bd893..585ce7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + SUBDIRS = kernel caca src examples tools \ cxx caca-sharp python ruby java doc DIST_SUBDIRS = $(SUBDIRS) win32 diff --git a/build/autotools/common.am b/build/autotools/common.am new file mode 100644 index 0000000..4ef6181 --- /dev/null +++ b/build/autotools/common.am @@ -0,0 +1,6 @@ + +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I$(top_builddir)/caca + +echo-topdir: ; echo $(top_srcdir) +echo-sources: ; echo $(SOURCES) $(EXTRA_CHECKS) + diff --git a/caca-sharp/Makefile.am b/caca-sharp/Makefile.am index 970ccb3..bb64d65 100644 --- a/caca-sharp/Makefile.am +++ b/caca-sharp/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + # We need to install the .config file ourselves because of a gacutil # bug (https://bugzilla.novell.com/show_bug.cgi?id=363341) monodir = $(libdir)/mono/caca-sharp-0.0 diff --git a/caca/Makefile.am b/caca/Makefile.am index 69fde09..96a5b2d 100644 --- a/caca/Makefile.am +++ b/caca/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + SUBDIRS = . t EXTRA_DIST = caca.pc.in \ @@ -6,7 +8,7 @@ EXTRA_DIST = caca.pc.in \ libcaca.vcxproj libcaca.def DISTCLEANFILES = caca.pc -AM_CPPFLAGS = -I$(top_srcdir) -DPLUGINDIR=\"$(plugindir)\" +AM_CPPFLAGS += -DPLUGINDIR=\"$(plugindir)\" pkgconfig_DATA = caca.pc pkgconfigdir = $(libdir)/pkgconfig @@ -108,5 +110,3 @@ if USE_COCOA driver_source += driver/cocoa.m endif -echo-sources: ; echo $(SOURCES) - diff --git a/caca/t/Makefile.am b/caca/t/Makefile.am index 63443fb..ea78dac 100644 --- a/caca/t/Makefile.am +++ b/caca/t/Makefile.am @@ -1,5 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I.. +include $(top_srcdir)/build/autotools/common.am if USE_CPPUNIT cppunit_tests = caca-test diff --git a/caca/t/check-copyright b/caca/t/check-copyright index 9c4b58c..2cf25d6 100755 --- a/caca/t/check-copyright +++ b/caca/t/check-copyright @@ -1,27 +1,30 @@ #!/bin/sh +export MAKEFLAGS="" +top_srcdir="$(make -s echo-topdir)" + # # Check that the copyright information is valid # nfails=0 nfiles=0 -for dir in $(make -s echo-dirs -C ..); do - if [ ! -d "../$dir" ]; then continue; fi - for x in $(make -s echo-sources -C ../$dir); do +for dir in $(make -s echo-dirs -C "${top_srcdir}"); do + if [ ! -d "${top_srcdir}/${dir}" ]; then continue; fi + for x in $(make -s echo-sources -C "${top_srcdir}/${dir}"); do case "$x" in *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl) nfiles=$(($nfiles + 1)) ;; *) continue ;; esac - if ! grep 'Copyright *([cC])' "../$dir/$x" >/dev/null 2>&1; then - echo "error: $dir/$x lacks proper copyright information" + if ! grep 'Copyright *([cC])' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then + echo "error: ${dir}/$x lacks proper copyright information" nfails=$(($nfails + 1)) - elif [ -d ../.git ]; then - Y="$(git log "../$dir/$x" | head -n 3 | sed -ne 's/^Date.* \([0-9][0-9][0-9][0-9]\) .*/\1/p')" + elif [ -d ../../.git ]; then + Y="$(git log "${top_srcdir}/${dir}/$x" | head -n 3 | sed -ne 's/^Date.* \([0-9][0-9][0-9][0-9]\) .*/\1/p')" if [ "$Y" != "" ]; then - if ! grep "$Y.*@" "../$dir/$x" >/dev/null 2>&1; then - echo "error: $dir/$x last modified in $Y, which is not in copyright" + if ! grep "$Y.*@" "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then + echo "error: ${dir}/$x last modified in $Y, which is not in copyright" nfails=$(($nfails + 1)) fi fi diff --git a/caca/t/check-doxygen b/caca/t/check-doxygen index d9ccd75..69dcd2d 100755 --- a/caca/t/check-doxygen +++ b/caca/t/check-doxygen @@ -1,11 +1,14 @@ #!/bin/sh +export MAKEFLAGS="" +top_srcdir="$(make -s echo-topdir 2>/dev/null)" + # # Check for Doxygen warnings # -nfiles="$(grep -c "Parsing file" < ../../doc/doxygen.log)" -if nfails="$(grep -c Warning: ../../doc/doxygen.log 2>/dev/null)"; then - grep Warning: ../../doc/doxygen.log | sed 's/\(.\{75\}\)...*/\1 .../' +nfiles="$(grep -c "Parsing file" < "${top_srcdir}/doc/doxygen.log")" +if nfails="$(grep -c Warning: "${top_srcdir}/doc/doxygen.log" 2>/dev/null)"; then + grep Warning: "${top_srcdir}/doc/doxygen.log" | sed 's/\(.\{75\}\)...*/\1 .../' fi echo "$nfiles files, $nfails visible errors in documentation" diff --git a/caca/t/check-source b/caca/t/check-source index 1466225..2c9612c 100755 --- a/caca/t/check-source +++ b/caca/t/check-source @@ -1,27 +1,30 @@ #!/bin/sh +export MAKEFLAGS="" +top_srcdir="$(make -s echo-topdir)" + # # Check that we have no tabs or trailing spaces in the source code # nfails=0 nfiles=0 nlines=0 -for dir in $(make -s echo-dirs -C ..); do - if [ ! -d "../$dir" ]; then continue; fi - for x in $(make -s echo-sources -C ../$dir); do +for dir in $(make -s echo-dirs -C "${top_srcdir}"); do + if [ ! -d "${top_srcdir}/${dir}" ]; then continue; fi + for x in $(make -s echo-sources -C "${top_srcdir}/${dir}"); do case "$x" in *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|*.py|*.pl) nfiles=$(($nfiles + 1)); - nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;; + nlines=$(($nlines + `grep -c . "${top_srcdir}/${dir}/$x"`)) ;; *) continue ;; esac - if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then - echo "error: $dir/$x contains trailing spaces" + if grep '[[:space:]]$' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then + echo "error: ${dir}/$x contains trailing spaces" nfails=$(($nfails + 1)) fi - if grep ' ' "../$dir/$x" >/dev/null 2>&1; then - echo "error: $dir/$x contains tabs" + if grep ' ' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then + echo "error: ${dir}/$x contains tabs" nfails=$(($nfails + 1)) fi done diff --git a/caca/t/check-win32 b/caca/t/check-win32 index 27c041b..1cc7639 100755 --- a/caca/t/check-win32 +++ b/caca/t/check-win32 @@ -1,13 +1,14 @@ #!/bin/sh -ret=0 +export MAKEFLAGS="" +top_srcdir="$(make -s echo-topdir)" # # Check that the Win32 config.h is in sync with config.h.in # -config_h_in=$(dirname "$0")/../config.h.in -win32_config_h=$(dirname "$0")/../win32/config.h +config_h_in="${top_srcdir}/config.h.in" +win32_config_h="${top_srcdir}/win32/config.h" nfails=0 ntokens=0 diff --git a/cxx/Makefile.am b/cxx/Makefile.am index af19a6f..2a2def7 100644 --- a/cxx/Makefile.am +++ b/cxx/Makefile.am @@ -1,5 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca +include $(top_srcdir)/build/autotools/common.am EXTRA_DIST = libcaca++.vcxproj libcaca++.def test-cxx.vcxproj if USE_CXX @@ -31,5 +31,3 @@ uninstall-local: rm -f $(DESTDIR)$(pkgconfigdir)/cucul++.pc rmdir $(DESTDIR)$(pkgconfigdir) 2>/dev/null || true -echo-sources: ; echo $(SOURCES) - diff --git a/doc/Makefile.am b/doc/Makefile.am index 5598ce3..0b58c76 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + EXTRA_DIST = doxygen.cfg.in doxygen.css footer.html header.html \ $(man_MANS) $(doxygen_DOX) CLEANFILES = doxygen.log stamp-latex stamp-doxygen diff --git a/examples/Makefile.am b/examples/Makefile.am index 2aff95c..0e8122e 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,5 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I$(top_builddir)/caca +include $(top_srcdir)/build/autotools/common.am noinst_PROGRAMS = trifiller blit canvas colors conio $(conio_snake) demo demo0 dithering driver event export figfont font font2tga frames fullwidth gamma hsv input spritedit swallow text transform truecolor unicode import mouse @@ -96,5 +96,3 @@ import_LDADD = ../caca/libcaca.la mouse_SOURCES = mouse.c mouse_LDADD = ../caca/libcaca.la -echo-sources: ; echo $(SOURCES) - diff --git a/java/Makefile.am b/java/Makefile.am index 9213794..aa399c1 100644 --- a/java/Makefile.am +++ b/java/Makefile.am @@ -1,9 +1,9 @@ +include $(top_srcdir)/build/autotools/common.am + jnidir = $(libdir)/jni libcaca_javadir = $(datadir)/java -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca - java_jar = libjava.jar if USE_JAVA diff --git a/kernel/Makefile.am b/kernel/Makefile.am index 18fd635..87d295a 100644 --- a/kernel/Makefile.am +++ b/kernel/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + EXTRA_DIST = bootsect.S lib_LTLIBRARIES = $(libkernel_la) @@ -13,11 +15,8 @@ libkernel_la_SOURCES = \ multiboot.h \ $(NULL) libkernel_la_LDFLAGS = -no-undefined -AM_CPPFLAGS = -I$(top_srcdir) clean: clean-local clean-local: rm -f bootsect.bin kern.bin kernel.map -echo-sources: ; echo $(SOURCES) - diff --git a/python/Makefile.am b/python/Makefile.am index 634f904..ae88229 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + if USE_PYTHON cacadir = $(pythondir)/caca caca_PYTHON = \ @@ -8,6 +10,7 @@ caca_PYTHON = \ caca/display.py \ caca/dither.py \ caca/font.py +EXTRA_CHECKS = $(caca_PYTHON) endif EXTRA_DIST = \ @@ -24,5 +27,3 @@ EXTRA_DIST = \ examples/gol.py \ examples/text.py -echo-sources: ; echo $(caca_PYTHON) - diff --git a/ruby/Makefile.am b/ruby/Makefile.am index 680418e..0c5f8a0 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -1,4 +1,6 @@ +include $(top_srcdir)/build/autotools/common.am + rubylibdir = $(RUBY_SITEARCHDIR) rubysitedir = $(RUBY_SITELIBDIR) @@ -38,5 +40,3 @@ EXTRA_DIST = ruby.dox \ README \ $(NULL) -echo-sources: ; echo $(SOURCES) - diff --git a/src/Makefile.am b/src/Makefile.am index 4fb5a94..5f0b22f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,9 +1,10 @@ +include $(top_srcdir)/build/autotools/common.am + pkgdata_DATA = caca.txt EXTRA_DIST = caca.txt cacademo.vcxproj cacafire.vcxproj cacaview.vcxproj -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca \ - -DLIBCACA=1 -DX_DISPLAY_MISSING=1 +AM_CPPFLAGS += -DLIBCACA=1 -DX_DISPLAY_MISSING=1 bin_PROGRAMS = cacademo cacafire cacaplay cacaview img2txt cacaclock $(fcntl_programs) noinst_PROGRAMS = cacadraw @@ -44,5 +45,3 @@ else fcntl_programs = endif -echo-sources: ; echo $(SOURCES) - diff --git a/tools/Makefile.am b/tools/Makefile.am index 569e481..5090e5b 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,6 +1,5 @@ -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/caca -I../caca \ - -I$(top_srcdir)/caca +include $(top_srcdir)/build/autotools/common.am noinst_PROGRAMS = optipal sortchars $(pango_programs) @@ -20,5 +19,3 @@ else pango_programs = endif -echo-sources: ; echo $(SOURCES) - diff --git a/win32/Makefile.am b/win32/Makefile.am index 00cfe3b..15d62c7 100644 --- a/win32/Makefile.am +++ b/win32/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/build/autotools/common.am + EXTRA_DIST = config.h