all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Richard Copley <rcopley@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	14513@debbugs.gnu.org
Subject: bug#14513: 24.3.50; Site load-path pieces differ in MSYS build
Date: Sun, 2 Jun 2013 12:33:08 +0100	[thread overview]
Message-ID: <CAPM58oiLdD2THzX+M+hNAWmO8P_xcpLJkDFuG0T-zcToQLAC7g@mail.gmail.com> (raw)
In-Reply-To: <CAPM58ohc2pgdCQbKkopoxx3=v626mZwv8EScyCYveo2EXNquGg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1685 bytes --]

On 1 June 2013 17:38, Eli Zaretskii <eliz@gnu.org> wrote:

> Does it support Windows style paths and the ';' separator, as in
>
>   --locallisppath='%emacs_dir%/../site-lisp;d:/wherever/site-lisp'
>
> ?  MSYS supports both Windows style file names and Windows style in
> --prefix, so I'd like to support both styles in --locallisppath.
>

> Date: Sat, 1 Jun 2013 18:25:14 +0100
> From: Richard Copley <rcopley@gmail.com>
> [...] that's not possible without resorting to
> heuristics, because ${locallisppath} is potentially a ":"-separated path.

The attached patch supports both styles. The heuristics didn't turn
out to be as hairy as I imagined.

A few test cases:

nt/msysconfig.sh
#define PATH_SITELOADSEARCH
"%emacs_dir%/share/emacs/24.3.50/site-lisp;%emacs_dir%/share/emacs/site-lisp"

nt/msysconfig.sh --prefix c:/emacs/emacs-112809
#define PATH_SITELOADSEARCH
"%emacs_dir%/share/emacs/24.3.50/site-lisp;%emacs_dir%/share/emacs/site-lisp"

nt/msysconfig.sh --prefix="c:\\Program Files (x86)\\Emacs"
#define PATH_SITELOADSEARCH
"%emacs_dir%/share/emacs/24.3.50/site-lisp;%emacs_dir%/share/emacs/site-lisp"

nt/msysconfig.sh --prefix="c:/Program Files (x86)/Emacs"
--enable-locallisppath="%emacs_dir%/../site-lisp;d:/wherever/site-lisp"
#define PATH_SITELOADSEARCH
"%emacs_dir%/../site-lisp/;d:/wherever/site-lisp"

nt/msysconfig.sh --prefix="c:/Program Files (x86)/Emacs"
--enable-locallisppath="%emacs_dir%/../site-lisp;/d/wherever/site-lisp"
#define PATH_SITELOADSEARCH
"%emacs_dir%/../site-lisp/;d:/wherever/site-lisp"

nt/msysconfig.sh --prefix="/usr/local"
--enable-locallisppath="/usr/local/share/my-site-lisp"
#define PATH_SITELOADSEARCH "%emacs_dir%/share/my-site-lisp"

[-- Attachment #1.2: Type: text/html, Size: 2368 bytes --]

[-- Attachment #2: msys-locallisppath-revised.patch --]
[-- Type: application/octet-stream, Size: 3666 bytes --]

=== modified file 'Makefile.in'
--- Makefile.in	2013-05-16 09:58:56 +0000
+++ Makefile.in	2013-06-02 10:31:58 +0000
@@ -318,14 +318,33 @@
 	  -e 's;\(#.*PATH_DOC\).*$$;\1 "${docdir}";') &&		\
 	${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
 
-# Convert MSYS-style /x/foo file name into x:/foo that Windows can grok.
-msys_to_w32=sed -e 's,^/\([A-Za-z]\)/,\1:/,'
+# Convert MSYS-style /x/foo or x:\foo file name into x:/foo that Windows can grok.
+msys_to_w32=sed -e 's,\\\\,/,g' -e 's,^/\([A-Za-z]\)/,\1:/,'
+
+# Transform directory search path and its components. Original can
+# be MSYS or Windows style. Set path separator to ";", directory
+# separator to "/" and transform MSYS-style "/c/" to "c:/".
+# Remove empty path components and escape semicolons.
+msys_lisppath_to_w32=sed -e 's,\\\\,/,g' -e 's,\(^\|[:;]\)\([A-Za-z]\):/,\1/\2/,g'	\
+			 -e 's/:/;/g' -e 's,\(^\|;\)/\([A-Za-z]\)/,\1\2:/,g'	\
+			 -e 's/;\+/;/g' -e 's/^;//' -e 's/;$$//' -e 's/;/\\\\;/g'
+
+# Replace "${prefix}" with '%emacs_dir%' (expands to install directory at runtime).
+msys_prefix_subst=sed -e 's!\(^\|;\)'"$${prefixpattern}"'\([;/]\|$$\)!\1%emacs_dir%\2!g'
+
+# Quote sed special characters (except backslash and newline) with double backslash.
+msys_sed_sh_escape=sed -e 's/[];$$*.^[]/\\\\&/g'
 
 # The w32 build needs a slightly different editing, and it uses
 # nt/epaths.nt as the template.
+# Use the value of ${locallisppath} supplied by `configure',
+# to support the --enable-locallisppath argument.
 epaths-force-w32: FRC
 	@(w32srcdir=`echo "${srcdir}" | ${msys_to_w32}` ; 	\
+	  prefixpattern=`echo '${prefix}' | ${msys_to_w32} | ${msys_sed_sh_escape}` ; \
+	  locallisppath=`echo '${locallisppath}' | ${msys_lisppath_to_w32} | ${msys_prefix_subst}` ; \
 	  sed < ${srcdir}/nt/epaths.nt > epaths.h.$$$$		\
+	  -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${locallisppath}"'";' \
 	  -e '/^.*#/s/@VER@/${version}/g' 			\
 	  -e '/^.*#/s/@CFG@/${configuration}/g' 		\
 	  -e "/^.*#/s|@SRC@|$${w32srcdir}|g") &&		\

=== modified file 'nt/epaths.nt'
--- nt/epaths.nt	2013-04-06 13:25:17 +0000
+++ nt/epaths.nt	2013-06-02 10:31:58 +0000
@@ -41,10 +41,10 @@
 #define PATH_LOADSEARCH "%emacs_dir%/share/emacs/@VER@/lisp;%emacs_dir%/share/emacs/@VER@/leim"
 
 /* Like PATH_LOADSEARCH, but contains the non-standard pieces.
-   These are the site-lisp directories, typically something like
+   These are the site-lisp directories. Configure sets this to
+   ${locallisppath}, which typically defaults to something like:
    <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp
-   Configure prepends any $locallisppath, as set by the
-   --enable-locallisppath argument.
+   but can be overridden by the --enable-locallisppath argument.
    This is combined with PATH_LOADSEARCH to make the default load-path.
    If the --no-site-lisp option is used, this piece is excluded.
 */

=== modified file 'src/epaths.in'
--- src/epaths.in	2013-01-01 09:11:05 +0000
+++ src/epaths.in	2013-06-02 10:31:58 +0000
@@ -30,10 +30,10 @@
 
 
 /* Like PATH_LOADSEARCH, but contains the non-standard pieces.
-   These are the site-lisp directories, typically something like
+   These are the site-lisp directories. Configure sets this to
+   ${locallisppath}, which typically defaults to something like:
    <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp
-   Configure prepends any $locallisppath, as set by the
-   --enable-locallisppath argument.
+   but can be overridden by the --enable-locallisppath argument.
    This is combined with PATH_LOADSEARCH to make the default load-path.
    If the --no-site-lisp option is used, this piece is excluded.
 */


  reply	other threads:[~2013-06-02 11:33 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 13:46 bug#14513: 24.3.50; Site load-path pieces differ in MSYS build Richard Copley
2013-05-30 16:40 ` Eli Zaretskii
2013-05-30 17:56   ` Richard Copley
2013-05-30 18:20     ` Eli Zaretskii
2013-05-30 19:02       ` Achim Gratz
2013-05-30 19:16         ` Eli Zaretskii
2013-05-30 19:57           ` Achim Gratz
2013-05-30 20:39             ` Eli Zaretskii
2013-05-30 21:21               ` Stefan Monnier
2013-05-31 19:01               ` Achim Gratz
2013-05-31 19:24                 ` Eli Zaretskii
2013-05-30 19:06       ` Stefan Monnier
2013-05-30 19:18         ` Eli Zaretskii
2013-05-30 19:20       ` Richard Copley
     [not found]       ` <CAPM58ojwzkw8kxKc8P4G0mdsJgmYmo-ZxSbcN1F2J+QVyFaHMw@mail.gmail.com>
2013-05-30 19:29         ` Eli Zaretskii
2013-05-30 20:00           ` Stefan Monnier
2013-05-30 20:42             ` Eli Zaretskii
2013-05-30 21:43               ` Stefan Monnier
2013-05-31  6:20                 ` Eli Zaretskii
2013-05-31  9:52                   ` Richard Copley
2013-05-31 11:35                     ` Eli Zaretskii
2013-05-31 12:55                       ` Richard Copley
2013-06-01 16:04                         ` Richard Copley
2013-06-01 16:38                           ` Eli Zaretskii
2013-06-01 17:06                             ` Richard Copley
     [not found]                               ` <CAPM58og6ySbmR28vQH+m7dp-zYgVwrrYqthO6_ZfGodV9Si23w@mail.gmail.com>
     [not found]                                 ` <8361xx20lb.fsf@gnu.org>
2013-06-01 18:00                                   ` Richard Copley
2013-06-02 11:33                                     ` Richard Copley [this message]
2013-06-04 18:27                                       ` Richard Copley
2013-06-04 19:37                                         ` Eli Zaretskii
2013-06-04 20:14                                           ` Richard Copley
2013-06-04 20:21                                             ` Glenn Morris
2013-06-07  8:14                                       ` Eli Zaretskii
2013-06-07 17:48                                         ` Richard Copley
2013-06-04 23:55                   ` Juanma Barranquero
2013-06-06 15:37                     ` Eli Zaretskii
2013-06-07  1:49                       ` Juanma Barranquero
2013-06-07  6:51                         ` Eli Zaretskii
     [not found]         ` <83ip20469l.fsf@gnu.org>
2013-05-30 19:29           ` bug#14514: Fwd: " Richard Copley
2013-05-30 19:49             ` bug#14513: " Richard Copley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPM58oiLdD2THzX+M+hNAWmO8P_xcpLJkDFuG0T-zcToQLAC7g@mail.gmail.com \
    --to=rcopley@gmail.com \
    --cc=14513@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.