Jean-Marc Lasgouttes wrote:
> Angus> 1. It defines LYX_ABS_TOP_SRCDIR, LYX_ABS_INSTALLED_LOCALEDIR
> Angus> and LYX_ABS_INSTALLED_DATADIR in a fashion that "makes sense"
> Angus> on Windows and passes these definitions to package.C through
> Angus> the compiler by modifying src/support/Makefile. I think that
> Angus> this part of the patch is "ready to go" now. Agree?

> This is OK, although the AC_DEFINE_UNQUOTED comments should probably
> be removed.

Right. Here're the patches to 1.4 and 1.3. Are you happy with the 1.3
version too? (I'll add ChangeLogs and update status.13x...)

-- 
Angus
Index: config/configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/Attic/configure.ac,v
retrieving revision 1.24.2.35
diff -u -p -r1.24.2.35 configure.ac
--- config/configure.ac	17 Jul 2005 14:33:31 -0000	1.24.2.35
+++ config/configure.ac	29 Sep 2005 12:38:04 -0000
@@ -297,9 +297,16 @@ ${FRONTEND_INFO}\
     LyX binary dir:               ${real_bindir}\n\
     LyX files dir:                ${real_datadir}\n"
 
+real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
+MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_datadir})
 
 AC_SUBST(VERSION_INFO)
 AC_SUBST(RPM_FRONTEND)
+AC_SUBST(LYX_ABS_TOP_SRCDIR)
+AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
+AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
 
 ## Some config.h stuff
 
Index: config/configure.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/Attic/configure.in,v
retrieving revision 1.17.2.33
diff -u -p -r1.17.2.33 configure.in
--- config/configure.in	17 Jul 2005 14:33:31 -0000	1.17.2.33
+++ config/configure.in	29 Sep 2005 12:38:04 -0000
@@ -301,8 +301,16 @@ ${FRONTEND_INFO}\
     LyX binary dir:               ${real_bindir}\n\
     LyX files dir:                ${real_datadir}\n"
 
+real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
+MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_datadir})
+
 AC_SUBST(VERSION_INFO)
 AC_SUBST(RPM_FRONTEND)
+AC_SUBST(LYX_ABS_TOP_SRCDIR)
+AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
+AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
 
 ### Finish the work.
 AC_CONFIG_SUBDIRS(lib lib/reLyX)
Index: config/lyxinclude.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v
retrieving revision 1.81.2.7
diff -u -p -r1.81.2.7 lyxinclude.m4
--- config/lyxinclude.m4	4 Feb 2005 09:14:24 -0000	1.81.2.7
+++ config/lyxinclude.m4	29 Sep 2005 12:38:05 -0000
@@ -750,3 +750,28 @@ if test x"$ac_cv_mkdir_takes_one_arg" = 
             [Define if mkdir takes only one argument.])
 fi
 ])
+
+
+dnl Set VAR to the canonically resolved absolute equivalent of PATHNAME,
+dnl (which may be a relative path, and need not refer to any existing 
+dnl entity).
+
+dnl On Win32-MSYS build hosts, the returned path is resolved to its true
+dnl native Win32 path name, (but with slashes, not backslashes).
+
+dnl On any other system, it is simply the result which would be obtained
+dnl if PATHNAME represented an existing directory, and the pwd command was
+dnl executed in that directory.
+AC_DEFUN([MSYS_AC_CANONICAL_PATH],
+[ac_dir="$2"
+ ( exec 2>/dev/null; cd / && pwd -W ) | grep ':' >/dev/null &&
+    ac_pwd_w="pwd -W" || ac_pwd_w=pwd
+ until ac_val=`exec 2>/dev/null; cd "$ac_dir" && $ac_pwd_w`
+ do
+   ac_dir=`AS_DIRNAME(["$ac_dir"])`
+ done
+ ac_dir=`echo "$ac_dir" | sed 's?^[[./]]*??'`
+ ac_val=`echo "$ac_val" | sed 's?/*$[]??'`
+ $1=`echo "$2" | sed "s?^[[./]]*$ac_dir/*?$ac_val/?"'
+   s?/*$[]??'`
+])
Index: src/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/Makefile.am,v
retrieving revision 1.151.2.3
diff -u -p -r1.151.2.3 Makefile.am
--- src/Makefile.am	10 May 2005 15:00:09 -0000	1.151.2.3
+++ src/Makefile.am	29 Sep 2005 12:38:05 -0000
@@ -225,7 +225,7 @@ lyx_SOURCES = \
 
 main.$(OBJEXT): main.C config.h lyx_main.h gettext.h LString.h \
 	support/filetools.h support/os.h
-	$(CXXCOMPILE) -DLOCALEDIR=\"$(localedir)\" -c $(top_srcdir)/src/main.C
+	$(CXXCOMPILE) -DLOCALEDIR=\"$(LYX_ABS_INSTALLED_LOCALEDIR)\" -c $(top_srcdir)/src/main.C
 
 dist-hook:
 	cd $(distdir) ; rm -rf `find cheaders -name \*CVS\*`
Index: src/support/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/Makefile.am,v
retrieving revision 1.53.2.3
diff -u -p -r1.53.2.3 Makefile.am
--- src/support/Makefile.am	20 Sep 2005 14:46:22 -0000	1.53.2.3
+++ src/support/Makefile.am	29 Sep 2005 12:38:05 -0000
@@ -75,10 +75,8 @@ package.lo: ../config.h \
 	$(top_srcdir)/src/gettext.h $(top_srcdir)/src/Lsstream.h \
 	$(top_srcdir)/src/LString.h
 	$(CXXCOMPILE) \
-		-DLYX_DIR=\"$(pkgdatadir)\" \
-		-DTOP_SRCDIR=\"$(top_srcdir)\" \
-		-DLOCALEDIR=\"$(localedir)\" \
+		-DLYX_DIR=\"$(LYX_ABS_INSTALLED_DATADIR)\" \
+		-DTOP_SRCDIR=\"$(LYX_ABS_TOP_SRCDIR)\" \
+		-DLOCALEDIR=\"$(LYX_ABS_INSTALLED_LOCALEDIR)\" \
 		-c $(top_srcdir)/src/support/package.C && \
 	echo "timestamp" > $@
-
-
Index: configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/configure.ac,v
retrieving revision 1.60
diff -u -p -r1.60 configure.ac
--- configure.ac	14 Sep 2005 07:53:05 -0000	1.60
+++ configure.ac	29 Sep 2005 12:08:24 -0000
@@ -306,7 +306,6 @@ AC_CHECK_FUNCS(fcntl,, [lyx_client_subdi
 AM_CONDITIONAL(BUILD_CLIENT_SUBDIR, $lyx_client_subdir)
 AC_LANG_POP(C)
 
-
 AC_FUNC_SELECT_ARGTYPES
 
 ### Some information on what just happened
@@ -328,6 +327,10 @@ ${FRONTEND_INFO}\
   LyX binary dir:                 ${real_bindir}\n\
   LyX files dir:                  ${real_datadir}\n"
 
+real_localedir=`eval "echo \`eval \"echo ${datadir}/locale\"\`"`
+MSYS_AC_CANONICAL_PATH(LYX_ABS_TOP_SRCDIR, ${srcdir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_LOCALEDIR, ${real_localedir})
+MSYS_AC_CANONICAL_PATH(LYX_ABS_INSTALLED_DATADIR, ${real_datadir})
 
 AC_SUBST(VERSION_INFO)
 AC_SUBST(RPM_FRONTEND)
@@ -335,6 +338,9 @@ AC_SUBST(AM_CPPFLAGS)
 AC_SUBST(AM_CXXFLAGS)
 AC_SUBST(AM_CFLAGS)
 AC_SUBST(AM_LDFLAGS)
+AC_SUBST(LYX_ABS_TOP_SRCDIR)
+AC_SUBST(LYX_ABS_INSTALLED_LOCALEDIR)
+AC_SUBST(LYX_ABS_INSTALLED_DATADIR)
 
 ## Some config.h stuff
 
Index: config/lyxinclude.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v
retrieving revision 1.115
diff -u -p -r1.115 lyxinclude.m4
--- config/lyxinclude.m4	26 Sep 2005 09:08:41 -0000	1.115
+++ config/lyxinclude.m4	29 Sep 2005 12:08:28 -0000
@@ -666,3 +666,28 @@ if test x"$ac_cv_mkdir_takes_one_arg" = 
             [Define if mkdir takes only one argument.])
 fi
 ])
+
+
+dnl Set VAR to the canonically resolved absolute equivalent of PATHNAME,
+dnl (which may be a relative path, and need not refer to any existing 
+dnl entity).
+
+dnl On Win32-MSYS build hosts, the returned path is resolved to its true
+dnl native Win32 path name, (but with slashes, not backslashes).
+
+dnl On any other system, it is simply the result which would be obtained
+dnl if PATHNAME represented an existing directory, and the pwd command was
+dnl executed in that directory.
+AC_DEFUN([MSYS_AC_CANONICAL_PATH],
+[ac_dir="$2"
+ ( exec 2>/dev/null; cd / && pwd -W ) | grep ':' >/dev/null &&
+    ac_pwd_w="pwd -W" || ac_pwd_w=pwd
+ until ac_val=`exec 2>/dev/null; cd "$ac_dir" && $ac_pwd_w`
+ do
+   ac_dir=`AS_DIRNAME(["$ac_dir"])`
+ done
+ ac_dir=`echo "$ac_dir" | sed 's?^[[./]]*??'`
+ ac_val=`echo "$ac_val" | sed 's?/*$[]??'`
+ $1=`echo "$2" | sed "s?^[[./]]*$ac_dir/*?$ac_val/?"'
+   s?/*$[]??'`
+])
Index: src/support/Makefile.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/Makefile.am,v
retrieving revision 1.95
diff -u -p -r1.95 Makefile.am
--- src/support/Makefile.am	10 Sep 2005 15:48:17 -0000	1.95
+++ src/support/Makefile.am	29 Sep 2005 12:08:34 -0000
@@ -84,11 +84,9 @@ package.C: build_package
 # Solaris sed does not like spaces bewteen the ;-delimited commands
 build_package: package.C.in
 	@rm -f tmp_package ;\
-	ABS_SRCDIR=`cd $(top_srcdir) && pwd` ;\
-	ABS_BUILDDIR=`cd ../.. && pwd` ;\
-	sed "s,%LYX_DIR%,$(pkgdatadir),;\
-s,%LOCALEDIR%,$(datadir)/locale,;\
-s,%TOP_SRCDIR%,$${ABS_SRCDIR}," \
+	sed "s,%LYX_DIR%,$(LYX_ABS_INSTALLED_DATADIR),;\
+s,%LOCALEDIR%,$(LYX_ABS_INSTALLED_LOCALEDIR),;\
+s,%TOP_SRCDIR%,$(LYX_ABS_TOP_SRCDIR)," \
 		$(srcdir)/package.C.in > tmp_package ;\
 	if cmp -s tmp_package package.C ; then \
 		rm -f tmp_package ;\

Reply via email to