From 1de7b5e994fd99e20849d9372963c2aadf782ed1 Mon Sep 17 00:00:00 2001 From: David Pirotte Date: Tue, 21 Mar 2023 01:54:04 -0300 Subject: [PATCH] Fixing make check and make distcheck Notes: the main goal of this patch is to remove the hard coded libguile-cairo path, which makes it impossible to run 'make check', unless you actualy first install the version you are working on/checking [which is 'none sense']. Also, even with the above problem fixed, there were still a few nitpick things to solve so that make distcheck pass. Finally, while workig on this patch, I also made a few cosmetic changes, mostly adding a space before and after '=' in Makefile.am targets, as well as having each filename on its own line for targets that requires filenames. Those changes are not commented here below. * Makefile.am: (1) removing the env target, as we update env.in this is not only not necessary anymore, but would actually raise an error; (2) the CLEANFILES target misses $(GOBJECTS); (3) using $(AM_V_GEN) in .scm.go target; (4) the EXTRA_DIST target misses $(SOURCES), and does not need to ship autogen.sh nor build-aux/git-version-gen. * cairo.scm: Call (dynamic-link "libguile-cairo"), not (dynamic-link *cairo-lib-path*). * cairo/Makefile.am: (1) using $(AM_V_GEN) in .scm.go target; (2) in the config.scm target, removing the @cairolibpath@ substitution; (3) the EXTRA_DIST target misses vector-types.scm and $(NOCOMP_SOURCES). * cairo/config.scm.in: Removing the *cairo-lib-path* definition. * env.in: (1) define and use abs_top_srcdir and abs_top_builddir; (2) define and export GUILE_LOAD_PATH, GUILE_LOAD_COMPILED_PATH and LTDL_LIBRARY_PATH. * tests/unit-tests/Makefile.am: (1) add context-pointer.scm to the TESTS target; (2) add a TEST_EXTENSIONS = .scm target; (3) update the TESTS_ENVIRONMENT to use $(abs_top_builddir); (4) remove the %.check target (unecessary in 'modern' autotools). --- Makefile.am | 26 ++++++++----- cairo.scm | 4 +- cairo/Makefile.am | 30 ++++++++++----- cairo/config.scm.in | 8 ++-- env.in | 75 +++++++++++++++++++++++++++++++++--- tests/unit-tests/Makefile.am | 21 +++++----- 6 files changed, 125 insertions(+), 39 deletions(-) diff --git a/Makefile.am b/Makefile.am index 82e41b2..514b758 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,6 @@ # guile-cairo # Copyright (C) 2007,2011 Andy Wingo +# Copyright (C) 2023 David Pirotte # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -15,18 +16,20 @@ # License along with this program. If not, see # . -SUBDIRS = guile-cairo cairo examples tests doc - -env: Makefile env.in - sed -e "s|@top_srcdir\@|$(shell cd $(top_srcdir) && pwd)|" \ - $(srcdir)/env.in > env - chmod +x env +SUBDIRS = \ + guile-cairo \ + cairo \ + examples \ + tests \ + doc BUILT_SOURCES = env ACLOCAL_AMFLAGS = -I m4 -CLEANFILES = env +CLEANFILES = \ + env \ + $(GOBJECTS) GOBJECTS = $(SOURCES:%.scm=%.go) @@ -39,7 +42,8 @@ nobase_nodist_obj_DATA = $(GOBJECTS) GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat SUFFIXES = .scm .go .scm.go: - $(top_builddir)/env $(GUILD) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<" + $(AM_V_GEN) $(top_builddir)/env \ + $(GUILD) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<" SOURCES = cairo.scm @@ -58,4 +62,8 @@ gen-ChangeLog: mv $(distdir)/cl-t $(distdir)/ChangeLog; \ fi -EXTRA_DIST = env.in autogen.sh build-aux/git-version-gen HACKING COPYING.LESSER $(scm_DATA) +EXTRA_DIST = \ + env.in \ + HACKING \ + COPYING.LESSER \ + $(SOURCES) diff --git a/cairo.scm b/cairo.scm index 1361d85..2cb2793 100644 --- a/cairo.scm +++ b/cairo.scm @@ -1,5 +1,6 @@ ;; guile-cairo ;; Copyright (C) 2007, 2011 Andy Wingo +;; Copyright (C) 2023 David Pirotte ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU Lesser General Public License as @@ -31,9 +32,10 @@ (module-use! (module-public-interface (current-module)) (resolve-interface '(cairo vector-types))) + ;; This will export many things (dynamic-call "scm_init_cairo" - (dynamic-link *cairo-lib-path*)) + (dynamic-link "libguile-cairo")) (if (not (member *cairo-documentation-path* documentation-files)) (set! documentation-files (cons *cairo-documentation-path* diff --git a/cairo/Makefile.am b/cairo/Makefile.am index 05b5973..0299d34 100644 --- a/cairo/Makefile.am +++ b/cairo/Makefile.am @@ -1,5 +1,6 @@ # guile-cairo # Copyright (C) 2007,2011 Andy Wingo +# Copyright (C) 2023 David Pirotte # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -15,11 +16,15 @@ # License along with this program. If not, see # . -moddir=$(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)/cairo -objdir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache/cairo +moddir = $(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)/cairo +objdir = $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache/cairo -SOURCES = config.scm vector-types.scm -NOCOMP_SOURCES = cairo-procedures.txt +SOURCES = \ + config.scm \ + vector-types.scm + +NOCOMP_SOURCES = \ + cairo-procedures.txt GOBJECTS = $(SOURCES:%.scm=%.go) @@ -29,12 +34,12 @@ nobase_nodist_obj_DATA = $(GOBJECTS) GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat SUFFIXES = .scm .go .scm.go: - $(top_builddir)/env $(GUILD) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<" + $(AM_V_GEN) $(top_builddir)/env \ + $(GUILD) compile $(GUILE_TARGET) $(GUILE_WARNINGS) -o "$@" "$<" config.scm: Makefile config.scm.in - sed -e "s|@cairolibpath\@|$(libdir)/libguile-cairo|" \ - -e "s|@cairodocumentationpath\@|$(moddir)/cairo-procedures.txt|" \ - $(srcdir)/config.scm.in > config.scm + sed -e "s|\@cairodocumentationpath\@|$(moddir)/cairo-procedures.txt|" \ + $(srcdir)/config.scm.in > config.scm cairo-procedures.txt.update: echo "Generated from upstream documentation; see COPYING.docs for info." \ @@ -42,6 +47,11 @@ cairo-procedures.txt.update: $(top_srcdir)/doc/docbook-to-guile-doc $(CAIRO_XML_DIR)/*.xml \ >> $(srcdir)/cairo-procedures.txt -CLEANFILES = config.scm $(GOBJECTS) +CLEANFILES = \ + config.scm \ + $(GOBJECTS) -EXTRA_DIST = config.scm.in +EXTRA_DIST = \ + config.scm.in \ + vector-types.scm \ + $(NOCOMP_SOURCES) diff --git a/cairo/config.scm.in b/cairo/config.scm.in index ab008fb..92895b9 100644 --- a/cairo/config.scm.in +++ b/cairo/config.scm.in @@ -1,5 +1,6 @@ ;; guile-cairo ;; Copyright (C) 2007, 2011 Andy Wingo +;; Copyright (C) 2023 David Pirotte ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU Lesser General Public License as @@ -22,8 +23,7 @@ ;;; Code: (define-module (cairo config) - :export (*cairo-lib-path* - *cairo-documentation-path*)) + :export (*cairo-documentation-path*)) -(define *cairo-lib-path* "@cairolibpath@") -(define *cairo-documentation-path* "@cairodocumentationpath@") +(define *cairo-documentation-path* + "@cairodocumentationpath@") diff --git a/env.in b/env.in index eb9d020..e93d212 100644 --- a/env.in +++ b/env.in @@ -2,6 +2,7 @@ # guile-cairo # Copyright (C) 2007,2011 Andy Wingo +# Copyright (C) 2023 David Pirotte # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as @@ -17,15 +18,77 @@ # License along with this program. If not, see # . -this_dir=$(cd $(dirname $0) && pwd) -src_dir="@top_srcdir@" -if [ "$src_dir" != "$this_dir" ]; then - GUILE_LOAD_PATH=$src_dir/$pkg:$this_dir/$pkg:$GUILE_LOAD_PATH +abs_top_srcdir="@abs_top_srcdir@" +abs_top_builddir="@abs_top_builddir@" + +[ x"$abs_top_srcdir" = x -o ! -d "$abs_top_srcdir" -o \ + x"$abs_top_builddir" = x -o ! -d "$abs_top_builddir" ] && { + echo $0: bad environment + echo abs_top_srcdir=$abs_top_srcdir + echo abs_top_builddir=$abs_top_builddir + exit 1 +} + + +### +### GUILE_LOAD_PATH +### + +if [ x"$GUILE_LOAD_PATH" = x ] +then + GUILE_LOAD_PATH="${abs_top_srcdir}" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + GUILE_LOAD_PATH="${abs_top_builddir}:$GUILE_LOAD_PATH" + fi else - GUILE_LOAD_PATH=$this_dir/$pkg:$GUILE_LOAD_PATH + GUILE_LOAD_PATH="${abs_top_srcdir}:$GUILE_LOAD_PATH" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + GUILE_LOAD_PATH="${abs_top_builddir}:$GUILE_LOAD_PATH" + fi fi - +## echo $GUILE_LOAD_PATH export GUILE_LOAD_PATH + +### +### GUILE_LOAD_COMPILED_PATH +### + +if [ x"$GUILE_LOAD_COMPILED_PATH" = x ] +then + GUILE_LOAD_COMPILED_PATH="${abs_top_srcdir}" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + GUILE_LOAD_COMPILED_PATH="${abs_top_builddir}:$GUILE_LOAD_COMPILED_PATH" + fi +else + GUILE_LOAD_COMPILED_PATH="${abs_top_srcdir}:$GUILE_LOAD_COMPILED_PATH" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + GUILE_LOAD_COMPILED_PATH="${abs_top_builddir}:$GUILE_LOAD_COMPILED_PATH" + fi +fi + +## echo $GUILE_LOAD_COMPILED_PATH +export GUILE_LOAD_COMPILED_PATH + + +### +### LTDL_LIBRARY_PATH +### + +if [ x"$LTDL_LIBRARY_PATH" = x ] +then + LTDL_LIBRARY_PATH="${abs_top_srcdir}/guile-cairo:${abs_top_srcdir}/guile-cairo/.libs" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + LTDL_LIBRARY_PATH="${abs_top_builddir}/guile-cairo:${abs_top_builddir}/guile-cairo/.libs:$LTDL_LIBRARY_PATH" + fi +else + LTDL_LIBRARY_PATH="${abs_top_srcdir}/guile-cairo:${abs_top_srcdir}/guile-cairo/.libs:$LTDL_LIBRARY_PATH" + if test "${abs_top_srcdir}" != "${abs_top_builddir}"; then + LTDL_LIBRARY_PATH="${abs_top_builddir}/guile-cairo:${abs_top_builddir}/guile-cairo/.libs:$LTDL_LIBRARY_PATH" + fi +fi +## echo $LTDL_LIBRARY_PATH +export LTDL_LIBRARY_PATH + exec "$@" diff --git a/tests/unit-tests/Makefile.am b/tests/unit-tests/Makefile.am index 3ba6af9..9b13bbd 100644 --- a/tests/unit-tests/Makefile.am +++ b/tests/unit-tests/Makefile.am @@ -16,18 +16,21 @@ # License along with this program. If not, see # . -TESTS= \ - context-pointer.scm \ +TESTS = \ api-stability.scm \ + context-pointer.scm \ version.scm -TESTS_ENVIRONMENT=\ - API_FILE=$(srcdir)/cairo.api $(top_builddir)/env guile -s +TEST_EXTENSIONS = .scm -%.api.update: - $(top_builddir)/env $(srcdir)/update-api $(subst ., ,$*) > $(srcdir)/$*.api +TESTS_ENVIRONMENT = \ + API_FILE=$(srcdir)/cairo.api \ + $(abs_top_builddir)/env $(GUILE) --no-auto-compile -%.check: % - $(TESTS_ENVIRONMENT) $* +%.api.update: + $(abs_top_builddir)/env \ + $(srcdir)/update-api $(subst ., ,$*) > $(srcdir)/$*.api -EXTRA_DIST=$(TESTS) cairo.api +EXTRA_DIST = \ + $(TESTS) \ + cairo.api -- 2.39.2