mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Patch from Benjamin Piwowarski
Just some comments on the patch: - The executable name has to match the information in Info.plist (development/MacOSX/Info.plist.in and CMakeLists.txt). The autoconf config/lyxinclude.m4 file has been modified to make it work with autotools. - The process to build OS X bundle is to first add all the files to be included to the bundle when calling add_executable (src/CMakeLists.txt) and then by calling setting the source file property of each of these files (development/cmake/Install.cmake, l.14) so that the files are properly located into the bundle. This is also why Install.cmake has to be included two times in src/CMakeLists.txt (once to build the list of files, once to set the location of the list of files). - in CMakeLists.txt there is a line install(CODE "set(BU_CHMOD_BUNDLE_ITEMS 1)") What it does is to fix the owner permissions within the bundle - this is necessary because some libraries are copied within the bundle and might be owned by root - An empty qt.conf is included in the bundle so that QT does not try to link to other QT libraries (which will not be included in the bundle) - In development/cmake/Install.cmake, some OS X specific files (*.sdef, qt.conf, *.icns) have to be included in the bundle Benjamin
This commit is contained in:
parent
5c6f72b96e
commit
20359572ed
@ -278,6 +278,11 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
if(APPLE)
|
||||
set(osx_bundle_program_name ${PACKAGE_BASE}${PROGRAM_SUFFIX})
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/development/MacOSX/Info.plist.in" "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
|
||||
endif()
|
||||
|
||||
if(LYX_BUNDLE)
|
||||
set(LYX_CPACK ON)
|
||||
message(STATUS)
|
||||
@ -287,12 +292,16 @@ if(LYX_BUNDLE)
|
||||
message(STATUS " make package")
|
||||
if(APPLE)
|
||||
set(LYX_BUILD_BUNDLE MACOSX_BUNDLE)
|
||||
set(CPACK_BUNDLE_NAME ${PACKAGE_BASE}${PROGRAM_SUFFIX})
|
||||
set(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/Info.plist")
|
||||
set(LYX_DATA_SUBDIR ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app/Contents/Resources/ CACHE STRING "Bundle Contents dir" FORCE)
|
||||
set(MACOSX_BUNDLE_STARTUP_COMMAND ${PACKAGE_BASE}${PROGRAM_SUFFIX}.app)
|
||||
if(NOT LYX_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/LyX CACHE PATH "Mac bundle dir" FORCE)
|
||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
endif()
|
||||
# Change the owner so that the install can work
|
||||
install(CODE "set(BU_CHMOD_BUNDLE_ITEMS 1)")
|
||||
elseif(UNIX)
|
||||
message(STATUS "To embed Qt in this bundle don't build with your system Qt:")
|
||||
message(STATUS " - fix PATH so a other qmake is found by cmake")
|
||||
@ -677,7 +686,9 @@ if(LYX_INSTALL)
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/man "${TOP_BINARY_DIR}/man")
|
||||
add_subdirectory(${LYX_CMAKE_DIR}/doc "${TOP_BINARY_DIR}/doc")
|
||||
endif()
|
||||
include(../Install)
|
||||
if(NOT(LYX_BUNDLE AND APPLE))
|
||||
include(../Install)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(sourcedoc "${TOP_BINARY_DIR}/sourcedoc")
|
||||
|
@ -56,6 +56,7 @@ AC_ARG_WITH(version-suffix,
|
||||
AC_SUBST(version_suffix,$withval)
|
||||
RPM_VERSION_SUFFIX="--with-version-suffix=$withval"])
|
||||
AC_SUBST(RPM_VERSION_SUFFIX)
|
||||
AC_SUBST(program_base_name,"lyx")
|
||||
AC_MSG_RESULT([$withval])
|
||||
])
|
||||
|
||||
@ -498,6 +499,7 @@ 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])
|
||||
PACKAGE=LyX${version_suffix}
|
||||
default_prefix="/Applications/${PACKAGE}.app"
|
||||
AC_SUBST(osx_bundle_program_name,"${program_base_name}")
|
||||
bindir='${prefix}/Contents/MacOS'
|
||||
libdir='${prefix}/Contents/Resources'
|
||||
datarootdir='${prefix}/Contents/Resources'
|
||||
|
@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>lyx</string>
|
||||
<string><string>@osx_bundle_program_name@</string>
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
@ -2,7 +2,21 @@
|
||||
# TODO: set correct path in call to cmake
|
||||
# e.g. cmake /usr/src/lyx/lyx-devel/development/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/share/lyx2.0 -Dnls=1
|
||||
|
||||
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX")
|
||||
if(NOT(LYX_BUNDLE) AND APPLE)
|
||||
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX")
|
||||
endif()
|
||||
set(OSX_BUNDLE_FILES "")
|
||||
|
||||
# Install files into OS X bundle
|
||||
macro(lyx_install_osx basedir files)
|
||||
if(LYX_BUNDLE_PROPERTY_MODE STREQUAL "ON")
|
||||
foreach(file ${files})
|
||||
set_source_files_properties("${file}" PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${basedir}")
|
||||
endforeach()
|
||||
else()
|
||||
list(APPEND OSX_BUNDLE_FILES "${files}")
|
||||
endif()
|
||||
endmacro(lyx_install_osx)
|
||||
|
||||
# the macro scans the directories "_parent_src_dir/_dir/_current_dir" for *._file_type files
|
||||
# and installs the files in CMAKE_INSTALL_PREFIX/_current_dir
|
||||
@ -59,13 +73,21 @@ macro(lyx_install _parent_src_dir _gl_dir _file_type)
|
||||
endif()
|
||||
#message(STATUS "install ${LYX_DATA_SUBDIR}${_dir}/${_base_dir}: ${files_list} ")
|
||||
#message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${LYX_DATA_SUBDIR}${_dir}/${_base_dir}")
|
||||
install(FILES ${files_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
|
||||
if(APPLE)
|
||||
lyx_install_osx("${_dir}/${_based_dir}" "${files_list}")
|
||||
else()
|
||||
install(FILES ${files_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
|
||||
endif(APPLE)
|
||||
endif()
|
||||
if(program_list)
|
||||
if(_glob_dir STREQUAL ".")
|
||||
set(_base_dir .)
|
||||
endif()
|
||||
install(PROGRAMS ${program_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
|
||||
if(APPLE)
|
||||
lyx_install_osx("${_dir}/${_based_dir}" "${program_list}")
|
||||
else()
|
||||
install(PROGRAMS ${program_list} DESTINATION ${LYX_DATA_SUBDIR}${_dir}/${_base_dir})
|
||||
endif(APPLE)
|
||||
endif()
|
||||
endforeach(_current_dir)
|
||||
endforeach(_glob_dir)
|
||||
@ -99,6 +121,13 @@ lyx_install(${TOP_SRC_DIR}/lib tex * .)
|
||||
lyx_install(${TOP_SRC_DIR}/lib ui * .)
|
||||
lyx_install(${TOP_SRC_DIR}/lib . * .)
|
||||
|
||||
# Install
|
||||
if(APPLE)
|
||||
lyx_install(${TOP_SRC_DIR}/development/MacOSX . *.sdef .)
|
||||
lyx_install(${TOP_SRC_DIR}/development/MacOSX . *.icns .)
|
||||
lyx_install(${TOP_SRC_DIR}/development/MacOSX . qt.conf .)
|
||||
endif()
|
||||
|
||||
install(PROGRAMS ${TOP_SRC_DIR}/lib/scripts/listerrors DESTINATION scripts)
|
||||
|
||||
if(UNIX)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# Copyright (c) 2006-2011 Peter Kümmel, <syntheticpp@gmx.net>
|
||||
#
|
||||
|
||||
set(_lyx ${PACKAGE_BASE}${PROGRAM_SUFFIX})
|
||||
set(_lyx "${PACKAGE_BASE}${PROGRAM_SUFFIX}")
|
||||
project(${_lyx})
|
||||
|
||||
include_directories(${TOP_SRC_DIR}/src)
|
||||
@ -100,6 +100,9 @@ lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.msvc)
|
||||
lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/modules/*)
|
||||
lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*)
|
||||
|
||||
if (APPLE AND LYX_BUNDLE)
|
||||
include(../Install)
|
||||
endif()
|
||||
|
||||
add_executable(${_lyx}
|
||||
${WIN32_CONSOLE}
|
||||
@ -110,6 +113,7 @@ add_executable(${_lyx}
|
||||
${FILE_RC}
|
||||
${lyx_info_files}
|
||||
${lyx_cmake_files}
|
||||
${OSX_BUNDLE_FILES}
|
||||
)
|
||||
|
||||
|
||||
@ -165,7 +169,10 @@ if(LYX_BUNDLE)
|
||||
if(NOT APPLE)
|
||||
set(installed_lyx ${CMAKE_INSTALL_PREFIX}/bin/${_lyx}${CMAKE_EXECUTABLE_SUFFIX})
|
||||
else()
|
||||
set_target_properties(${_lyx} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_BINARY_DIR}/../Info.plist")
|
||||
set(installed_lyx ${CMAKE_INSTALL_PREFIX}/${_lyx}.app)
|
||||
set(LYX_BUNDLE_PROPERTY_MODE "ON")
|
||||
include("../Install")
|
||||
endif()
|
||||
install(CODE "include(BundleUtilities)
|
||||
fixup_bundle(\"${installed_lyx}\" \"\" \"\") " COMPONENT RUNTIME)
|
||||
|
Loading…
Reference in New Issue
Block a user