Patchwork [O] Location of OpenDocument style files should be configurable

login
register
Submitter Ulrich Mueller
Date 2012-01-03 09:38:39
Message ID <20226.52383.241764.850928@a1i15.kph.uni-mainz.de>
Download mbox | patch
Permalink /patch/1093/
State New
Headers show

Comments

Ulrich Mueller - 2012-01-03 09:38:39
>>>>> On Mon, 02 Jan 2012, Jambunathan K wrote:

>> BTW, maybe one could think about supporting DESTDIR? That should be
>> trivial to implement, simply prepend $(DESTDIR) to all destination
>> paths in the install-* make targets. I can prepare a patch if this
>> is wanted.
>> <http://www.gnu.org/prep/standards/html_node/DESTDIR.html>

> It would be wonderful if you could provide a patch (and a usage
> note).

Included below.

> ps: Makefiles are beyond my jurisdiction. I will let Bastien act on
> your patch(es).

Looks like my earlier patch hasn't been applied for 7.8.03. :(

Cheers,
Ulrich


From 274fc9a41d7e573bc67a85ffad046ca163dc6452 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@gentoo.org>
Date: Mon, 2 Jan 2012 22:00:38 +0100
Subject: [PATCH] Support DESTDIR in Makefile.

---
 Makefile |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
Bastien Guerry - 2012-01-03 10:20:57
Hi Ulrich,

Ulrich Mueller <ulm@gentoo.org> writes:

>> ps: Makefiles are beyond my jurisdiction. I will let Bastien act on
>> your patch(es).
>
> Looks like my earlier patch hasn't been applied for 7.8.03. :(

Yes -- things are not entirely clear to me in this area, and the
ongoing discussion between you, Achim and Jambunathan feels like
we need to move carefully.

This will be part of the next bugfix or major release.
Bastien Guerry - 2012-01-03 10:26:38
Hi Ulrich,

Ulrich Mueller <ulm@gentoo.org> writes:

>> It would be wonderful if you could provide a patch (and a usage
>> note).
>
> Included below.

Please add more explanations in such patches -- Jambunathan's
explanations are a model of clarity and detailfulness.

Thanks!
Ulrich Mueller - 2012-01-03 14:59:20
>>>>> On Tue, 03 Jan 2012, Bastien  wrote:

>>> ps: Makefiles are beyond my jurisdiction. I will let Bastien act
>>> on your patch(es).
>> 
>> Looks like my earlier patch hasn't been applied for 7.8.03. :(

> Yes -- things are not entirely clear to me in this area, and the
> ongoing discussion between you, Achim and Jambunathan feels like
> we need to move carefully.

To summarise as I see the issue:
 - Because arbitrary paths for datadir can be specified at compile
   time, any approach using (only) heuristic searches at run time is
   bound to fail in some configurations.
 - Most other packages using such heuristics provide a way for
   overriding it. The simplest way is just using defvar or defcustom
   (but not a defconst) for the variable definition. (This was my
   original suggestion, which would have been trivial to implement.)
 - However, if the location is known at compile time, there is also no
   need for such searches, because the datadir path can be embedded in
   the lisp code.
 - Preferably, the package should behave the same, regardless if it is
   loaded as elisp sources or as byte-compiled files. Embedding the
   path only in the byte code may be too fragile (in fact, for 7.8.03
   it currently fails with Gentoo's staged installs), and also lead to
   surprising behaviour.
 - Therefore I think the best approach would be either to record such
   paths in org-install.el (as Achim has suggested), or to have the
   Makefile create a new file like org-paths.el for this purpose.

Cheers,
Ulrich

Patch

diff --git a/Makefile b/Makefile
index 642b21f..b6ad567 100644
--- a/Makefile
+++ b/Makefile
@@ -253,18 +253,21 @@  g:
 lisp/org-odt.elc: BATCH_EXTRA = -eval "(setq org-odt-data-dir (expand-file-name \"$(datadir)\"))"
 
 install-lisp: $(LISPFILES) $(ELCFILES)
-	if [ ! -d $(lispdir) ]; then $(MKDIR) $(lispdir); else true; fi ;
-	$(CP) $(LISPFILES)  $(lispdir)
-	$(CP) $(ELCFILES)   $(lispdir)
+	if [ ! -d $(DESTDIR)$(lispdir) ]; then \
+		$(MKDIR) $(DESTDIR)$(lispdir); else true; fi ;
+	$(CP) $(LISPFILES)  $(DESTDIR)$(lispdir)
+	$(CP) $(ELCFILES)   $(DESTDIR)$(lispdir)
 
 install-info: $(INFOFILES)
-	if [ ! -d $(infodir) ]; then $(MKDIR) $(infodir); else true; fi ;
-	$(CP) $(INFOFILES) $(infodir)
-	$(INSTALL_INFO) --infodir=$(infodir) $(INFOFILES)
+	if [ ! -d $(DESTDIR)$(infodir) ]; then \
+		$(MKDIR) $(DESTDIR)$(infodir); else true; fi ;
+	$(CP) $(INFOFILES) $(DESTDIR)$(infodir)
+	$(INSTALL_INFO) --infodir=$(DESTDIR)$(infodir) $(INFOFILES)
 
 install-data: $(DATAFILES)
-	if [ ! -d $(datadir) ]; then $(MKDIR) $(datadir); else true; fi ;
-	$(CP) $(DATAFILES) $(datadir)
+	if [ ! -d $(DESTDIR)$(datadir) ]; then \
+		$(MKDIR) $(DESTDIR)$(datadir); else true; fi ;
+	$(CP) $(DATAFILES) $(DESTDIR)$(datadir)
 
 autoloads: lisp/org-install.el