mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
make LyX/Mac compile and work better
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8321 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5a8d168db4
commit
de9240227b
@ -1,3 +1,6 @@
|
||||
2003-12-15 Ronald Florence <ron@18james.com>
|
||||
|
||||
* README.MacOSX: updated for 1.4.0cvs
|
||||
|
||||
2003-11-18 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
|
@ -1,56 +1,46 @@
|
||||
|
||||
Building LyX on Aqua
|
||||
Building LyX/Mac
|
||||
|
||||
Ronald Florence <ron@18james.com>
|
||||
|
||||
LyX/Mac is built from the LyX source, the GPL-licensed Trolltech
|
||||
Qt/Mac library, and a custom application bundle. Qt-3.2.3 and
|
||||
later versions align the button labels in the Math Panel better
|
||||
under MacOS-10.3, but present other problems. Qt-3.1.2 as patched
|
||||
here is fully functional.
|
||||
|
||||
Make sure you have installed the MacOSX development tools. The
|
||||
procedure described here builds LyX-1.3.3 linked with a static Qt
|
||||
library and installs the LyX and Start-LyX applications.
|
||||
You will need the MacOSX development tools. The procedure
|
||||
described here builds LyX linked with a static Qt library. If you
|
||||
are using the tcsh shell, change the "export VAR=value" statements
|
||||
to "setenv VAR value".
|
||||
|
||||
Download the GPL-licensed MacOSX Qt 3.1.2 library source code from
|
||||
ftp://ftp.lyx.org/pub/lyx/contrib/qt-mac-free-3.1.2.sit. Untar the
|
||||
.tar.gz file in a convenient directory in /usr/local/src or
|
||||
/usr/local. Then open a terminal, cd to the Qt source directory,
|
||||
apply the patch development/MacOSX/qt.patch, and:
|
||||
1. Download the GPL-licensed Qt/Mac library source code from
|
||||
<ftp://ftp.lyx.org/pub/lyx/contrib/qt-mac-free-3.1.2.sit>, untar in
|
||||
a convenient directory, cd to the top of the Qt source hierarcy,
|
||||
and:
|
||||
|
||||
% setenv QTDIR `pwd`
|
||||
% sudo gcc_select 2
|
||||
% ./configure -static
|
||||
% make
|
||||
% sudo gcc_select 3
|
||||
export QTDIR=`pwd`
|
||||
patch -p0 < LYX-SOURCE-DIRECTORY/development/MacOSX/qt.patch
|
||||
sudo gcc_select 3.3
|
||||
./configure -static [for Panther, use "./configure -static -lresolv"]
|
||||
make
|
||||
|
||||
To avoid this compiler-changing procedure in the future, you might
|
||||
want to write Apple to urge that they fix bug ID #3162425 so the
|
||||
default gcc-3.1 compiler can be used to compile LyX-1.3.x on MacOSX.
|
||||
2. Using the same terminal session, cd to the top of the LyX
|
||||
source hierarchy, and:
|
||||
|
||||
Using the same terminal session you used to build the Qt libraries
|
||||
(or if you start a new terminal, set the QTDIR environment variable
|
||||
as above), cd to the top of the LyX source hierarchy. Then:
|
||||
export LDFLAGS="-framework Carbon -framework OpenGL -framework AGL -framework QuickTime -lz"
|
||||
./configure --with-frontend=qt --without-x --datadir=/Applications/LyX.app/Contents/Resources --bindir=/Applications/LyX.app/Contents/MacOS --mandir=/Applications/LyX.app/Contents/Resources/man
|
||||
make
|
||||
cp -R development/MacOSX/LyX.app /Applications
|
||||
make install
|
||||
rm /Applications/LyX.app/Contents/Resources/LyX/images/lyx.xpm
|
||||
|
||||
% setenv CXX g++2
|
||||
% setenv LDFLAGS "-framework Carbon -framework OpenGL -framework AGL -framew
|
||||
ork QuickTime -lz"
|
||||
% ./configure --with-frontend=qt --without-x --datadir=/Applications/LyX.app
|
||||
/Contents/Resources --bindir=/Applications/LyX.app/Contents/MacOS --mandir=/App
|
||||
lications/LyX.app/Contents/Resources/man
|
||||
% make
|
||||
|
||||
Download the LyX Framework at
|
||||
http://www.18james.com/code/LyX.tar.gz and run the installer. Then
|
||||
in the terminal where you built LyX:
|
||||
|
||||
% make install
|
||||
% rm /Applications/LyX.app/Contents/Resources/LyX/images/lyx.xpm
|
||||
|
||||
For information on configuring LyX/Mac, please see the howto at
|
||||
http://www.18james.com/lyx_on_aqua.html . The binary installation
|
||||
of LyX on Aqua sets the PATH in ~/.MacOS/environment.plist,
|
||||
installs the LyX math fonts, configures LyX to use the reLyX and
|
||||
noweb2lyx commands in the application package and to use system
|
||||
defaults for viewers, sets up the lyxpipe for Start-LyX, and
|
||||
optionally installs latex-preview; you will need to do this
|
||||
configuration manually if you build LyX/Mac yourself.
|
||||
<http://www.18james.com/lyx_on_aqua.html>. The binary installation
|
||||
of LyX/Mac installs LaTeX fonts and packages, and provides
|
||||
additional functionality including inverse DVI search with some
|
||||
DVI-previewers.
|
||||
|
||||
The information on this page is believed to be accurate, has been
|
||||
used successfully on many systems and sites, and has benefited from
|
||||
|
@ -1,3 +1,8 @@
|
||||
2003-12-15 Ronald Florence <ron@18james.com>
|
||||
|
||||
* reLyX/reLyX.in: search for library in
|
||||
"$dir/../Resources/LyX/reLyX" for LyX/Mac
|
||||
|
||||
2004-01-07 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* layouts/siamltex.layout: fix layout name for Definition
|
||||
|
@ -44,7 +44,9 @@ push @maybe_dir, "$dir/$srcdir";
|
||||
if (exists $ENV{LYX_DIR_14x}) { push @maybe_dir, "$ENV{LYX_DIR_14x}/reLyX"};
|
||||
# case 4: e.g., reLyX in /opt/bin, $mainscript in /opt/share/lyx/reLyX
|
||||
push @maybe_dir, "$dir/../share/$lyxname/reLyX"; # case 4
|
||||
# case 5: configure figured out where $mainscript is
|
||||
# case 5: LyX/Mac -- reLyX is in a MacOS X application bundle
|
||||
push @maybe_dir, "$dir/../Resources/LyX/reLyX"; # case 5
|
||||
# case 6: configure figured out where $mainscript is
|
||||
push @maybe_dir, "$lyxdir/reLyX";
|
||||
|
||||
# Decide which one is the real directory, based on the existence of
|
||||
|
@ -1,3 +1,12 @@
|
||||
2003-12-15 Ronald Florence <ron@18james.com>
|
||||
|
||||
* qfont_loader.C: fixed headers to compile w/o X11
|
||||
|
||||
* QWorkArea.C (checkAppleEventForMissingParams)
|
||||
(handleOpenDocuments): add support for OpenDocuments apple event
|
||||
|
||||
* lyx_gui.C (macEventFilter): handle apple events
|
||||
|
||||
2004-01-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FileDialog_private.C (c-tor): invoke convert_brace_glob to convert
|
||||
|
@ -28,9 +28,16 @@
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
namespace {
|
||||
QWorkArea const * wa_ptr = 0;
|
||||
}
|
||||
|
||||
QWorkArea::QWorkArea(int, int, int, int)
|
||||
: WorkArea(), QWidget(qApp->mainWidget()), painter_(*this)
|
||||
@ -51,6 +58,9 @@ QWorkArea::QWorkArea(int, int, int, int)
|
||||
vl->addWidget(content_, 5);
|
||||
vl->addWidget(scrollbar_, 0);
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
wa_ptr = this;
|
||||
#endif
|
||||
show();
|
||||
}
|
||||
|
||||
@ -75,10 +85,6 @@ void QWorkArea::setScrollbarParams(int h, int pos, int line_h)
|
||||
scrollbar_->setPageStep(height());
|
||||
}
|
||||
|
||||
namespace {
|
||||
QWorkArea const * wa_ptr = 0;
|
||||
}
|
||||
|
||||
#ifdef Q_WS_X11
|
||||
bool lyxX11EventFilter(XEvent * xev)
|
||||
{
|
||||
@ -98,6 +104,72 @@ bool lyxX11EventFilter(XEvent * xev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
namespace{
|
||||
OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
|
||||
{
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
OSErr err = AEGetAttributePtr(&theAppleEvent, keyMissedKeywordAttr,
|
||||
typeWildCard, &returnedType, nil, 0,
|
||||
&actualSize);
|
||||
switch (err) {
|
||||
case errAEDescNotFound:
|
||||
return noErr;
|
||||
case noErr:
|
||||
return errAEEventNotHandled;
|
||||
default:
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pascal OSErr handleOpenDocuments(const AppleEvent* inEvent,
|
||||
AppleEvent* /*reply*/, long /*refCon*/)
|
||||
{
|
||||
QString s_arg;
|
||||
AEDescList documentList;
|
||||
OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
|
||||
&documentList);
|
||||
if (err != noErr)
|
||||
return err;
|
||||
|
||||
err = checkAppleEventForMissingParams(*inEvent);
|
||||
if (err == noErr) {
|
||||
long documentCount;
|
||||
err = AECountItems(&documentList, &documentCount);
|
||||
for (long documentIndex = 1;
|
||||
err == noErr && documentIndex <= documentCount;
|
||||
documentIndex++) {
|
||||
DescType returnedType;
|
||||
Size actualSize;
|
||||
AEKeyword keyword;
|
||||
FSRef ref;
|
||||
char qstr_buf[1024];
|
||||
err = AESizeOfNthItem(&documentList, documentIndex,
|
||||
&returnedType, &actualSize);
|
||||
if (err == noErr) {
|
||||
err = AEGetNthPtr(&documentList, documentIndex,
|
||||
typeFSRef, &keyword,
|
||||
&returnedType, (Ptr)&ref,
|
||||
sizeof(FSRef), &actualSize);
|
||||
if (err == noErr) {
|
||||
FSRefMakePath(&ref, (UInt8*)qstr_buf,
|
||||
1024);
|
||||
s_arg=QString::fromUtf8(qstr_buf);
|
||||
wa_ptr->dispatch(
|
||||
FuncRequest(LFUN_FILE_OPEN,
|
||||
fromqstr(s_arg)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for ...
|
||||
}
|
||||
AEDisposeDesc(&documentList);
|
||||
return err;
|
||||
}
|
||||
#endif // Q_WS_MACX
|
||||
|
||||
void QWorkArea::haveSelection(bool own) const
|
||||
{
|
||||
wa_ptr = this;
|
||||
|
@ -43,6 +43,10 @@
|
||||
#include "socket_callback.h"
|
||||
#include "lcolorcache.h"
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qpaintdevicemetrics.h>
|
||||
|
||||
@ -86,6 +90,12 @@ extern void initEncodings();
|
||||
extern bool lyxX11EventFilter(XEvent * xev);
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
extern bool macEventFilter(EventRef event);
|
||||
extern pascal OSErr
|
||||
handleOpenDocuments(const AppleEvent* inEvent, AppleEvent* /*reply*/,
|
||||
long /*refCon*/);
|
||||
#endif
|
||||
|
||||
class LQApplication : public QApplication
|
||||
{
|
||||
@ -95,17 +105,42 @@ public:
|
||||
#ifdef Q_WS_X11
|
||||
bool x11EventFilter (XEvent * ev) { return lyxX11EventFilter(ev); }
|
||||
#endif
|
||||
#ifdef Q_WS_MACX
|
||||
bool macEventFilter(EventRef event);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
LQApplication::LQApplication(int & argc, char ** argv)
|
||||
: QApplication(argc, argv)
|
||||
{}
|
||||
{
|
||||
#ifdef Q_WS_MACX
|
||||
AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
|
||||
NewAEEventHandlerUPP(handleOpenDocuments),
|
||||
0, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
LQApplication::~LQApplication()
|
||||
{}
|
||||
|
||||
|
||||
#ifdef Q_WS_MACX
|
||||
bool LQApplication::macEventFilter(EventRef event)
|
||||
{
|
||||
if (GetEventClass(event) == kEventClassAppleEvent) {
|
||||
EventRecord eventrec;
|
||||
ConvertEventRefToEventRecord(event, &eventrec);
|
||||
AEProcessAppleEvent(&eventrec);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
namespace lyx_gui {
|
||||
|
||||
bool use_gui = true;
|
||||
|
@ -26,10 +26,10 @@
|
||||
#ifdef Q_WS_X11
|
||||
#include <qwidget.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "support/systemcall.h"
|
||||
#include "support/filetools.h"
|
||||
#include <algorithm>
|
||||
#endif
|
||||
#include "support/systemcall.h"
|
||||
#include "support/filetools.h"
|
||||
|
||||
using lyx::support::contains;
|
||||
using lyx::support::LibFileSearch;
|
||||
|
@ -1,3 +1,6 @@
|
||||
2003-12-15 Ronald Florence <ron@18james.com>
|
||||
|
||||
* math_symbolinset.C: fixed "ugly" patch for Qt/Mac fonts.
|
||||
|
||||
2003-12-15 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -65,10 +65,10 @@ void MathSymbolInset::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
// correct height for broken cmex and wasy font
|
||||
#if defined(__APPLE__) && defined(__GNUC__)
|
||||
if (sym_->inset == "cmex") {
|
||||
h_ = 4 * dim_.des / 5;
|
||||
dim_.asc += 0*h_;
|
||||
dim_.des -= h_;
|
||||
h_ = dim_.asc;
|
||||
h_ = 4 * dim.des / 5;
|
||||
dim.asc += 0*h_;
|
||||
dim.des -= h_;
|
||||
h_ = dim.asc;
|
||||
} else if (sym_->inset == "wasy") {
|
||||
h_ = 4 * dim.des / 5;
|
||||
dim.asc += h_;
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-12-14 Ronald Florence <ron@18james.com>
|
||||
|
||||
* tostr.[hC]: added tostr(long unsigned int i).
|
||||
|
||||
* path_defines.C.in: determine system directory and set PATH for
|
||||
relocatable LyX/Mac bundle.
|
||||
|
||||
2004-01-06 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* globbing.C (glob): compilation fix for cygwin.
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "filetools.h"
|
||||
#include "lstrings.h"
|
||||
#include "os.h"
|
||||
#include "lyxlib.h"
|
||||
|
||||
using std::string;
|
||||
using std::endl;
|
||||
@ -166,10 +167,11 @@ bool setLyxPaths()
|
||||
// 1) -sysdir command line parameter
|
||||
// 2) LYX_DIR_14x environment variable
|
||||
// 3) Maybe <path of binary>/TOP_SRCDIR/lib
|
||||
// 4) <path of binary>/../share/<name of binary>/
|
||||
// 4a) repeat 4 after following the Symlink if <path of
|
||||
// 4) <path of binary>/../Resources/<name of binary>/ [for LyX/Mac]
|
||||
// 5) <path of binary>/../share/<name of binary>/
|
||||
// 5a) repeat 4 after following the Symlink if <path of
|
||||
// binary> is a symbolic link.
|
||||
// 5) hardcoded lyx_dir
|
||||
// 6) hardcoded lyx_dir
|
||||
// The directory is checked for the presence of the file
|
||||
// "chkconfig.ltx", and if that is present, the directory
|
||||
// is accepted as the system directory.
|
||||
@ -187,6 +189,10 @@ bool setLyxPaths()
|
||||
searchpath += lyxdir + ';';
|
||||
}
|
||||
|
||||
// Path of binary/../Resources/
|
||||
searchpath += NormalizePath(AddPath(binpath, "../Resources/") +
|
||||
OnlyFilename(binname)) + ';';
|
||||
|
||||
string fullbinpath = binpath;
|
||||
FileInfo file(fullbinname, true);
|
||||
if (file.isLink()) {
|
||||
@ -281,6 +287,24 @@ bool setLyxPaths()
|
||||
lyxerr[Debug::INIT] << "System directory: '"
|
||||
<< system_lyxdir_ << '\'' << endl;
|
||||
|
||||
//
|
||||
// Set PATH for LyX/Mac
|
||||
// LyX/Mac is a relocatable application bundle; here we add to
|
||||
// the PATH so it can find binaries like reLyX inside its own
|
||||
// application bundle, and also append PATH elements that it
|
||||
// needs to run latex, previewers, etc.
|
||||
//
|
||||
|
||||
if (system_lyxdir_ == NormalizePath(AddPath(binpath, "../Resources/")
|
||||
+ OnlyFilename(binname))) {
|
||||
const string newpath = GetEnv("PATH") + ":" + binpath
|
||||
+ ":/sw/bin:/usr/local/bin"
|
||||
+ ":/usr/local/teTeX/bin/powerpc-apple-darwin-current";
|
||||
lyx::support::putenv("PATH", newpath);
|
||||
lyxerr[Debug::INIT] << "Running from LyX/Mac bundle. "
|
||||
"Setting PATH to: " << GetEnv("PATH") << endl;
|
||||
}
|
||||
|
||||
//
|
||||
// Determine user lyx-dir
|
||||
//
|
||||
|
@ -58,3 +58,11 @@ string const tostr(string const & s)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
string const tostr(long unsigned int i)
|
||||
{
|
||||
ostringstream os;
|
||||
os << i;
|
||||
return os.str();
|
||||
}
|
||||
|
@ -29,5 +29,7 @@ std::string const tostr(long int);
|
||||
std::string const tostr(double);
|
||||
///
|
||||
std::string const tostr(std::string const & s);
|
||||
///
|
||||
std::string const tostr(long unsigned int);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user