>>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes:

Angus> I assume that the idea is to have a
Angus> "--packaging={windows,macosx,posix}" option to configure. Not
Angus> passing "--packaging=foo" on the command line will lead to the
Angus> "native" packaging being chosen. The three macros above will be
Angus> defined appropriately in config.h.

Yes. The following patch does just that.

Angus> However, it seems that this option should have an effect only
Angus> on the Mac and, moreover, will respect only the {macosx,posix}
Angus> strings.

Let's say we trust configure to do the right thing. So if macosx is
the packaging, the user should really have the relevant API available.

I have to note that the patch below has issues:

- the places where autoconf wants to install system_lyxdir is always
  $datadir/$PACKAGE (hardcoded in the Makefile, not produced by
  configure). This means that we get for MacOSX

  Packaging:                      macosx
    LyX binary dir:               /Applications/LyX.app/Contents/MacOS
    LyX files dir:                /Applications/LyX.app/Contents/Resources/lyx

  It should be possible to hack around it, but I suspect it is asking
  for trouble. I propose to keep this extra 'lyx' directory under
  Resources to avoid problems. OK?

- the same holds for windows, but here the situation is a bit worse:

configure: configuring in lib/reLyX
configure: running /bin/sh '../../../1.3.x/lib/reLyX/configure' 
--prefix=C:Program Files/LyX  '--enable-maintainer-mode' '--disable-debug' 
'--disable-optimization' '--with-frontend=qt' '--with-qt-dir=/usr/lib/qt-3.1' 
'--with-packaging=windows' --cache-file=/dev/null 
--srcdir=../../../1.3.x/lib/reLyX
configure: WARNING: you should use --build, --host, --target
configure: WARNING: invalid host type: Files/LyX
configure: error: expected an absolute directory name for --prefix: C:Program
configure: error: /bin/sh '../../../1.3.x/lib/reLyX/configure' failed for 
lib/reLyX

However, I do not know what happens on mingw/msys, of course.


Anyway, here is it so that you can play a bit. I do not have specific
plans to improve it, so it's yours if you want it.

JMarc

Index: config/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/ChangeLog,v
retrieving revision 1.86.2.32
diff -u -p -r1.86.2.32 ChangeLog
--- config/ChangeLog	4 Jan 2005 13:24:51 -0000	1.86.2.32
+++ config/ChangeLog	6 Jan 2005 12:36:55 -0000
@@ -1,3 +1,10 @@
+2005-01-06  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* configure.ac: 
+	* configure.in: use LYX_USE_PACKAGING
+
+	* lyxinclude.m4 (LYX_USE_PACKAGING): new macro.
+
 2005-01-04  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* configure.ac, configure.in (AC_CHECK_FUNCS): test for the
Index: config/configure.ac
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/Attic/configure.ac,v
retrieving revision 1.24.2.26
diff -u -p -r1.24.2.26 configure.ac
--- config/configure.ac	4 Jan 2005 13:24:51 -0000	1.24.2.26
+++ config/configure.ac	6 Jan 2005 12:36:55 -0000
@@ -22,10 +22,6 @@ AM_INIT_AUTOMAKE($lyxname, $VERSION)
 # that are complete enough to be useful). This is needed by GNU gettext
 ALL_LINGUAS="da de es eu fi fr it nl nn no pl ro ru sk sl"
 
-# fix the value of the prefixes.
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
 ### Set the execute permissions of the various scripts correctly
 for file in config/install-sh config/mkinstalldirs lib/configure ; do
   chmod 755 ${srcdir}/${file}
@@ -208,6 +204,12 @@ dnl	;;
     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
 esac
 
+### Check how the files should be packaged
+LYX_USE_PACKAGING
+# fix the value of the prefixes.
+test "x$prefix" = xNONE && prefix=$default_prefix
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
 ### Setup GNU gettext
 dnl GNU gettext is written in C
 AC_LANG_PUSH(C)
@@ -281,8 +283,9 @@ VERSION_INFO="Configuration\n\
   Linker flags:                   ${LDFLAGS}\n\
   Frontend:                       ${lyx_use_frontend}\n\
 ${FRONTEND_INFO}\
-  LyX binary dir:                 ${real_bindir}\n\
-  LyX files dir:                  ${real_datadir}\n"
+  Packaging:                      ${lyx_use_packaging}\n\
+    LyX binary dir:               ${real_bindir}\n\
+    LyX files dir:                ${real_datadir}\n"
 
 
 AC_SUBST(VERSION_INFO)
Index: config/configure.in
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/Attic/configure.in,v
retrieving revision 1.17.2.24
diff -u -p -r1.17.2.24 configure.in
--- config/configure.in	4 Jan 2005 13:24:51 -0000	1.17.2.24
+++ config/configure.in	6 Jan 2005 12:36:55 -0000
@@ -22,10 +22,6 @@ AM_INIT_AUTOMAKE($lyxname, $VERSION)
 # that are complete enough to be useful). This is needed by GNU gettext
 ALL_LINGUAS="da de es eu fi fr it nl nn no pl ro ru sk sl"
 
-# fix the value of the prefixes.
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
 ### Set the execute permissions of the various scripts correctly
 for file in config/install-sh config/mkinstalldirs lib/configure ; do
   chmod 755 ${srcdir}/${file}
@@ -215,6 +211,12 @@ dnl     FRONTEND_LIBS="@XPM_LIB@ @XFORMS
     LYX_ERROR(Unknown frontend $lyx_use_frontend);;
 esac
 
+### Check how the files should be packaged
+LYX_USE_PACKAGING
+# fix the value of the prefixes.
+test "x$prefix" = xNONE && prefix=$default_prefix
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
 ### Setup GNU gettext
 dnl GNU gettext is written in C
 AC_LANG_C
@@ -285,9 +287,9 @@ VERSION_INFO="Configuration\n\
   Linker flags:                   ${LDFLAGS}\n\
   Frontend:                       ${lyx_use_frontend}\n\
 ${FRONTEND_INFO}\
-  LyX binary dir:                 ${real_bindir}\n\
-  LyX files dir:                  ${real_datadir}\n"
-
+  Packaging:                      ${lyx_use_packaging}\n\
+    LyX binary dir:               ${real_bindir}\n\
+    LyX files dir:                ${real_datadir}\n"
 
 AC_SUBST(VERSION_INFO)
 AC_SUBST(RPM_FRONTEND)
Index: config/lyxinclude.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v
retrieving revision 1.81.2.3
diff -u -p -r1.81.2.3 lyxinclude.m4
--- config/lyxinclude.m4	15 Dec 2004 21:03:56 -0000	1.81.2.3
+++ config/lyxinclude.m4	6 Jan 2005 12:36:55 -0000
@@ -657,6 +657,37 @@ AC_SUBST(FRONTEND_INCLUDES)
 AC_SUBST(FRONTEND_LIBS)
 ])
 
+## Check what kind of packaging should be used at install time. 
+## The default is autodetected. 
+AC_DEFUN([LYX_USE_PACKAGING],
+[AC_MSG_CHECKING([what packaging should be used])
+AC_ARG_WITH(packaging,
+  [  --with-packaging=THIS   Use THIS packaging for installation:
+			    Possible values: posix, windows, macosx],
+  [lyx_use_packaging="$withval"], [
+  case $host in
+    *-apple-darwin*) lyx_use_packaging=macosx ;;
+     *-pc-mingw32-*) lyx_use_packaging=windows;;
+                  *) lyx_use_packaging=posix;;
+  esac])
+AC_MSG_RESULT($lyx_use_packaging)
+case $lyx_use_packaging in 
+   macosx) AC_DEFINE(USE_MACOSX_PACKAGING, 1, [Define to 1 if LyX should use a MacOS X application bundle file layout]) 
+           default_prefix="/Applications/LyX.app"
+	   bindir='${prefix}/Contents/MacOS'
+	   datadir='${prefix}/Contents/Resources'
+	   mandir='${prefix}/Contents/Resources/man' ;;
+  windows) AC_DEFINE(USE_WINDOWS_PACKAGING, 1, [Define to 1 if LyX should use a Windows-stlye file layout]) 
+           default_prefix="C:Program Files/LyX"
+	   bindir='${prefix}/bin'
+	   datadir='${prefix}/Resources'
+	   mandir='${prefix}/Resources/man' ;;
+    posix) AC_DEFINE(USE_POSIX_PACKAGING, 1, [Define to 1 if LyX should use a POSIX-style file layout]) 
+	   default_prefix=$ac_default_prefix ;;
+    *) LYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;;
+esac
+])
+
 
 
 ## ------------------------------------------------------------------------

Reply via email to