unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.
@ 2015-11-25 17:32 Andrew Burgess
  2015-11-26 18:45 ` Tomi Ollila
  2015-11-28 13:07 ` David Bremner
  0 siblings, 2 replies; 8+ messages in thread
From: Andrew Burgess @ 2015-11-25 17:32 UTC (permalink / raw)
  To: notmuch

Hi,

I like to maintain multiple copies of notmuch installed in parallel,
and so make use of the --prefix=$PREFIX argument to configure.

I recently tried to configure and install from master, and ran into an
issue that the location selected for installing the emacs components
did not respect my chosen prefix.

It turns out that if pkg-config is available (it is here) then the
supplied prefix is ignored, in favour of the path returned by pkg-config.

To reproduce this issue, then as a non-root user, using current master:

  ./configure --prefix=$HOME/notmuch-prefix
  make
  make install

Assumming that you have pkg-config installed, emacs installed, and the
command 'pkg-config emacs --variable sitepkglispdir' returns a
directory that only root can write to, then the make install above
should fail.

The solution I propose in the patch below is to still apply the
prefix, even when pkg-config is available; pkg-config is used to
select the path within the prefix directory.

Would you consider this for inclusion?

Thanks,
Andrew

---
When using pkg-config to select the path for the various emacs
installation directories (the lisp and etc directories), still apply
the $prefix variable.
---
 configure | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 440d678..4f1db82 100755
--- a/configure
+++ b/configure
@@ -473,7 +473,7 @@ fi
 
 if [ -z "${EMACSLISPDIR}" ]; then
     if pkg-config --exists emacs; then
-	EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
+	EMACSLISPDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
     else
 	EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
     fi
@@ -481,7 +481,7 @@ fi
 
 if [ -z "${EMACSETCDIR}" ]; then
     if pkg-config --exists emacs; then
-	EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
+	EMACSETCDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
     else
 	EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
     fi
-- 
2.5.1

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

* Re: [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.
  2015-11-25 17:32 [PATCH] configure: Use $prefix for emacs, even when pkg-config is available Andrew Burgess
@ 2015-11-26 18:45 ` Tomi Ollila
  2015-11-28 13:07 ` David Bremner
  1 sibling, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2015-11-26 18:45 UTC (permalink / raw)
  To: Andrew Burgess, notmuch

On Wed, Nov 25 2015, Andrew Burgess <andrew.burgess@embecosm.com> wrote:

> Hi,
>
> I like to maintain multiple copies of notmuch installed in parallel,
> and so make use of the --prefix=$PREFIX argument to configure.
>
> I recently tried to configure and install from master, and ran into an
> issue that the location selected for installing the emacs components
> did not respect my chosen prefix.
>
> It turns out that if pkg-config is available (it is here) then the
> supplied prefix is ignored, in favour of the path returned by pkg-config.
>
> To reproduce this issue, then as a non-root user, using current master:
>
>   ./configure --prefix=$HOME/notmuch-prefix
>   make
>   make install
>
> Assumming that you have pkg-config installed, emacs installed, and the
> command 'pkg-config emacs --variable sitepkglispdir' returns a
> directory that only root can write to, then the make install above
> should fail.
>
> The solution I propose in the patch below is to still apply the
> prefix, even when pkg-config is available; pkg-config is used to
> select the path within the prefix directory.
>
> Would you consider this for inclusion?

perhaps that should be more complex: in case prefix is defined
have $(prefix)/share/emacs/site-lisp in makefile regardless of 
what pkg-config --exists emacs returns...

>
> Thanks,
> Andrew
>
> ---
> When using pkg-config to select the path for the various emacs
> installation directories (the lisp and etc directories), still apply
> the $prefix variable.
> ---
>  configure | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 440d678..4f1db82 100755
> --- a/configure
> +++ b/configure
> @@ -473,7 +473,7 @@ fi
>  
>  if [ -z "${EMACSLISPDIR}" ]; then
>      if pkg-config --exists emacs; then
> -	EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
> +	EMACSLISPDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
>      else
>  	EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
>      fi
> @@ -481,7 +481,7 @@ fi
>  
>  if [ -z "${EMACSETCDIR}" ]; then
>      if pkg-config --exists emacs; then
> -	EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
> +	EMACSETCDIR='$(prefix)'$(pkg-config emacs --variable sitepkglispdir)
>      else
>  	EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
>      fi
> -- 
> 2.5.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.
  2015-11-25 17:32 [PATCH] configure: Use $prefix for emacs, even when pkg-config is available Andrew Burgess
  2015-11-26 18:45 ` Tomi Ollila
@ 2015-11-28 13:07 ` David Bremner
  2015-11-28 15:02   ` Tomi Ollila
  1 sibling, 1 reply; 8+ messages in thread
From: David Bremner @ 2015-11-28 13:07 UTC (permalink / raw)
  To: Andrew Burgess, notmuch

Andrew Burgess <andrew.burgess@embecosm.com> writes:

> Assumming that you have pkg-config installed, emacs installed, and the
> command 'pkg-config emacs --variable sitepkglispdir' returns a
> directory that only root can write to, then the make install above
> should fail.

I agree that the current behaviour is probably wrong. I'm not sure if we
need more control here as Tomi suggests. My biggest concern is that
emacs.pc seems to be rather specific to fedora / redhat packaging, which
makes it hard for me to evaluate both the current handling and this
patch. Do any any Fedora users have opinions on just dropping the
handling of "pkg-config emacs"? Or am I missing other places that
pkg-config file is available?

d

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

* Re: [PATCH] configure: Use $prefix for emacs, even when pkg-config is available.
  2015-11-28 13:07 ` David Bremner
@ 2015-11-28 15:02   ` Tomi Ollila
  2015-12-06 16:04     ` [PATCH] configure: drop use of "pkg-config emacs" David Bremner
  2015-12-06 16:10     ` David Bremner
  0 siblings, 2 replies; 8+ messages in thread
From: Tomi Ollila @ 2015-11-28 15:02 UTC (permalink / raw)
  To: David Bremner, Andrew Burgess, notmuch

On Sat, Nov 28 2015, David Bremner <david@tethera.net> wrote:

> Andrew Burgess <andrew.burgess@embecosm.com> writes:
>
>> Assumming that you have pkg-config installed, emacs installed, and the
>> command 'pkg-config emacs --variable sitepkglispdir' returns a
>> directory that only root can write to, then the make install above
>> should fail.
>
> I agree that the current behaviour is probably wrong. I'm not sure if we
> need more control here as Tomi suggests. My biggest concern is that
> emacs.pc seems to be rather specific to fedora / redhat packaging, which
> makes it hard for me to evaluate both the current handling and this
> patch. Do any any Fedora users have opinions on just dropping the
> handling of "pkg-config emacs"? Or am I missing other places that
> pkg-config file is available?

Now that I looked this a bit more I tend to agree with David:

default PREFIX is /usr/local

and $ pkg-config emacs --variable sitepkglispdir

outputs

/usr/share/emacs/site-lisp

(in default case we should mangle /local/ there in between ... :/ ).

package managers can add 

./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`

in their build scripts.

>
> d

Tomi

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

* [PATCH] configure: drop use of "pkg-config emacs"
  2015-11-28 15:02   ` Tomi Ollila
@ 2015-12-06 16:04     ` David Bremner
  2015-12-06 16:10     ` David Bremner
  1 sibling, 0 replies; 8+ messages in thread
From: David Bremner @ 2015-12-06 16:04 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Andrew Burgess, notmuch

This does not play well with --prefix. As Tomi notes in
id:m2k2p2rwth.fsf@guru.guru-group.fi, people still have the option of

% ./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`
---
 configure | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/configure b/configure
index 440d678..5f3fb9f 100755
--- a/configure
+++ b/configure
@@ -472,11 +472,7 @@ else
 fi
 
 if [ -z "${EMACSLISPDIR}" ]; then
-    if pkg-config --exists emacs; then
-	EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
-    else
-	EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
-    fi
+    EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
 fi
 
 if [ -z "${EMACSETCDIR}" ]; then
-- 
2.6.2

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

* [PATCH] configure: drop use of "pkg-config emacs"
  2015-11-28 15:02   ` Tomi Ollila
  2015-12-06 16:04     ` [PATCH] configure: drop use of "pkg-config emacs" David Bremner
@ 2015-12-06 16:10     ` David Bremner
  2015-12-06 18:10       ` Tomi Ollila
  2015-12-10  1:07       ` David Bremner
  1 sibling, 2 replies; 8+ messages in thread
From: David Bremner @ 2015-12-06 16:10 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Andrew Burgess, notmuch

This does not play well with --prefix. As Tomi notes in
id:m2k2p2rwth.fsf@guru.guru-group.fi, people still have the option of e.g.

% ./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`
---
oops, I missed a second use of pkg-config emacs

configure | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 440d678..abd28da 100755
--- a/configure
+++ b/configure
@@ -472,19 +472,11 @@ else
 fi
 
 if [ -z "${EMACSLISPDIR}" ]; then
-    if pkg-config --exists emacs; then
-	EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
-    else
-	EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
-    fi
+    EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
 fi
 
 if [ -z "${EMACSETCDIR}" ]; then
-    if pkg-config --exists emacs; then
-	EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
-    else
-	EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
-    fi
+    EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
 fi
 
 printf "Checking if emacs is available... "
-- 
2.6.2

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

* Re: [PATCH] configure: drop use of "pkg-config emacs"
  2015-12-06 16:10     ` David Bremner
@ 2015-12-06 18:10       ` Tomi Ollila
  2015-12-10  1:07       ` David Bremner
  1 sibling, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2015-12-06 18:10 UTC (permalink / raw)
  To: David Bremner, Andrew Burgess, notmuch

On Sun, Dec 06 2015, David Bremner <david@tethera.net> wrote:

> This does not play well with --prefix. As Tomi notes in
> id:m2k2p2rwth.fsf@guru.guru-group.fi, people still have the option of e.g.
>
> % ./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`
> ---
> oops, I missed a second use of pkg-config emacs

LGTM. Patch applies. I cannot see how this could fail...

Tomi

>
> configure | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/configure b/configure
> index 440d678..abd28da 100755
> --- a/configure
> +++ b/configure
> @@ -472,19 +472,11 @@ else
>  fi
>  
>  if [ -z "${EMACSLISPDIR}" ]; then
> -    if pkg-config --exists emacs; then
> -	EMACSLISPDIR=$(pkg-config emacs --variable sitepkglispdir)
> -    else
> -	EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
> -    fi
> +    EMACSLISPDIR='$(prefix)/share/emacs/site-lisp'
>  fi
>  
>  if [ -z "${EMACSETCDIR}" ]; then
> -    if pkg-config --exists emacs; then
> -	EMACSETCDIR=$(pkg-config emacs --variable sitepkglispdir)
> -    else
> -	EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
> -    fi
> +    EMACSETCDIR='$(prefix)/share/emacs/site-lisp'
>  fi
>  
>  printf "Checking if emacs is available... "
> -- 
> 2.6.2
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] configure: drop use of "pkg-config emacs"
  2015-12-06 16:10     ` David Bremner
  2015-12-06 18:10       ` Tomi Ollila
@ 2015-12-10  1:07       ` David Bremner
  1 sibling, 0 replies; 8+ messages in thread
From: David Bremner @ 2015-12-10  1:07 UTC (permalink / raw)
  To: Tomi Ollila, Andrew Burgess, notmuch

David Bremner <david@tethera.net> writes:

> This does not play well with --prefix. As Tomi notes in
> id:m2k2p2rwth.fsf@guru.guru-group.fi, people still have the option of e.g.
>
> % ./configure ---emacslispdir=`pkg-config emacs --variable sitepkglispdir`

I have pushed this version

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

end of thread, other threads:[~2015-12-10  1:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 17:32 [PATCH] configure: Use $prefix for emacs, even when pkg-config is available Andrew Burgess
2015-11-26 18:45 ` Tomi Ollila
2015-11-28 13:07 ` David Bremner
2015-11-28 15:02   ` Tomi Ollila
2015-12-06 16:04     ` [PATCH] configure: drop use of "pkg-config emacs" David Bremner
2015-12-06 16:10     ` David Bremner
2015-12-06 18:10       ` Tomi Ollila
2015-12-10  1:07       ` David Bremner

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

	https://yhetil.org/notmuch.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).