Hi,

While I was trying to update a patch for LyX, I had troubles compiling LYX on 
OS X 10.9 introduces quite some changes:
- QT5 is required (as discussed on the mailing list)
- libc++ (instead of libstdc++) is used by default systemwide

So here are some patches for compiling LyX on OS X 10.9 that take into account 
the above comments:

[patch 1] is a patch for compiling with clang & libc++ that fixes those issues:
- in strfwd.h and debug.h, if libc++ is detected, then do not use forward std 
declarations (they break since libc++ define some classes in an anonymous 
namespace to provoque linking clashes when linked with libstdc++)
- conversion from streams to boolean has to be explicit

[patch 2] cmake specific
corrects some problem when compiling with the c++11 mode on. In particular, it 
allows having specific c++ flags that are not used when compiling objective-c 
files (the -std=c++11 breaks the objective-c compiler). Since CMAKE has no 
specific objective-c flags, I had to use a series of
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LYX_CXX_SPECIFIC_FLAGS}")
in the different CMakeLists.txt (i.e., in all the subdirectories not including 
support, which is the only one with objective-c files)

[patch 3] QT5 and MacOs
- this adds some QT components for Mac (MacExtras in qt4 and Gui in support 
[necessary to compile Package.cpp])
- use QT_OS_MACX instead of QT_WS_MACX (the latter is not defined anymore in 
Qt5)
- in GuiWorkArea.cpp, use QProxyStyle instead of QMacStyle
- [all platforms with cmake] during installation, create the qt.conf file + 
copy the platform plugin (qcocoa) on Mac

[patch 4] graceful libmagic error handling
This patch just report an error if the magic file detection does not work, and 
proposes a workaround for the bug I had, related to an incorrect locale setting

Note that when bundling with cmake, the file magic database should be copied 
within the bundle (but it isn't for the moment)

With all this, I was able to have a "working" LyX application (that is, 
everything seems to work but the menu - known OS X bug)

Hope it helps,
Benjamin

PS. I have already sent my statement for agreeing to LyX licence so feel free 
to use those patches
PS2. Here is the cmake script that I use to build LyX - followed by make && 
make_install, that works
I have qt5 and libmagic installed through the brew package manager

Qt5Widgets_DIR=/usr/local/Cellar/qt5/5.2.1/lib/cmake/Qt5Widgets 
Qt5Core_DIR=/usr/local/Cellar/qt5/5.2.1/lib/cmake/Qt5Core  \
cmake  .../lyx/repo  \
 -G"Unix Makefiles"  \
 -DLYX_CPACK=ON  \
 -DLYX_INSTALL=ON  \
 -DLYX_NLS=ON  \
 -DLYX_ASPELL=OFF  \
 -DLYX_ENCHANT=OFF  \
 -DLYX_HUNSPELL=OFF  \
 -DLYX_DEVEL_VERSION=OFF  \
 -DLYX_RELEASE=OFF  \
 -DLYX_DEBUG=ON  \
 -DLYX_PACKAGE_SUFFIX=ON  \
 -DLYX_PCH=OFF  \
 -DLYX_MERGE_FILES=OFF  \
 -DLYX_MERGE_REBUILD=OFF  \
 -DLYX_QUIET=OFF  \
 -DLYX_INSTALL_PREFIX=OFF  \
 -DLYX_BUNDLE=ON  \
 -DLYX_EXTERNAL_BOOST=OFF  \
 -DLYX_PROGRAM_SUFFIX=ON  \
 -DLYX_DEBUG_GLIBC=OFF  \
 -DLYX_DEBUG_GLIBC_PEDANTIC=OFF  \
 -DLYX_STDLIB_DEBUG=OFF  \
 -DLYX_CONCEPT_CHECKS=OFF  \
 -DLYX_PROFILE=OFF  \
 -DLYX_ENABLE_CXX11=ON \
 -DLYX_DMG=OFF  \
 -DLYX_COCOA=ON 

Attachment: 0001-Fixes-compilation-issues-with-libc.patch
Description: Binary data

Attachment: 0002-C-11-support-with-objective-c.patch
Description: Binary data

Attachment: 0003-Qt5-support-for-Mac.patch
Description: Binary data

Attachment: 0004-libmagic-error-handling-with-a-workaround-for-uncorr.patch
Description: Binary data


Reply via email to