RE: Patch for Build under MSW + MSYS2

Vincent Belaïche <[email protected]>
Newsgroups gmane.emacs.bbdb.user
Message-ID <AM5PR10MB0676305A988038F9DF7577A284D80@AM5PR10MB0676.EURPRD10.PROD.OUTLOOK.COM>
Answers below…

De : Roland Winkler <[email protected]>
Envoyé : dimanche 18 février 2018 04:50
À : Vincent Belaïche
Cc : [email protected]
Objet : RE: Patch for Build under MSW + MSYS2 
 
>On Sun Feb 11 2018 Vincent Belaïche wrote:
>> Here are the answers to the two points that you raise:
>> 
>> > - Why is it necessary in a cygwin environment to call cygpath at
>> >  this place?
>
>I am sorry, you misunderstood:
>
>I was not requesting more explanations to be posted on this list but
>some brief explanations becoming part of the patch.  So if one day
>in the future someone stumbles across these lines in Makefile.am and
>knowing as little about these things as I do, he or she might find
>some guidance to understand the code.
>
>Yet with this thread having grown to this point, a link to this
>thread on the GNU list server should be sufficient.  I guess this is
>one of the advantages of the new mailing list: everything will be
>preserved!
OK, done I revised the patch to add a link to this thread.
>
>Yet also one technical question: do you need the square brackets in
>the sed regexp?  I do not see an alternative anymore in the revised
>patch.
You are fully right, the only advantage of the [...] is that it saves
one level of \ escaping. But that makes the code less clear IMHO.
Also, since there is no longer any alternative, we don't need any longer
the \(...\) grouping and \1 recall in the replacement. We can directly
just replace \ by \\.
I did these changes, please find the revised patch attached.
Thank you for your great patience.
  Vincent.
patch-abspath-4.diff (application/octet-stream, 1.4 KB)
diff --git a/ChangeLog b/ChangeLog
index cddbdbf..4662ff5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-07  Vincent Belaïche  <[email protected]>
+
+	* lisp/Makefile.am (abs_target): Make absolute path for
+	bbdb-loaddefs.el MSWindows aware.
+
 2018-01-06  Roland Winkler  <[email protected]>
 	* configure.ac: Increase version number to 3.2.
 
diff --git a/lisp/Makefile.am b/lisp/Makefile.am
index ba54709..7281ab7 100644
--- a/lisp/Makefile.am
+++ b/lisp/Makefile.am
@@ -87,9 +87,16 @@ bbdb-loaddefs.el: $(dist_lisp_LISP)
 	@echo "" >> $@;
 #	Generated autoload-file must have an absolute path,
 #	$srcdir can be relative.
+## The equivalent command line with bash $(...) construct is the following:
+##   abs_target=$$($(CYGPATH_W) $(abs_builddir)/$@ | sed 's/\\/\\\\/g');
+## However \ has to be \-escaped within a backquoted expression.
+## we need the piping to sed because under MSWindows CYGPATH_W output backslash.
+## See the full discussion why this on mailing list archive:
+##    http://lists.nongnu.org/archive/html/bbdb-user/2018-02/msg00000.html
+	abs_target=`$(CYGPATH_W) $(abs_builddir)/$@ | sed 's/\\\\/\\\\\\\\/g'`; \
 	$(EMACS) --batch $(AM_ELCFLAGS) $(ELCFLAGS) \
 		--load autoload \
-		--eval '(setq generated-autoload-file "'$(abs_builddir)/$@'")' \
+		--eval '(setq generated-autoload-file "'"$$abs_target"'")' \
 		--eval '(setq make-backup-files nil)' \
 		--funcall batch-update-autoloads $(srcdir)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.