summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2018-08-22 06:49:59 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-08-22 08:23:16 (GMT)
commitf92dfd663dc50d9aac704c8df5ca48f5e35b8571 (patch) (side-by-side diff)
tree48542f3bb6c0961db678cad49c0ce94d70793f6d
parent6abb2548315b9db2925194e54f09f01126182f81 (diff)
downloadgamma-f92dfd663dc50d9aac704c8df5ca48f5e35b8571.tar.gz
gamma-f92dfd663dc50d9aac704c8df5ca48f5e35b8571.tar.bz2
Change library loading algorithm.
If the environment variable LD_LIBRARY_PATH is set, the loadable modules are first looked up in the directories listed in that variable, and then in the extension installation directory. Two attempts are made for each directory: first the library name with the -v-VERSION suffix is tried, then the library name without that suffix. * src: Rename to gamma * Makefile.am (SUBDIRS): Update. * configure.ac: Update. * scripts/bootstrap (srcdir, makefile): Update. * gamma/loader.sci: New file. * gamma/Makefile.am: Build loader.scm * src/sql.sci: Remove. * gamma/sql.scm: New file. * modules/sql (scm): Update. * src/syslog.sci: Remove. * gamma/syslog.scm: New file. * modules/syslog (scm): Update. * src/expat.sci: Remove. * gamma/expat.scm: New file. * modules/expat (scm): Update.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac6
-rw-r--r--gamma/.gitignore (renamed from src/.gitignore)4
-rw-r--r--gamma/Makefile.am (renamed from src/Makefile.am)4
-rw-r--r--gamma/app.h (renamed from src/app.h)0
-rw-r--r--gamma/documentation.sci (renamed from src/documentation.sci)0
-rw-r--r--gamma/eval.c (renamed from src/eval.c)0
-rw-r--r--gamma/expat.scm (renamed from src/expat.sci)12
-rw-r--r--gamma/gamma-expat.c (renamed from src/gamma-expat.c)0
-rw-r--r--gamma/gamma-expat.h (renamed from src/gamma-expat.h)0
-rw-r--r--gamma/gsql_conn.c (renamed from src/gsql_conn.c)0
-rw-r--r--gamma/gsql_lib.c (renamed from src/gsql_lib.c)0
-rw-r--r--gamma/guile-sql.h (renamed from src/guile-sql.h)0
-rw-r--r--gamma/loader.sci (copied from src/syslog.sci)28
-rw-r--r--gamma/mysql.c (renamed from src/mysql.c)0
-rw-r--r--gamma/pgsql.c (renamed from src/pgsql.c)0
-rw-r--r--gamma/sql.scm (renamed from src/sql.sci)12
-rw-r--r--gamma/syslog-port.c (renamed from src/syslog-port.c)11
-rw-r--r--gamma/syslog.c (renamed from src/syslog.c)0
-rw-r--r--gamma/syslog.scm (renamed from src/syslog.sci)11
-rw-r--r--modules/expat3
-rw-r--r--modules/sql4
-rw-r--r--modules/syslog4
-rwxr-xr-xscripts/bootstrap6
25 files changed, 48 insertions, 63 deletions
diff --git a/.gitignore b/.gitignore
index 1dacbdf..9ca6bfe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,8 @@
*.o
*.tar.*
*~
+\#*#
+.#*
.deps
.emacs*
.gdbinit
diff --git a/Makefile.am b/Makefile.am
index da83ed3..bae94f7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of Gamma.
-# Copyright (C) 2002, 2007, 2010 Sergey Poznyakoff
+# Copyright (C) 2002-2018 Sergey Poznyakoff
#
# Gamma is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
ACLOCAL_AMFLAGS = -I m4 -I am -I gint
-SUBDIRS = gint src scripts examples doc
+SUBDIRS = gint gamma scripts examples doc
# Define the following variables in order to use the ChangeLog rule below:
# prev_change_log [optional] Name of the previous ChangeLog file.
diff --git a/configure.ac b/configure.ac
index 0695551..5ad8cf3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
dnl This file is part of Gamma
-dnl Copyright (C) 2002, 2004, 2007, 2010, 2015 Sergey Poznyakoff
+dnl Copyright (C) 2002-2018 Sergey Poznyakoff
dnl
dnl Gamma is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@ dnl along with Gamma. If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ(2.63)
AC_INIT(gamma, [2.0], [gray+gamma@gnu.org.ua])
-AC_CONFIG_SRCDIR(src/guile-sql.h)
+AC_CONFIG_SRCDIR(gamma/guile-sql.h)
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
@@ -96,7 +96,7 @@ fi
AC_CONFIG_FILES(Makefile
gint/Makefile
- src/Makefile
+ gamma/Makefile
scripts/Makefile
examples/Makefile
doc/Makefile)
diff --git a/src/.gitignore b/gamma/.gitignore
index d819308..2c200e2 100644
--- a/src/.gitignore
+++ b/gamma/.gitignore
@@ -7,7 +7,5 @@
guile-procedures.txt
guile-procedures.texi
documentation.scm
-sql.scm
-syslog.scm
+loader.scm
modules.mk
-expat.scm
diff --git a/src/Makefile.am b/gamma/Makefile.am
index c5caa7f..34df836 100644
--- a/src/Makefile.am
+++ b/gamma/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of Gamma.
-# Copyright (C) 2002, 2007, 2010, 2015 Sergey Poznyakoff
+# Copyright (C) 2002-2018 Sergey Poznyakoff
#
# Gamma is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,6 +28,8 @@ install-data-hook: @GAMMA_INSTALL_HOOKS@
MAINTAINERCLEANFILES=
include modules.mk
+EXTRA_DIST += loader.sci
+GAMMA_BUILT_DATA_FILES += loader.scm
sitedir=$(GUILE_SITE)/$(PACKAGE)
site_DATA=$(GAMMA_BUILT_DATA_FILES) documentation.scm
diff --git a/src/app.h b/gamma/app.h
index e46ed2a..e46ed2a 100644
--- a/src/app.h
+++ b/gamma/app.h
diff --git a/src/documentation.sci b/gamma/documentation.sci
index 809a6bf..809a6bf 100644
--- a/src/documentation.sci
+++ b/gamma/documentation.sci
diff --git a/src/eval.c b/gamma/eval.c
index 1702ea0..1702ea0 100644
--- a/src/eval.c
+++ b/gamma/eval.c
diff --git a/src/expat.sci b/gamma/expat.scm
index 19e48fe..af49002 100644
--- a/src/expat.sci
+++ b/gamma/expat.scm
@@ -1,5 +1,5 @@
;;;; This file is part of Gamma. -*- scheme -*-
-;;;; Copyright (C) 2010, 2015 Sergey Poznyakoff
+;;;; Copyright (C) 2010-2018 Sergey Poznyakoff
;;;;
;;;; Gamma is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -14,11 +14,10 @@
;;;; You should have received a copy of the GNU General Public License
;;;; along with Gamma. If not, see <http://www.gnu.org/licenses/>.
-changequote([,])dnl
-
(define-module (gamma expat)
:use-module (ice-9 rdelim)
:use-module (gamma documentation)
+ :use-module (gamma loader)
:use-module (srfi srfi-1)
:export (xml-make-parser
xml-parse-more
@@ -26,12 +25,7 @@ changequote([,])dnl
xml-set-handler)
:export-syntax (xml-error-descr))
-(if (= (string->number (major-version)) 1)
- (use-syntax (ice-9 syncase)))
-
-(let ((lib-path "LIBDIR/"))
- (load-extension (string-append
- lib-path "libgamma-expat-v-VERSION") "gamma_expat_init"))
+(gamma-module-load "expat" "gamma_expat_init")
(define (xml-make-parser . rest)
(if (null? rest)
diff --git a/src/gamma-expat.c b/gamma/gamma-expat.c
index cd3efaa..cd3efaa 100644
--- a/src/gamma-expat.c
+++ b/gamma/gamma-expat.c
diff --git a/src/gamma-expat.h b/gamma/gamma-expat.h
index 2376e4a..2376e4a 100644
--- a/src/gamma-expat.h
+++ b/gamma/gamma-expat.h
diff --git a/src/gsql_conn.c b/gamma/gsql_conn.c
index 64cec27..64cec27 100644
--- a/src/gsql_conn.c
+++ b/gamma/gsql_conn.c
diff --git a/src/gsql_lib.c b/gamma/gsql_lib.c
index 7972595..7972595 100644
--- a/src/gsql_lib.c
+++ b/gamma/gsql_lib.c
diff --git a/src/guile-sql.h b/gamma/guile-sql.h
index f656fd4..f656fd4 100644
--- a/src/guile-sql.h
+++ b/gamma/guile-sql.h
diff --git a/src/syslog.sci b/gamma/loader.sci
index 317dd6f..c165282 100644
--- a/src/syslog.sci
+++ b/gamma/loader.sci
@@ -1,5 +1,5 @@
;;;; This file is part of Gamma. -*- scheme -*-
-;;;; Copyright (C) 2010 Sergey Poznyakoff
+;;;; Copyright (C) 2018 Sergey Poznyakoff
;;;;
;;;; Gamma is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -15,12 +15,24 @@
;;;; along with Gamma. If not, see <http://www.gnu.org/licenses/>.
changequote([,])dnl
+(define-module (gamma loader))
-(define-module (gamma syslog)
- :use-module (gamma documentation))
+(define-public (gamma-module-load name init)
+ (call/cc
+ (lambda (return)
+ (do ((lib-path (parse-path (getenv "LD_LIBRARY_PATH") (list "LIBDIR"))
+ (cdr lib-path)))
+ ((null? lib-path))
+ (let ((dir (car lib-path)))
+ (do ((suffixes '("-v-VERSION" "") (cdr suffixes)))
+ ((null? suffixes))
+ (let ((suf (car suffixes)))
+ (catch 'misc-error
+ (lambda ()
+ (load-extension
+ (string-append dir "/" "libgamma-" name suf) init)
+ (return))
+ (lambda (key . args)
+ #t))))))
+ (error "cannot load extension " name))))
-(let ((lib-path "LIBDIR/"))
- (load-extension (string-append
- lib-path "libgamma-syslog-v-VERSION") "syslog_init"))
-
-;;;; End of syslog.scm
diff --git a/src/mysql.c b/gamma/mysql.c
index dcc1847..dcc1847 100644
--- a/src/mysql.c
+++ b/gamma/mysql.c
diff --git a/src/pgsql.c b/gamma/pgsql.c
index 1421c40..1421c40 100644
--- a/src/pgsql.c
+++ b/gamma/pgsql.c
diff --git a/src/sql.sci b/gamma/sql.scm
index ab91c00..0b00865 100644
--- a/src/sql.sci
+++ b/gamma/sql.scm
@@ -1,5 +1,5 @@
;;;; This file is part of Gamma. -*- scheme -*-
-;;;; Copyright (C) 2002, 2008, 2010, 2015 Sergey Poznyakoff
+;;;; Copyright (C) 2002-2018 Sergey Poznyakoff
;;;;
;;;; Gamma is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -14,18 +14,12 @@
;;;; You should have received a copy of the GNU General Public License
;;;; along with Gamma. If not, see <http://www.gnu.org/licenses/>.
-changequote([,])dnl
-
(define-module (gamma sql)
:use-module (gamma documentation)
+ :use-module (gamma loader)
:export-syntax (sql-catch-failure sql-ignore-failure))
-(if (= (string->number (major-version)) 1)
- (use-syntax (ice-9 syncase)))
-
-(let ((lib-path "LIBDIR/"))
- (load-extension (string-append
- lib-path "libgamma-sql-v-VERSION") "sql_init"))
+(gamma-module-load "sql" "sql_init")
(define-syntax sql-catch-failure
(syntax-rules ()
diff --git a/src/syslog-port.c b/gamma/syslog-port.c
index 4388c10..83b7ac6 100644
--- a/src/syslog-port.c
+++ b/gamma/syslog-port.c
@@ -1,5 +1,5 @@
/* This file is part of Gamma.
- Copyright (C) 2002, 2010 Sergey Poznyakoff
+ Copyright (C) 2002-2018 Sergey Poznyakoff
Gamma is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -55,14 +55,6 @@ _syslog_port_close(SCM port)
}
static size_t
-_syslog_port_free(SCM port)
-/* FIXME: basically, a no-op */
-{
- _syslog_port_close(port);
- return 0;
-}
-
-static size_t
_syslog_port_write(SCM port, SCM src, size_t start, size_t count)
{
struct _gamma_syslog_port *dp = SYSLOG_PORT(port);
@@ -105,7 +97,6 @@ _gamma_init_syslog_port()
scm_syslog_port_type = scm_make_port_type("syslog-port",
NULL,
_syslog_port_write);
- scm_set_port_free(scm_syslog_port_type, _syslog_port_free);
scm_set_port_print(scm_syslog_port_type, _syslog_port_print);
scm_set_port_close(scm_syslog_port_type, _syslog_port_close);
scm_set_port_seek(scm_syslog_port_type, _syslog_port_seek);
diff --git a/src/syslog.c b/gamma/syslog.c
index 82bc688..82bc688 100644
--- a/src/syslog.c
+++ b/gamma/syslog.c
diff --git a/src/syslog.sci b/gamma/syslog.scm
index 317dd6f..5cc1ad6 100644
--- a/src/syslog.sci
+++ b/gamma/syslog.scm
@@ -1,5 +1,5 @@
;;;; This file is part of Gamma. -*- scheme -*-
-;;;; Copyright (C) 2010 Sergey Poznyakoff
+;;;; Copyright (C) 2010-2018 Sergey Poznyakoff
;;;;
;;;; Gamma is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -14,13 +14,10 @@
;;;; You should have received a copy of the GNU General Public License
;;;; along with Gamma. If not, see <http://www.gnu.org/licenses/>.
-changequote([,])dnl
-
(define-module (gamma syslog)
- :use-module (gamma documentation))
+ :use-module (gamma documentation)
+ :use-module (gamma loader))
-(let ((lib-path "LIBDIR/"))
- (load-extension (string-append
- lib-path "libgamma-syslog-v-VERSION") "syslog_init"))
+(gamma-module-load "syslog" "syslog_init")
;;;; End of syslog.scm
diff --git a/modules/expat b/modules/expat
index 4017150..1cc1dc6 100644
--- a/modules/expat
+++ b/modules/expat
@@ -39,9 +39,8 @@ gamma-expat.h
eval.c
scm:
-expat.sci
+expat.scm
makefile:
-expat.scm: Makefile
libgamma_expat_la_LIBADD = @LTLIBOBJS@ @GUILE_LIBS@ $(EXPAT_LIBS)
libgamma_expat_la_CPPFLAGS = $(AM_CPPFLAGS) $(EXPAT_INCS)
diff --git a/modules/sql b/modules/sql
index 1931df6..bc6f473 100644
--- a/modules/sql
+++ b/modules/sql
@@ -54,11 +54,9 @@ guile-sql.h
app.h
makefile:
-sql.scm: Makefile
-
EXTRA_DIST += mysql.c pgsql.c
libgamma_sql_la_LIBADD = @SQLOBJS@ @LTLIBOBJS@ @GUILE_LIBS@ @SQLLIBS@
libgamma_sql_la_DEPENDENCIES = @SQLOBJS@
scm:
-sql.sci
+sql.scm
diff --git a/modules/syslog b/modules/syslog
index f6f92aa..9095478 100644
--- a/modules/syslog
+++ b/modules/syslog
@@ -10,7 +10,5 @@ syslog.c
syslog-port.c
scm:
-syslog.sci
+syslog.scm
-makefile:
-syslog.scm: Makefile
diff --git a/scripts/bootstrap b/scripts/bootstrap
index b1b990f..5d9d3eb 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,7 +4,7 @@ main='(module-ref (resolve-module '\''(scripts bootstrap)) '\'main')'
exec ${GUILE-guile} -l $0 -c "(apply $main (cons \"$0\" (cdr (command-line))))" "$@"
!#
;;;; This file is part of Gamma.
-;;;; Copyright (C) 2010, 2015 Sergey Poznyakoff
+;;;; Copyright (C) 2010-2018 Sergey Poznyakoff
;;;;
;;;; Gamma is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -31,8 +31,8 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cons \"$0\" (cdr (command-line))))"
(debug-enable 'backtrace)
(define module-dir #f)
-(define srcdir "src")
-(define makefile "src/modules.mk")
+(define srcdir "gamma")
+(define makefile "gamma/modules.mk")
(define modconfig-file "m4/modules.m4")
(define modconfig-defun "gamma_MODCONFIG")
(define autogenerated-file-header

Return to:

Send suggestions and report system problems to the System administrator.