unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* guile-cairo - patch
@ 2023-03-21  5:05 David Pirotte
  2023-03-21 16:04 ` lloda
  2023-03-24  3:19 ` David Pirotte
  0 siblings, 2 replies; 4+ messages in thread
From: David Pirotte @ 2023-03-21  5:05 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]

Hello Daniel,

Here comes 1 (attached) patch, which fixes both 'make check'
and 'make distcheck'.

Please double check, try ... and let me know or push if everything
looks good for you as well.

Thanks,
David

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-Fixing-make-check-and-make-distcheck.patch --]
[-- Type: text/x-patch, Size: 11712 bytes --]

From 1de7b5e994fd99e20849d9372963c2aadf782ed1 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
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 <wingo@pobox.com>
+# Copyright (C) 2023  David Pirotte <david@altosw.be>
 #
 # 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
 # <http://www.gnu.org/licenses/>.
 
-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 <wingo at pobox dot com>
+;; Copyright (C) 2023  David Pirotte <david@altosw.be>
 
 ;; 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 <wingo@pobox.com>
+# Copyright (C) 2023  David Pirotte <david@altosw.be>
 #
 # 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
 # <http://www.gnu.org/licenses/>.
 
-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 <wingo pobox.com>
+;; Copyright (C) 2023  David Pirotte <david@altosw.be>
 
 ;; 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 <wingo@pobox.com>
+# Copyright (C) 2023  David Pirotte <david@altosw.be>
 #
 # 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
 # <http://www.gnu.org/licenses/>.
 
-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
 # <http://www.gnu.org/licenses/>.
 
-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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: guile-cairo - patch
  2023-03-21  5:05 guile-cairo - patch David Pirotte
@ 2023-03-21 16:04 ` lloda
  2023-03-23  4:07   ` David Pirotte
  2023-03-24  3:19 ` David Pirotte
  1 sibling, 1 reply; 4+ messages in thread
From: lloda @ 2023-03-21 16:04 UTC (permalink / raw)
  To: David Pirotte; +Cc: guile-user


Hi David,

the  patch works fine on my side and fixes make check/distcheck as you describe, thank you.

However I think it's unfortunate that it requires the dynamic library path to be adjusted after installation, which is something that guile-cairo was handling before. This is a private library that is of no use except to guile-cairo itself.

I wonder if it's possible to fix your fix, so to speak, so that we don't lose that feature. After all, you're already telling Guile to find the library in different places depending on whether we're on the build environment or not.

Wdyt.

Regards

  Daniel





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: guile-cairo - patch
  2023-03-21 16:04 ` lloda
@ 2023-03-23  4:07   ` David Pirotte
  0 siblings, 0 replies; 4+ messages in thread
From: David Pirotte @ 2023-03-23  4:07 UTC (permalink / raw)
  To: lloda; +Cc: guile-user

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

Hi Daniel,

> the  patch works fine on my side and fixes make check/distcheck as
> you describe, thank you.

Ok, great.

> However I think it's unfortunate that it requires the dynamic library
> path to be adjusted after installation, which is something that
> guile-cairo was handling before. This is a private library that is of
> no use except to guile-cairo itself.

The patch 'removed' the hard coded 'full path' of the lib set at
configure/make time, which i think is a good thing - and it indeed
install the lib in $prefix/lib - which is, imo, unless a configure
option allows 'another location', the right thing to do - but,
see below ...

> I wonder if it's possible to fix your fix, so to speak, so that we
> don't lose that feature. After all, you're already telling Guile to
> find the library in different places depending on whether we're on
> the build environment or not.

> Wdyt.

It is possible, with a bit of work, to install the lib in the
GUILE_EXTENSION directory [provided by guile.m4], but be able to look
into this in the 'immediate near future' - feel free to patch the patch
of course.

Regards,
David

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: guile-cairo - patch
  2023-03-21  5:05 guile-cairo - patch David Pirotte
  2023-03-21 16:04 ` lloda
@ 2023-03-24  3:19 ` David Pirotte
  1 sibling, 0 replies; 4+ messages in thread
From: David Pirotte @ 2023-03-24  3:19 UTC (permalink / raw)
  To: guile-user


[-- Attachment #1.1: Type: text/plain, Size: 965 bytes --]

Hello Daniel,

> Here comes 1 (attached) patch, which fixes both 'make check'
> and 'make distcheck'.
> ...

Here is another patch, to be applied after the previous one, see the
commit log ... [1]

David

[1]	a bit more on this ...

1-

This patch removes the call to m4_esyscmd, which itself called
build-aux/git-version-gen which i removed from the EXTRA_DIST target in
the previous patch.

2-

Speaking about version, you might consider - I won't do that myself, as
I can't regenerate, hence I can't fully check - to update the
doc/guile-cairo.texi file to call

		@include version.texi

... instead of manually set VERSION and UPDATED  because when automake
detect the above, it generates the version.texi file which contains the
above and more ... and then as a dev, you'd have one and only one
location to take care of when updating the version - s/w wise, we still
have to manually update the NEW file [and the web-pages (?)]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0002-Build-review-configure.ac.patch --]
[-- Type: text/x-patch, Size: 1554 bytes --]

From 5d701e9d16add264cc8dc1f4b17fc5e5c1029201 Mon Sep 17 00:00:00 2001
From: David Pirotte <david@altosw.be>
Date: Thu, 23 Mar 2023 23:34:28 -0300
Subject: [PATCH 2/2] Build review - configure.ac

* configure.ac: Manually set the version in the AC_INIT call. Removing
  the AC_SUBST(VERSION, x.y.z) call, it is generated.
---
 configure.ac | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 274d825..27aa373 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ define(GUILE_CAIRO_CONFIGURE_COPYRIGHT,[[
 Copyright (C) 2007, 2011-2012, 2014, 2017, 2020 Andy Wingo <wingo@pobox.com>
 Copyright (C) 2011 Patrick Bernaud <patrickb@chez.com>
 Copyright (C) 2018 Daniel Llorens <daniel.llorens@bluewin.ch>
-Copyright (C) 2018 David Pirotte <david@altosw.be>
+Copyright (C) 2018, 2023 David Pirotte <david@altosw.be>
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as
@@ -24,7 +24,7 @@ License along with this program.  If not, see
 AC_PREREQ(2.52)
 
 AC_INIT([guile-cairo],
-        m4_esyscmd([build-aux/git-version-gen --match v1.11.2\* .tarball-version]),
+        [1.12.0],
         [guile-user@gnu.org])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
@@ -37,7 +37,6 @@ AM_INIT_AUTOMAKE([1.14 gnu -Wno-portability -Wno-syntax \
 AM_MAINTAINER_MODE([enable])
 AM_SILENT_RULES([yes])
 
-AC_SUBST(VERSION, 1.12.0)
 
 AC_ISC_POSIX
 AC_PROG_CC
-- 
2.39.2


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-03-24  3:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21  5:05 guile-cairo - patch David Pirotte
2023-03-21 16:04 ` lloda
2023-03-23  4:07   ` David Pirotte
2023-03-24  3:19 ` David Pirotte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).