aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-03-08 14:36:09 +0100
committerSebastian Geerken <devnull@localhost>2013-03-08 14:36:09 +0100
commit786be3b985a2f97c9d970f8e9acdbf1981584ae1 (patch)
tree8cd1ad4a3705dcab47a49a07b5fb06bc5d0b5581
parent325b089a23086039743861b33ebc4a3e69be2551 (diff)
Renamed install-hyphen to dillo-install-hyphen and made it installable.
-rw-r--r--Makefile.am2
-rwxr-xr-xdillo-install-hyphenation (renamed from install-hyphenation)38
2 files changed, 26 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am
index 3cc1a098..9364999e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
SUBDIRS = lout dw dlib dpip src doc dpid dpi test
+dist_bin_SCRIPTS = dillo-install-hyphenation
+
EXTRA_DIST = Doxyfile dillorc install-dpi-local d_size.h
sysconf_DATA = dillorc
diff --git a/install-hyphenation b/dillo-install-hyphenation
index 0f64c688..2a37f86a 100755
--- a/install-hyphenation
+++ b/dillo-install-hyphenation
@@ -8,22 +8,32 @@ $host = "mirrors.dotsrc.org";
$basesourcedir = "/ctan";
$sourcedir = "";
-# Extract pattern directory from Makefile, in the same directory as
-# this script. A complete interpretation of the Makefiles would be
-# too complicated, so only ${prefix} is read, which is (hopefully)
-# defined as constant.
-$prefix = "";
+# Determine ${prefix}, for the default target directory for pattern
+# files. Two different strategies ...
$makefile = (dirname $0) . "/Makefile";
-open MF, $makefile or die "Cannot open $makefile: $!";
-while (<MF>) {
- if (/^\s*prefix\s*=\s*(.*)\s*$/) {
- $prefix = $1;
- }
-}
-close MF;
+if (-e $makefile) {
+ # 1. Makefile exists in the same directory, so it can be assumed
+ # that this script is not yet installed, but called from the source
+ # directory. Search Makefile for prexix.
+ open MF, $makefile or die "Cannot open $makefile: $!";
+ while (<MF>) {
+ if (/^\s*prefix\s*=\s*(.*)\s*$/) {
+ $prefix = $1;
+ }
+ }
+ close MF;
-if ($prefix eq "") {
- die "Prefix not defined in $makefile.";
+ if ($prefix eq "") {
+ die "Prefix not defined in $makefile.";
+ }
+} else {
+ # 2. Assume that this is script is installed, so its path contains
+ # the prefix.
+ if ($0 =~ /(.*)\/bin\/[^\/]+$/) {
+ $prefix = $1;
+ } else {
+ die "Failed to determine prefix from $0.";
+ }
}
$targetdir = "$prefix/lib/dillo/hyphenation";