On Sun, 12 Feb 2006 14:47:10 -0800, Stephen Harris wrote:
> 
> Hello Enrico,
> 
> Thanks for your Howto, it looks like you did a lot of work on it!
> I forwarded a copy to Shenghua and asked him to make notes. Maybe
> the Cygwin maintainers will add LyX back into the downloadable
> package list once the installation is smoothed out. I once had
> the Cygwin 1.3.1 port by Claus Hentschel working.
> http://wwwserv1.rz.fh-hannover.de/mbau/tim/hentschel/lyx/
> He provided a method to add LyX to the Cygin downloaded packages.
> I think it is good to have installation instructions archived.

Yes, I also had that port. Actually, it was because of that port (and
cygwin) that I began booting Windows instead of Linux on my laptop ;-)

My idea is to provide a cygwin package for LyX. This could be hosted on
the ftp.lyx.org server with all other binary packages.
I don't know about an official cygwin package, because they require that a
package be compilable from sources and I don't use their Qt/X11 package.
Then, I don't know if I'll have the time to support the package, but I
think that once you start it someone else could take over ;-)

As regards the howto, I am attaching a revised version here. In the
previous version, step 5) can be safely skipped: it was a remnant of
another howto (how to compile a mingw LyX using cygwin).

Once things settle, most of the howto can be replaced by a single patch
file to be applied to the Qt sources.

--
Enrico


In this howto all examples are shown for tcsh, but it is trivial to change them
for bash. Mainly, it is simply a matter of substituting "export XXX=YYY" in
place of "setenv XXX YYY" (or simply use tcsh instead of bash).


QT3/Windows Free Edition
------------------------

In the following, it is assumed that the Qt sources are in /usr/local/src/qt3.
If you have them in another place, simply replace the above path with what is
appropriate.

The Qt sources can be obtained though CVS. In /usr/local/src enter

   $ setenv CVSROOT ":pserver:[EMAIL PROTECTED]:/cvsroot/qtwin"
   $ cvs login
   <return> (no password)
   $ cvs -z9 -r QT_WIN32_3_3_BRANCH -d qt3 qt-3


1) Add the following line

   export QTDIR=/usr/local/src/qt3

   at the very start of the following sh scripts:

   config.tests/unix/endian.test
   config.tests/unix/ipv6.test
   config.tests/unix/largefile.test
   config.tests/unix/ptrsize.test
   config.tests/unix/stl.test

2) Add the following line to mkspecs/cygwin-g++-win32/qmake.conf
   (immediately after the line "CONFIG +=")

   DEFINES += UNICODE


3) Add the following lines at the very start of
   mkspecs/cygwin-g++-win32/qplatformdefs.h

   #ifdef UNICODE
   #ifndef _UNICODE
   #define _UNICODE
   #endif
   #endif

4) Add the "-f" flag to ln in qmake/Makefile.unix
   (in the qmake: target) as follows:

   ln -s -f ../qmake/$@ @BUILD_PATH@/bin/$@

5) For the CVS version that I checked out, I also had to add some #include's
   to src/kernel/qapplication_win.cpp and src/kernel/qfont_win.cpp:

   $ diff qapplication_win.cpp.orig qapplication_win.cpp
   47a48,49
   > #include <locale.h>
   > #include <ctype.h>

   $ diff qfont_win.cpp.orig qfont_win.cpp
   64a65
   > #include <locale.h>


6) In src/kernel/qapplication_win.cpp substitute _flushall()
   with the following code:

   #if defined (Q_OS_CYGWIN)
            fflush(NULL);
   #else
            _flushall();
   #endif

7) Protect the inclusion of winsock.h in src/kernel/qeventloop_win.cpp:

   #if !defined (Q_OS_CYGWIN)
   #include <winsock.h>
   #endif

8) Protect the definition of QT_WA in src/network/qdns.cpp:

   #if !defined (QT_WA)
   #define QT_WA( uni, ansi ) ansi
   #endif

9) In tools/designer/app/app.pro change the occurrence of "designercore.lib"
   into "libdesignercore.a"

10) Apply the qtfix.diff patch:

   $ cd /usr/local/src/qt3
   $ patch -p0 < /path/to/qtfix.diff

11) Configure and compile Qt

   $ setenv QTDIR /usr/local/src/qt3
   $ setenv PATH "$QTDIR/bin:$PATH"
   $ ./configure -platform cygwin-g++-win32 -v -release -static -qt-imgfmt-png 
-qt-imgfmt-jpeg -qt-imgfmt-mng -no-exceptions -disable-opengl -disable-sql 
-disable-network -no-style-compact -no-style-cde -no-style-motif 
-no-style-motifplus -no-style-platinum -no-style-sgi -no-sm -no-xft -no-xkb 
-no-xrender --enable-accessibility

   (Please, note the double '-' in --enable-accessibility above)

   Now edit Makefile and comment out sub-tutorial and sub-examples
   (in the all: target) placing '#' in front of sub-tutorial as follows:

   all: symlinks src-qmake src-moc sub-src sub-tools #sub-tutorial sub-examples

   $ make

12) Install a minimal Qt (such that the source tree could even be deleted)

   $ mkdir -p /usr/local/qt-cygwin/bin
   $ mkdir /usr/local/qt-cygwin/include /usr/local/qt-cygwin/lib
   $ cp -p /usr/local/src/qt3/bin/{moc.exe,uic.exe} /usr/local/qt-cygwin/bin/
   $ strip /usr/local/qt-cygwin/bin/{moc.exe,uic.exe}
   $ cp -p /usr/local/src/qt3/lib/libqt.{a,la,prl} /usr/local/qt-cygwin/lib/
   $ cd /usr/local/src/qt3/include
   $ tar cf - . | (cd /usr/local/qt-cygwin/include; tar xvBpf -)
   $ rm -rf /usr/local/qt-cygwin/include/CVS

   Now edit /usr/local/qt-cygwin/lib/libqt.la and change
   a) "library_names='libqt.dll.a'" to "library_names='libqt.a'"
   b) "libdir='/usr/local/qt3/src/lib'" to "libdir='/usr/local/qt-cygwin/lib'"



LyX
---

1) Unpack lyx-1.4.0pre4.tar.bz2 in /usr/local/src

2) Apply the following patch:

   --- src/frontends/qt2/FileDialog.C.orig 2005-01-19 16:03:30.000000000 +0100
   +++ src/frontends/qt2/FileDialog.C      2006-02-12 19:50:24.000000000 +0100
   @@ -30,7 +30,7 @@
     *
     * Therefore there is a tradeoff in enabling or disabling this (JMarc)
     */
   -#ifdef Q_WS_MACX
   +#if defined(Q_WS_MACX) || defined(Q_CYGWIN_WIN)
    #define USE_NATIVE_FILEDIALOG 1
    #endif
 

3) Configure LyX

   $ cd /usr/local/src
   $ ./lyxconfig-cygwin lyx-1.4.0pre4 static

4) Add the following lines to src/config.h (at the bottom)

   #if defined(X_DISPLAY_MISSING) && defined(__CYGWIN__)
   #define Q_CYGWIN_WIN 1
   #endif

5) Compile and install LyX

   $ cd lyx-1.4.0pre4/build
   $ make
   $ make install

***** The End *****

Reply via email to