emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Location of OpenDocument style files should be configurable
@ 2011-12-29 11:24 Ulrich Mueller
  2011-12-29 16:06 ` Jambunathan K
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Ulrich Mueller @ 2011-12-29 11:24 UTC (permalink / raw)
  To: emacs-orgmode

Hi,
In Gentoo we have an issue with the location of the OpenDocument style
files, reported to us in bug 396269 [1].

When org-mode is installed as a separate Gentoo package, its lisp
files are installed in /usr/share/emacs/site-lisp/org-mode/.
According to our policy, non-lisp files would go to
/usr/share/emacs/etc/org-mode/. We would pass this as the "etcdir"
parameter to "make install", so the odt style files would be installed
in stylesdir = /usr/share/emacs/etc/org-mode/styles/. 

Now org-odt.el currently defines org-odt-styles-dir in a defconst,
and it searches only in ../etc/styles/, ./etc/styles/, and ./etc/org/
relative to lispdir. Obviously it cannot find the files in the Gentoo
location.

Now my question, could the defconst be changed to a defvar, so that we
can specify the location in our site-start file? Or, preferably, could
the etcdir specified in "make" command be honoured in the lisp code?

Ulrich

[1] <https://bugs.gentoo.org/show_bug.cgi?id=396269>

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 11:24 Location of OpenDocument style files should be configurable Ulrich Mueller
@ 2011-12-29 16:06 ` Jambunathan K
  2011-12-29 16:56   ` Ulrich Mueller
  2011-12-30  9:07   ` Achim Gratz
  2011-12-29 16:56 ` Achim Gratz
  2011-12-30 19:53 ` Jambunathan K
  2 siblings, 2 replies; 20+ messages in thread
From: Jambunathan K @ 2011-12-29 16:06 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: bzg, seb, emacs-orgmode, davemarq

Hello Ulrich

> Hi,
> In Gentoo we have an issue with the location of the OpenDocument style
> files, reported to us in bug 396269 [1].

Makefile in org-7.8.02 is buggy and breaks the ODT exporter. Bastien, is
 likely to re-publish a version of org-7.8.x soon.

Lately, there has been some confusion around how and where OpenDocument
style files go. There have also been multiple bug reports surrounding
broken export.

> When org-mode is installed as a separate Gentoo package, its lisp
> files are installed in /usr/share/emacs/site-lisp/org-mode/.
> According to our policy, non-lisp files would go to
> /usr/share/emacs/etc/org-mode/. We would pass this as the "etcdir"
> parameter to "make install", so the odt style files would be installed
> in stylesdir = /usr/share/emacs/etc/org-mode/styles/. 

Org-7.8.x has been accepted in to Emacs-24.1 [1]. I have proposed that
the style files go as "c:/Program Files/emacs-24.0.92/etc/org/*.xml"
[2]. Note that under stock Emacs, the org package go under "org" subdir.

(locate-library "org.elc") => "c:/Program Files/emacs-24.0.92/lisp/org/org.elc"

So, will it be acceptable, if org-odt.el searches for styles file under
<wherever-org-odt.elc-is>/../../etc/org/. (For vanilla Emacs, this is
same as `data-directory'/etc/org. See C-h v data-directory)

This way the package structure under gentoo will parallel the structure
under stock Emacs.

I am copying Sebastien (the debian maintainer) and Dave (who fixed the
Makefile subsequent to 7.8.02) release. If there is consensus, I will
fix org-odt.el and also Makefile.

Side Note: I am little bit hesitant to make org-odt-styles-dir a
defcustom. Already there are defcustoms for org-export-odt-styles-file
and org-export-odt-content-template-file and making org-odt-styles-dir
will add needless confusion to the users.

Jambunathan K.

Footnotes: 
[1] http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00607.html 
[2] http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00571.html

> Now org-odt.el currently defines org-odt-styles-dir in a defconst,
> and it searches only in ../etc/styles/, ./etc/styles/, and ./etc/org/
> relative to lispdir. Obviously it cannot find the files in the Gentoo
> location.
>
> Now my question, could the defconst be changed to a defvar, so that we
> can specify the location in our site-start file? Or, preferably, could
> the etcdir specified in "make" command be honoured in the lisp code?
>
> Ulrich
>
> [1] <https://bugs.gentoo.org/show_bug.cgi?id=396269>
>
>

-- 

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 11:24 Location of OpenDocument style files should be configurable Ulrich Mueller
  2011-12-29 16:06 ` Jambunathan K
@ 2011-12-29 16:56 ` Achim Gratz
  2011-12-29 18:32   ` Ulrich Mueller
  2011-12-30 19:53 ` Jambunathan K
  2 siblings, 1 reply; 20+ messages in thread
From: Achim Gratz @ 2011-12-29 16:56 UTC (permalink / raw)
  To: emacs-orgmode

Am 29.12.2011 12:24, schrieb Ulrich Mueller:
> Now org-odt.el currently defines org-odt-styles-dir in a defconst,
> and it searches only in ../etc/styles/, ./etc/styles/, and ./etc/org/
> relative to lispdir. Obviously it cannot find the files in the Gentoo
> location.

IMHO, an _installed_ org mode should never heuristically search any 
support files -- the location should either be recorded into 
org-install.el as a constant or made configurable as a defcustom, 
whichever is more appropriate.

> Now my question, could the defconst be changed to a defvar, so that we
> can specify the location in our site-start file? Or, preferably, could
> the etcdir specified in "make" command be honoured in the lisp code?

Jambunathan will have to answer that, but a defvar seems the wrong 
solution to this problem.  Also site-start should probably not be 
(mis-)used to configure the behaviour of packages that the user may not 
actually use.  Making use of variables set in the Makefile is possible, 
but I would not recommend to do this in any other file except 
org-install.el.


-- 
Achim.

(on the road :-)

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 16:06 ` Jambunathan K
@ 2011-12-29 16:56   ` Ulrich Mueller
  2011-12-30  9:07   ` Achim Gratz
  1 sibling, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2011-12-29 16:56 UTC (permalink / raw)
  To: Jambunathan K; +Cc: bzg, seb, emacs-orgmode, davemarq

>>>>> On Thu, 29 Dec 2011, Jambunathan K wrote:

>> According to our policy, non-lisp files would go to
>> /usr/share/emacs/etc/org-mode/. We would pass this as the "etcdir"
>> parameter to "make install", so the odt style files would be
>> installed in stylesdir = /usr/share/emacs/etc/org-mode/styles/.

> Org-7.8.x has been accepted in to Emacs-24.1 [1]. I have proposed that
> the style files go as "c:/Program Files/emacs-24.0.92/etc/org/*.xml"
> [2]. Note that under stock Emacs, the org package go under "org" subdir.

> (locate-library "org.elc") => "c:/Program Files/emacs-24.0.92/lisp/org/org.elc"

> So, will it be acceptable, if org-odt.el searches for styles file
> under <wherever-org-odt.elc-is>/../../etc/org/. (For vanilla Emacs,
> this is same as `data-directory'/etc/org. See C-h v data-directory)

> This way the package structure under gentoo will parallel the
> structure under stock Emacs.

Gentoo policy is to install auxiliary (non-lisp) files under
/usr/share/emacs/etc/${PN}/ where PN is the package name. The Gentoo
package is named "org-mode" not "org".

And I guess you'll not be able to catch all possible cases by adding
even more paths like ../../etc/org/ to the heuristics of your search.
Such a solution looks like a dead end to me.

> I am copying Sebastien (the debian maintainer) and Dave (who fixed
> the Makefile subsequent to 7.8.02) release. If there is consensus,
> I will fix org-odt.el and also Makefile.

> Side Note: I am little bit hesitant to make org-odt-styles-dir a
> defcustom. Already there are defcustoms for org-export-odt-styles-file
> and org-export-odt-content-template-file and making org-odt-styles-dir
> will add needless confusion to the users.

I wasn't asking for a defcustom, a defvar for org-odt-styles-dir would
be sufficient and wouldn't add confusion for users. This way, we could
simply setq the variable in our site-init file.

On the long term, another solution would be to collect all
Makefile-configurable paths (lispdir, stylesdir, etc.) in a file
org-paths.el that would be auto-generated by make.

Ulrich

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 16:56 ` Achim Gratz
@ 2011-12-29 18:32   ` Ulrich Mueller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2011-12-29 18:32 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

>>>>> On Thu, 29 Dec 2011, Achim Gratz wrote:

> IMHO, an _installed_ org mode should never heuristically search
> any support files -- the location should either be recorded into
> org-install.el as a constant or made configurable as a defcustom,
> whichever is more appropriate.

Such heuristic searches are not uncommon in other elisp packages.
But I agree that it's the wrong approach. If the location is known at
build time, then it should be recorded somewhere in the lisp code.

>> Now my question, could the defconst be changed to a defvar, so that
>> we can specify the location in our site-start file? Or, preferably,
>> could the etcdir specified in "make" command be honoured in the
>> lisp code?

> Jambunathan will have to answer that, but a defvar seems the wrong
> solution to this problem.  Also site-start should probably not be
> (mis-)used to configure the behaviour of packages that the user may
> not actually use.

Well, we don't configure the behaviour, but just fix a wrong path.
Also Gentoo's site-start file requires org-install if org-mode is
installed on the user's system. So, for the user there won't be a
visible difference if the path is defined in org-install or in
site-start.

Of course, it is preferred if the upstream package gets things right,
so that we don't have to adjust them on the distro level.

Ulrich

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 16:06 ` Jambunathan K
  2011-12-29 16:56   ` Ulrich Mueller
@ 2011-12-30  9:07   ` Achim Gratz
  1 sibling, 0 replies; 20+ messages in thread
From: Achim Gratz @ 2011-12-30  9:07 UTC (permalink / raw)
  To: emacs-orgmode

Am 29.12.2011 17:06, schrieb Jambunathan K:
> Side Note: I am little bit hesitant to make org-odt-styles-dir a
> defcustom. Already there are defcustoms for org-export-odt-styles-file
> and org-export-odt-content-template-file and making org-odt-styles-dir
> will add needless confusion to the users.

That should be OK for the bundled styles that are installed together 
with org mode.  The question remains whether you want to allow users to 
have their own style files.  If one can have per-user style files, there 
probably needs to be a configurable location for them to be stored and a 
way to decide if the standard styles should be visible or not (maybe 
like load-path).

-- 
Achim.

(on the road :-)

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-29 11:24 Location of OpenDocument style files should be configurable Ulrich Mueller
  2011-12-29 16:06 ` Jambunathan K
  2011-12-29 16:56 ` Achim Gratz
@ 2011-12-30 19:53 ` Jambunathan K
  2011-12-31  0:07   ` Ulrich Mueller
  2012-01-02 22:11   ` Achim Gratz
  2 siblings, 2 replies; 20+ messages in thread
From: Jambunathan K @ 2011-12-30 19:53 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode

Ulrich

I have pushed a fix so that "make install" will do the right
thing. Package maintainers have to modify just the $(lispdir) and
$(datadir) vars in the Makefile. (Hopefully) They don't have to do
anything special at all. You may also want to read the comments under
DATAFILES to have an idea of what is available for packaging.

You can download a snapshot from the current HEAD:
http://orgmode.org/w/?p=org-mode.git;a=summary

Let know how things go.

Thanks,
Jambunathan K.


Here is a summary of change:

--8<---------------cut here---------------start------------->8---

From 07f006e4fd9a7b66643cd7b404c8994665ba8300 Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
Date: Sat, 31 Dec 2011 01:00:56 +0530
Subject: [PATCH 1/2] Fix packaging of ODT exporter (org-7.8.02) in Gentoo

* org-odt.el (org-odt-lib-dir): Add docstring.
(org-odt-data-dir): New variable.  Use this variable to
control the locations from which the ODT exporter picks the
OpenDocument styles and schema files from.  Set this variable
explicitly only if the in-built heuristics for locating the
above files fails.
(org-odt-styles-dir-list, org-odt-schema-dir-list): New
variables.  Pay specific attention to (eval-when-compile ...)
form through which Makefile's $(datadir) - contained in
`org-odt-data-dir' - gets compiled in as a "hard coded"
constant.
(org-odt-styles-dir, org-export-odt-schema-dir): Add messages
to aid debugging.

* Makefile (etcdir): Remove this.
(stylesdir): Rename to datadir.
(datadir): Was stylesdir.
(STYLESFILES): Rename to DATAFILES.
(DATAFILES): Was STYLESFILES.  Offer a menu of files that is
available.  Package maintainers can use this list and their
own discretion to cherry-pick what they are willing to install
in their distribution.
(CP): Add recursive flag so that directories listed in
DATAFILES can be copied enbloc.
(install-lisp): Use conditional flag BATCH_EXTRA
(BATCH_EXTRA): "Target-specific variable value" that plumbs
the value of $(datadir) in to org-odt.el via
`org-odt-data-dir'.  See ChangeLog entries for
`org-odt-styles-dir-list' and `org-odt-schema-dir-list'.
(BATCH): Add BATCH_EXTRA.
(lisp/org-odt.elc): Force re-generation of this target every
time so that $(datadir) gets plumbed in to org-odt.el through
`org-odt-data-dir'.
(org-odt-data-dir): "FORCE" target.  Also a variable defined
in org-odt.el.
(install-etc): Rename this target to install-data.
(install-data): Was install-etc.
--8<---------------cut here---------------end--------------->8---

Ulrich Mueller <ulm@gentoo.org> writes:

> Hi,
> In Gentoo we have an issue with the location of the OpenDocument style
> files, reported to us in bug 396269 [1].
>
> When org-mode is installed as a separate Gentoo package, its lisp
> files are installed in /usr/share/emacs/site-lisp/org-mode/.
> According to our policy, non-lisp files would go to
> /usr/share/emacs/etc/org-mode/. We would pass this as the "etcdir"
> parameter to "make install", so the odt style files would be installed
> in stylesdir = /usr/share/emacs/etc/org-mode/styles/. 
>
> Now org-odt.el currently defines org-odt-styles-dir in a defconst,
> and it searches only in ../etc/styles/, ./etc/styles/, and ./etc/org/
> relative to lispdir. Obviously it cannot find the files in the Gentoo
> location.
>
> Now my question, could the defconst be changed to a defvar, so that we
> can specify the location in our site-start file? Or, preferably, could
> the etcdir specified in "make" command be honoured in the lisp code?
>
> Ulrich
>
> [1] <https://bugs.gentoo.org/show_bug.cgi?id=396269>
>
>

-- 

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-30 19:53 ` Jambunathan K
@ 2011-12-31  0:07   ` Ulrich Mueller
  2012-01-01 18:35     ` Ulrich Mueller
  2012-01-02 22:11   ` Achim Gratz
  1 sibling, 1 reply; 20+ messages in thread
From: Ulrich Mueller @ 2011-12-31  0:07 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

>>>>> On Sat, 31 Dec 2011, Jambunathan K wrote:

> I have pushed a fix so that "make install" will do the right
> thing. Package maintainers have to modify just the $(lispdir) and
> $(datadir) vars in the Makefile. (Hopefully) They don't have to do
> anything special at all.

Hi Jambunathan,
So you're defining org-odt-data-dir at byte-compile time with
BATCH_EXTRA, and its value will be embedded in the .elc file? Clever.

Nevertheless, I've added another setq for org-odt-data-dir to our
site-init file. Just to be on the safe side, in case a user will
decide to load the uncompiled elisp file (for debugging, or whatever).

> You may also want to read the comments under
> DATAFILES to have an idea of what is available for packaging.

So do I get this right:
contrib/odt/BasicODConverter/BasicODConverter*.oxt should go to
${datadir} directly, and contrib/odt/etc/schema/* should go to
${datadir}/schema?

> Let know how things go.

Looks like the current git head is working fine.

Thanks,
Ulrich

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-31  0:07   ` Ulrich Mueller
@ 2012-01-01 18:35     ` Ulrich Mueller
  2012-01-01 20:43       ` Ulrich Mueller
  0 siblings, 1 reply; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-01 18:35 UTC (permalink / raw)
  To: Jambunathan K; +Cc: emacs-orgmode

>>>>> On Sat, 31 Dec 2011, Ulrich Mueller wrote:

>>>>> On Sat, 31 Dec 2011, Jambunathan K wrote:
>> Let know how things go.

> Looks like the current git head is working fine.

Sorry, I was a bit too fast with my reply. In fact, things are still
broken.

The problem is that when building org-odt.elc (with "make all"), the
value of datadir is ignored. Instead, its value at the time of
"make install" is embedded into the byte-compiled file.

This fails, because Gentoo builds are done in a sandboxed environment,
therefore org-odt.elc will contain some path like
/var/tmp/portage/app-emacs/org-mode-7.8.02-r1/image/usr/share/emacs/etc/org-mode/styles/
instead of the correct /usr/share/emacs/etc/org-mode/styles/.

So, could the build system please be changed, such that the datadir
value at _compile_ time is taken, not at _install_ time? (And of
course, it cannot be assumed that the final datadir exists at compile
time.)

Thanks,
Ulrich

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-01 18:35     ` Ulrich Mueller
@ 2012-01-01 20:43       ` Ulrich Mueller
  2012-01-02 14:10         ` Jambunathan K
  0 siblings, 1 reply; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-01 20:43 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jambunathan K

> So, could the build system please be changed, such that the datadir
> value at _compile_ time is taken, not at _install_ time?

I.e., something like the patch included below.

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>

Cheers,
Ulrich


From f6eb5150418bfd5de35b8f4f9ca39f4cbff1d40b Mon Sep 17 00:00:00 2001
From: Ulrich Mueller <ulm@gentoo.org>
Date: Sun, 1 Jan 2012 21:39:21 +0100
Subject: [PATCH] Don't re-compile org-odt.el at install time.

---
 Makefile |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 520b0fd..642b21f 100644
--- a/Makefile
+++ b/Makefile
@@ -247,14 +247,10 @@ p:
 g:
 	${MAKE} pdf && open doc/orgguide.pdf
 
-# Always force re-compilation of org-odt
-lisp/org-odt.elc: org-odt-data-dir
-org-odt-data-dir:
-
 # Sleight of hand to "hard code" the value of $(datadir) in
 # org-odt.el.  See variables `org-odt-styles-dir-list' and
 # `org-odt-schema-dir-list'.
-install-lisp: BATCH_EXTRA = -eval "(setq org-odt-data-dir (expand-file-name \"$(datadir)\"))"
+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 ;
-- 
1.7.8.1

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-01 20:43       ` Ulrich Mueller
@ 2012-01-02 14:10         ` Jambunathan K
  2012-01-03  9:38           ` Ulrich Mueller
  0 siblings, 1 reply; 20+ messages in thread
From: Jambunathan K @ 2012-01-02 14:10 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode

Ulrich

>> So, could the build system please be changed, such that the datadir
>> value at _compile_ time is taken, not at _install_ time?
>
> I.e., something like the patch included below.
>
> 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).

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

Jambunathan K.

> Cheers,
> Ulrich
>
>
> From f6eb5150418bfd5de35b8f4f9ca39f4cbff1d40b Mon Sep 17 00:00:00 2001
> From: Ulrich Mueller <ulm@gentoo.org>
> Date: Sun, 1 Jan 2012 21:39:21 +0100
> Subject: [PATCH] Don't re-compile org-odt.el at install time.
>
> ---
>  Makefile |    6 +-----
>  1 files changed, 1 insertions(+), 5 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 520b0fd..642b21f 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -247,14 +247,10 @@ p:
>  g:
>  	${MAKE} pdf && open doc/orgguide.pdf
>  
> -# Always force re-compilation of org-odt
> -lisp/org-odt.elc: org-odt-data-dir
> -org-odt-data-dir:
> -
>  # Sleight of hand to "hard code" the value of $(datadir) in
>  # org-odt.el.  See variables `org-odt-styles-dir-list' and
>  # `org-odt-schema-dir-list'.
> -install-lisp: BATCH_EXTRA = -eval "(setq org-odt-data-dir (expand-file-name \"$(datadir)\"))"
> +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 ;

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

* Re: Location of OpenDocument style files should be configurable
  2011-12-30 19:53 ` Jambunathan K
  2011-12-31  0:07   ` Ulrich Mueller
@ 2012-01-02 22:11   ` Achim Gratz
  2012-01-03 10:10     ` Ulrich Mueller
  1 sibling, 1 reply; 20+ messages in thread
From: Achim Gratz @ 2012-01-02 22:11 UTC (permalink / raw)
  To: emacs-orgmode


Jambunathan K <kjambunathan@gmail.com> writes:
> I have pushed a fix so that "make install" will do the right
> thing. Package maintainers have to modify just the $(lispdir) and
> $(datadir) vars in the Makefile. (Hopefully) They don't have to do
> anything special at all. You may also want to read the comments under
> DATAFILES to have an idea of what is available for packaging.

I've implemented it somewhat differently in my Makefile fork, please see
the thread here: http://thread.gmane.org/gmane.emacs.orgmode/50366/focus=50378

> (org-odt-styles-dir-list, org-odt-schema-dir-list): New
> variables.  Pay specific attention to (eval-when-compile ...)
> form through which Makefile's $(datadir) - contained in
> `org-odt-data-dir' - gets compiled in as a "hard coded"
> constant.

I don't understand the need for compile-time evaluation.  In any case it
would be nice to avoid it.

I see why the schema directory doesn't become part of GNU Emacs, but why
should org-mode git not distribute and install the files?  For my
Makefile fork it would simply need adding "schema" to ETCDIRS and moving
the files from contrib to etc.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Wavetables for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldUserWavetables

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-02 14:10         ` Jambunathan K
@ 2012-01-03  9:38           ` Ulrich Mueller
  2012-01-03 10:20             ` Bastien
                               ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-03  9:38 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Jambunathan K

>>>>> 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(-)

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
 
-- 
1.7.8.2

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-02 22:11   ` Achim Gratz
@ 2012-01-03 10:10     ` Ulrich Mueller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-03 10:10 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Achim Gratz

>>>>> On Mon, 02 Jan 2012, Achim Gratz wrote:

> Jambunathan K <kjambunathan@gmail.com> writes:
>> (org-odt-styles-dir-list, org-odt-schema-dir-list): New
>> variables.  Pay specific attention to (eval-when-compile ...)
>> form through which Makefile's $(datadir) - contained in
>> `org-odt-data-dir' - gets compiled in as a "hard coded"
>> constant.

> I don't understand the need for compile-time evaluation.  In any
> case it would be nice to avoid it.

It's somewhat fragile, because the program will behave differently
depending if the .el or the .elc file is loaded.

Therefore I think that embedding the variable in org-install.el (as in
commit 67e92cf in your fork) is preferable.

Cheers,
Ulrich

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-03  9:38           ` Ulrich Mueller
@ 2012-01-03 10:20             ` Bastien
  2012-01-03 14:59               ` Ulrich Mueller
  2012-01-03 10:26             ` Bastien
  2012-02-24 11:01             ` Jambunathan K
  2 siblings, 1 reply; 20+ messages in thread
From: Bastien @ 2012-01-03 10:20 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode, Jambunathan K

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

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-03  9:38           ` Ulrich Mueller
  2012-01-03 10:20             ` Bastien
@ 2012-01-03 10:26             ` Bastien
  2012-01-03 13:59               ` Ulrich Mueller
  2012-02-24 11:01             ` Jambunathan K
  2 siblings, 1 reply; 20+ messages in thread
From: Bastien @ 2012-01-03 10:26 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode, Jambunathan K

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!

-- 
 Bastien

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-03 10:26             ` Bastien
@ 2012-01-03 13:59               ` Ulrich Mueller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-03 13:59 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Jambunathan K

>>>>> On Tue, 03 Jan 2012, Bastien  wrote:

>>> 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.

Sorry. Please find an updated patch below.

Cheers,
Ulrich


From 9af8ea97022e23231395046bcfbf5f1e71ac5f59 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.

From the GNU coding standards:
`DESTDIR' is a variable prepended to each installed target file. [...]
This provides for "staged installs", where the installed files are not
placed directly into their expected location but are instead copied
into a temporary location (`DESTDIR').  However, installed files
maintain their relative directory structure and any embedded file
names will not be modified.
---
 Makefile |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 642b21f..4f06c4e 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,9 @@ datadir = $(prefix)/share/emacs/etc
 # Where info files go
 infodir = $(prefix)/share/info
 
+# Alternate destination root directory for staged installs
+DESTDIR =
+
 ##----------------------------------------------------------------------
 ## YOU MAY NEED TO EDIT THESE
 ##----------------------------------------------------------------------
@@ -253,18 +256,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
 
-- 
1.7.8.2

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-03 10:20             ` Bastien
@ 2012-01-03 14:59               ` Ulrich Mueller
  0 siblings, 0 replies; 20+ messages in thread
From: Ulrich Mueller @ 2012-01-03 14:59 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode, Jambunathan K

>>>>> 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

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

* Re: Location of OpenDocument style files should be configurable
  2012-01-03  9:38           ` Ulrich Mueller
  2012-01-03 10:20             ` Bastien
  2012-01-03 10:26             ` Bastien
@ 2012-02-24 11:01             ` Jambunathan K
  2012-02-24 11:20               ` Jambunathan K
  2 siblings, 1 reply; 20+ messages in thread
From: Jambunathan K @ 2012-02-24 11:01 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode

Ulrich

>> 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. :(

I have applied the patch below. This should be available in the next
release..

> 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(-)
>
> 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

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

* Re: Location of OpenDocument style files should be configurable
  2012-02-24 11:01             ` Jambunathan K
@ 2012-02-24 11:20               ` Jambunathan K
  0 siblings, 0 replies; 20+ messages in thread
From: Jambunathan K @ 2012-02-24 11:20 UTC (permalink / raw)
  To: Ulrich Mueller; +Cc: emacs-orgmode

Ulrich

Btw, I have not applied the other patch that you submitted here.
http://lists.gnu.org/archive/html/emacs-orgmode/2012-01/msg00005.html

Only "make install" copies the OpenDocument styles files. So, your
approach of setting the value during compilation seems a bit strange to
me.

I have a feeling that your other patch - the one that I have committed -
suffices to address the specific packaging workflow on Gentoo side.

There is lots of water that has flown under the Ganges since we last
discussed. It is possible that you are quite happy with tweaking
`org-odt-data-dir' in your site installation file.

Btw, I am open to discussion if you still feel strongly about the patch
referenced above. It is possible that I haven't understood what you have
been saying.

Jambunathan K.

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

end of thread, other threads:[~2012-02-24 11:20 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-29 11:24 Location of OpenDocument style files should be configurable Ulrich Mueller
2011-12-29 16:06 ` Jambunathan K
2011-12-29 16:56   ` Ulrich Mueller
2011-12-30  9:07   ` Achim Gratz
2011-12-29 16:56 ` Achim Gratz
2011-12-29 18:32   ` Ulrich Mueller
2011-12-30 19:53 ` Jambunathan K
2011-12-31  0:07   ` Ulrich Mueller
2012-01-01 18:35     ` Ulrich Mueller
2012-01-01 20:43       ` Ulrich Mueller
2012-01-02 14:10         ` Jambunathan K
2012-01-03  9:38           ` Ulrich Mueller
2012-01-03 10:20             ` Bastien
2012-01-03 14:59               ` Ulrich Mueller
2012-01-03 10:26             ` Bastien
2012-01-03 13:59               ` Ulrich Mueller
2012-02-24 11:01             ` Jambunathan K
2012-02-24 11:20               ` Jambunathan K
2012-01-02 22:11   ` Achim Gratz
2012-01-03 10:10     ` Ulrich Mueller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).