Add some cygwin stuff.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@30332 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2009-07-01 21:10:00 +00:00
parent 10f68d0215
commit 8359be573d
10 changed files with 266 additions and 1 deletions

View File

@ -609,6 +609,7 @@ AC_ARG_WITH(packaging,
esac]) esac])
AC_MSG_RESULT($lyx_use_packaging) AC_MSG_RESULT($lyx_use_packaging)
lyx_install_macosx=false lyx_install_macosx=false
lyx_install_cygwin=false
case $lyx_use_packaging in 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]) macosx) AC_DEFINE(USE_MACOSX_PACKAGING, 1, [Define to 1 if LyX should use a MacOS X application bundle file layout])
PACKAGE=LyX${version_suffix} PACKAGE=LyX${version_suffix}
@ -631,10 +632,14 @@ case $lyx_use_packaging in
PACKAGE=lyx${version_suffix} PACKAGE=lyx${version_suffix}
program_suffix=$version_suffix program_suffix=$version_suffix
pkgdatadir='${datadir}/${PACKAGE}' pkgdatadir='${datadir}/${PACKAGE}'
default_prefix=$ac_default_prefix ;; default_prefix=$ac_default_prefix
case ${host} in
*cygwin*) lyx_install_cygwin=true ;;
esac ;;
*) LYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;; *) LYX_ERROR([Unknown packaging type $lyx_use_packaging]) ;;
esac esac
AM_CONDITIONAL(INSTALL_MACOSX, $lyx_install_macosx) AM_CONDITIONAL(INSTALL_MACOSX, $lyx_install_macosx)
AM_CONDITIONAL(INSTALL_CYGWIN, $lyx_install_cygwin)
dnl Next two lines are only for autoconf <= 2.59 dnl Next two lines are only for autoconf <= 2.59
datadir='${datarootdir}' datadir='${datarootdir}'
AC_SUBST(datarootdir) AC_SUBST(datarootdir)

View File

@ -433,6 +433,8 @@ AC_CONFIG_FILES([Makefile \
development/MacOSX/Info.plist \ development/MacOSX/Info.plist \
development/MacOSX/lyxrc.dist \ development/MacOSX/lyxrc.dist \
development/MacOSX/spotlight/Makefile \ development/MacOSX/spotlight/Makefile \
development/cygwin/Makefile \
development/cygwin/lyxrc.dist \
development/lyx.spec \ development/lyx.spec \
intl/Makefile \ intl/Makefile \
lib/Makefile \ lib/Makefile \

View File

@ -4,6 +4,10 @@ if INSTALL_MACOSX
SUBDIRS = MacOSX SUBDIRS = MacOSX
endif endif
if INSTALL_CYGWIN
SUBDIRS = cygwin
endif
EXTRA_DIST = boostworkaround.txt coding/Rules coding/Recommendations \ EXTRA_DIST = boostworkaround.txt coding/Rules coding/Recommendations \
FORMAT lyx.rpm.README \ FORMAT lyx.rpm.README \
lyxserver lyx.spec.in lyx.spec Seminar.txt \ lyxserver lyx.spec.in lyx.spec Seminar.txt \

View File

@ -0,0 +1,20 @@
include $(top_srcdir)/config/common.am
.c.o:
$(CC) -I$(top_builddir) $< -O2 -c -o $@ -mwindows -e _mainCRTStartup
.rc.o:
cp $(top_srcdir)/development/Win32/packaging/icons/lyx_*32x32.ico .
windres -I$(top_builddir) --preprocessor "$(CPP) -xc-header -DRC_INVOKED" $< -o $@
bin_PROGRAMS = lyxeditor lyxwin
bin_SCRIPTS = lyxeditor.sh
dist_noinst_DATA = lyxprofile
lyxeditor_SOURCES = lyxeditor.c
lyxwin_SOURCES = lyxwin.c lyxwinres.rc
CLEANFILES += lyxeditor.sh lyx_32x32.ico lyx_doc_32x32.ico
lyxeditor.sh:
cp $(top_srcdir)/development/tools/lyxeditor $@

View File

@ -0,0 +1,43 @@
/**
* \file lyxeditor.c
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Enrico Forestieri
*
* Full author contact details are available in file CREDITS.
*
* This is a wrapper program for the lyxeditor.sh script or lyxclient program,
* meant to be used with yap or sumatrapdf for inverse search.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/cygwin.h>
#include <windows.h>
int main(int ac, char **av)
{
char buf[2 * PATH_MAX];
char posixpath[PATH_MAX + 1];
if (ac < 3 || ac > 4) {
MessageBox(0, "Usage: lyxeditor [-g] <file.tex> <lineno>",
"ERROR: Wrong number of arguments", 0);
return 1;
}
if (ac == 3) {
cygwin_conv_to_full_posix_path(av[1], posixpath);
sprintf(buf, "lyxeditor.sh" PROGRAM_SUFFIX " '%s' %s",
posixpath, av[2]);
} else {
cygwin_conv_to_full_posix_path(av[2], posixpath);
sprintf(buf, "lyxclient" PROGRAM_SUFFIX " %s '%s' %s",
av[1], posixpath, av[3]);
}
system(buf);
return 0;
}

View File

@ -0,0 +1,52 @@
# Set up the home directory if not already set in the system environment.
if [ -z "${HOME}" ]; then
USER=`id -un`
HOME=`grep "^${USER}:" /etc/passwd | cut -d: -f6`
if [ -z "${HOME}" -o ! -d "${HOME}" ]; then
DOCSFOLDER=`regtool -q get '\HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal'`
test -n "${DOCSFOLDER}" && HOME=`cygpath -u "${DOCSFOLDER}"` || HOME=/tmp
fi
fi
export HOME
# Set up your Language (if you do not want English) by
# replacing C (for C locale) with your country code in
# the following line.
export LANG=C
# Set up the output charset for your locale.
# You may need to experiment with this if you get garbage
# in menus ("`a" instead of "à", for example).
export OUTPUT_CHARSET=iso-8859-1
# Set up Hostname/IP address where LyX can find an X-server.
export DISPLAY=localhost:0.0
# ========================================================
# Below this line you should not change anything if you're
# not familiar with configuration of an unix application!
# ========================================================
export PATH="/usr/local/bin:/usr/bin:/usr/X11R6/bin:$PATH"
export USER="`id -un`"
export MAKE_MODE=unix
export OSTYPE=cygwin
unset DOSDRIVE
unset DOSDIR
unset TMPDIR
unset TMP
for f in /etc/profile.d/*.sh ; do
if [ -f "${f}" ]; then
. "${f}"
fi
done
if [ ! -z "${CDPATH}" ]; then
cd "${CDPATH}"
unset CDPATH
else
cd "${HOME}"
fi
test -f "${HOME}/.bashrc" && . "${HOME}/.bashrc"

View File

@ -0,0 +1,20 @@
### This file is part of
### ========================================================
### LyX, The Document Processor
###
### Copyright 1995 Matthias Ettrich
### Copyright 1995-2008 The LyX Team.
###
### ========================================================
# The file lyxrc.dist gives initial global options for all LyX users.
# Almost all settings here can be overridden through the preferences in LyX.
\screen_dpi 96
\screen_zoom 150
\screen_font_roman "Times New Roman"
\screen_font_sans "Arial"
\screen_font_typewriter "Courier New"
\preview_scale_factor 1.0
\serverpipe "~/.lyx@version_suffix@/lyxpipe"
\path_prefix "/usr/local/bin:/usr/bin:/usr/X11R6/bin"

View File

@ -0,0 +1,72 @@
/**
* \file lyxwin.c
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Claus Hentschel
* \author Enrico Forestieri
*
* Full author contact details are available in file CREDITS.
*
* This is the wrapper program for LyX/Cygwin. Using this wrapper no
* DOS window will be present when running LyX from the Windows GUI.
* The bad side of this: no error output can be seen ;-)
*
* It launches the real binary using the native Windows GUI.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <process.h>
#include <string.h>
#include <limits.h>
#include <sys/cygwin.h>
#include <windows.h>
int main (int argc, char **argv, char **environ)
{
FILE *fp;
char *s;
char posixpath[PATH_MAX];
char cmd[4096] = PACKAGE " ";
char const *nargs[5] = {
"/bin/bash", "--login",
"-c", cmd,
NULL
};
int i = 1;
while (i < argc) {
int done = 0;
int lyxfile = (s = strrchr(argv[i], '.'))
&& strcasecmp(s, ".lyx") == 0;
/* Add initial quote */
strcat(cmd, "\"");
cygwin_conv_to_posix_path(argv[i], posixpath) ;
/* Hack to account for shares */
if (lyxfile && argv[i][0] == '\\' && argv[i][1] != '\\')
strcat(cmd, "/");
/* add the argument */
strcat(cmd, posixpath);
/* add closing quote */
strcat(cmd, "\" ");
if (!done && lyxfile && (s = strrchr(posixpath,'/'))) {
*s = '\0';
if (setenv("CDPATH", posixpath, 1) == 0)
done = 1;
}
++i;
}
strcat(cmd, "</dev/null 1>/dev/null 2>&1");
/* fprintf(stderr , "Command is: |%s|\n", cmd); */
/* ensure bash reads our global env changes */
putenv("BASH_ENV=/etc/lyxprofile") ;
/* exec sub command */
spawnv(_P_NOWAIT, "/bin/bash", nargs);
/* exit with no error */
return(0) ;
}

View File

@ -0,0 +1,44 @@
/* Icons */
IDI_ICON1 ICON DISCARDABLE "lyx_32x32.ico"
IDI_ICON2 ICON DISCARDABLE "lyx_doc_32x32.ico"
#include "config.h"
#include <winver.h>
#if LYX_RELEASE_PATCH > 0
#define PATCH_TAG ".LYX_RELEASE_PATCH"
#else
#define PATCH_TAG ""
#endif
LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */
VS_VERSION_INFO VERSIONINFO
FILEVERSION LYX_MAJOR_VERSION,LYX_MINOR_VERSION,LYX_RELEASE_LEVEL,LYX_RELEASE_PATCH
PRODUCTVERSION LYX_MAJOR_VERSION,LYX_MINOR_VERSION,LYX_RELEASE_LEVEL,LYX_RELEASE_PATCH
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0x0L
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "FileDescription", "LyX/Cygwin Launcher\0"
VALUE "OriginalFilename", "lyx-win" PROGRAM_SUFFIX ".exe\0"
VALUE "CompanyName", "LyX Team\0"
VALUE "FileVersion", "LYX_MAJOR_VERSION.LYX_MINOR_VERSION.LYX_RELEASE_LEVEL" PATCH_TAG "\0"
VALUE "InternalName", "lyx-win\0"
VALUE "LegalCopyright", "Copyright \251 1995 by Matthias Ettrich, 1995-2008 LyX Team\0"
VALUE "ProductName", "LyX/Cygwin\0"
VALUE "ProductVersion", PACKAGE_VERSION "\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}

View File

@ -90,6 +90,9 @@ What's new
- Take advantage of some bugfixes in Qt 4.5 for internal file handling. - Take advantage of some bugfixes in Qt 4.5 for internal file handling.
- Added some cygwin-specific scripts and utility programs that are
compiled and installed when building on cygwin.
** Bug fixes: ** Bug fixes:
************* *************