summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-08-15 12:53:59 +0200
committerLudovic Courtès <ludo@gnu.org>2009-08-15 14:18:57 +0200
commit54b38caf19deb0e5a6e8146c65b3e176e7fffa60 (patch)
tree5432bacb46329c9fd823fb9cea9c08e7805aa4ce
parentacf04ab4621d9b558f0c403897d36ef9369d1dfc (diff)
downloadguile-54b38caf19deb0e5a6e8146c65b3e176e7fffa60.tar.gz
Add proper `--help' and `--version' for `guile-tools compile'.
* configure.ac: Produce `meta/guile-tools'. * meta/Makefile.am (EXTRA_DIST): Add `guile-tools.in'. (bin_SCRIPTS): Remove `guile-tools'. * meta/uninstalled-env.in (PATH): Add "${top_builddir}/meta". * module/scripts/compile.scm (%options): Add `--version'. (parse-args): Show the offending option name upon error. (show-version): New. (compile): Use `%guile-bug-report-address'.
-rw-r--r--.gitignore1
-rw-r--r--configure.ac1
-rw-r--r--meta/Makefile.am9
-rwxr-xr-xmeta/guile-tools.in (renamed from meta/guile-tools)6
-rw-r--r--meta/uninstalled-env.in3
-rw-r--r--module/scripts/compile.scm16
6 files changed, 29 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index 004c7f37d..2a7e69496 100644
--- a/.gitignore
+++ b/.gitignore
@@ -113,3 +113,4 @@ INSTALL
/GRTAGS
/GSYMS
/GTAGS
+/meta/guile-tools
diff --git a/configure.ac b/configure.ac
index ddc092ee9..da71529c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1546,6 +1546,7 @@ AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
AC_CONFIG_FILES([meta/guile], [chmod +x meta/guile])
AC_CONFIG_FILES([meta/uninstalled-env], [chmod +x meta/uninstalled-env])
AC_CONFIG_FILES([meta/gdb-uninstalled-guile], [chmod +x meta/gdb-uninstalled-guile])
+AC_CONFIG_FILES([meta/guile-tools], [chmod +x meta/guile-tools])
AC_CONFIG_FILES([libguile/guile-snarf],
[chmod +x libguile/guile-snarf])
AC_CONFIG_FILES([libguile/guile-doc-snarf],
diff --git a/meta/Makefile.am b/meta/Makefile.am
index ba79794cf..c8bdacc92 100644
--- a/meta/Makefile.am
+++ b/meta/Makefile.am
@@ -20,10 +20,11 @@
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
-bin_SCRIPTS=guile-config guile-tools
-EXTRA_DIST= $(bin_SCRIPTS) \
- guile.m4 ChangeLog-2008 \
- guile-2.0.pc.in guile-2.0-uninstalled.pc.in
+bin_SCRIPTS = guile-config
+EXTRA_DIST= $(bin_SCRIPTS) \
+ guile.m4 ChangeLog-2008 \
+ guile-2.0.pc.in guile-2.0-uninstalled.pc.in \
+ guile-tools.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = guile-2.0.pc
diff --git a/meta/guile-tools b/meta/guile-tools.in
index 0c66c7200..51d103fe8 100755
--- a/meta/guile-tools
+++ b/meta/guile-tools.in
@@ -25,6 +25,12 @@ exec guile $GUILE_FLAGS -e '(@@ (guile-tools) main)' -s "$0" "$@"
(define-module (guile-tools))
+;; Hack to provide scripts with the bug-report address.
+(module-define! the-scm-module
+ '%guile-bug-report-address
+ "@PACKAGE_BUGREPORT@")
+
+
;; We can't import srfi-1, unfortunately, as we are used early in the
;; boot process, before the srfi-1 shlib is built.
diff --git a/meta/uninstalled-env.in b/meta/uninstalled-env.in
index 8ee690ccf..9a6227230 100644
--- a/meta/uninstalled-env.in
+++ b/meta/uninstalled-env.in
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2003, 2006, 2008 Free Software Foundation
+# Copyright (C) 2003, 2006, 2008, 2009 Free Software Foundation
#
# This file is part of GUILE.
#
@@ -112,6 +112,7 @@ export PKG_CONFIG_PATH
# handle PATH (no clobber)
PATH="${top_builddir}/libguile:${PATH}"
PATH="${top_srcdir}/meta:${PATH}"
+PATH="${top_builddir}/meta:${PATH}"
export PATH
exec "$@"
diff --git a/module/scripts/compile.scm b/module/scripts/compile.scm
index 89d35bcb5..9b14f2fca 100644
--- a/module/scripts/compile.scm
+++ b/module/scripts/compile.scm
@@ -48,6 +48,10 @@
(list (option '(#\h "help") #f #f
(lambda (opt name arg result)
(alist-cons 'help? #t result)))
+ (option '("version") #f #f
+ (lambda (opt name arg result)
+ (show-version)
+ (exit 0)))
(option '(#\L "load-path") #t #f
(lambda (opt name arg result)
@@ -90,7 +94,7 @@
options."
(args-fold args %options
(lambda (opt name arg result)
- (format (current-error-port) "~A: unrecognized option" opt)
+ (format (current-error-port) "~A: unrecognized option" name)
(exit 1))
(lambda (file result)
(let ((input-files (assoc-ref result 'input-files)))
@@ -102,6 +106,13 @@ options."
(load-path)
(warnings unsupported-warning))))
+(define (show-version)
+ (format #t "compile (GNU Guile) ~A~%" (version))
+ (format #t "Copyright (C) 2009 Free Software Foundation, Inc.
+License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>.
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.~%"))
+
(define (show-warning-help)
(format #t "The available warning types are:~%~%")
(for-each (lambda (wt)
@@ -143,7 +154,8 @@ Compile each Guile source file FILE into a Guile object.
Note that autocompilation will be turned off.
-Report bugs to <guile-user@gnu.org>.~%")
+Report bugs to <~A>.~%"
+ %guile-bug-report-address)
(exit 0)))
(set! %load-path (append load-path %load-path))