2009-01-04 13:00:34 +00:00
|
|
|
|
|
|
|
# TODO: set correct path in call to cmake
|
2016-06-05 20:59:13 +00:00
|
|
|
# e.g. cmake /usr/src/lyx/lyx-devel/development/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -Dnls=1
|
2007-05-02 20:59:48 +00:00
|
|
|
|
2012-10-13 07:53:20 +00:00
|
|
|
if(NOT(LYX_BUNDLE) AND APPLE)
|
|
|
|
message(STATUS "Installing to ${CMAKE_INSTALL_PREFIX}, defined by CMAKE_INSTALL_PREFIX")
|
|
|
|
endif()
|
2008-12-09 20:13:04 +00:00
|
|
|
|
2008-12-28 13:35:29 +00:00
|
|
|
# the macro scans the directories "_parent_src_dir/_dir/_current_dir" for *._file_type files
|
2008-12-09 20:13:04 +00:00
|
|
|
# and installs the files in CMAKE_INSTALL_PREFIX/_current_dir
|
2007-05-02 20:59:48 +00:00
|
|
|
# dir_item is on item of the remaining arguments
|
2016-04-14 09:15:08 +00:00
|
|
|
#
|
|
|
|
# Special handling for ${_file_type} == "*"
|
|
|
|
# Here we try to exclude files which we do not want to install
|
2016-06-10 11:38:29 +00:00
|
|
|
# Depending on _what, installation on UNIX goes to
|
2016-06-05 20:59:13 +00:00
|
|
|
# data -> ${LYX_DATA_SUBDIR}
|
2017-07-10 11:17:29 +00:00
|
|
|
# font -> share/${_lyx}/fonts/
|
2016-06-05 20:59:13 +00:00
|
|
|
# bin -> bin
|
2016-06-10 11:38:29 +00:00
|
|
|
# tex -> share/texmf/tex/latex/${_lyx}/
|
2016-06-05 20:59:13 +00:00
|
|
|
macro(lyx_install _what _parent_src_dir _gl_dir _file_type)
|
2009-01-11 20:56:40 +00:00
|
|
|
#message("checking parents ${_parent_src_dir}")
|
2009-01-04 13:00:34 +00:00
|
|
|
file(GLOB _dirs RELATIVE "${_parent_src_dir}" ${_parent_src_dir}/${_gl_dir})
|
2009-01-04 13:33:23 +00:00
|
|
|
#cmake bug on Windows: if _gl_dir==. _dirs is empty but on linux _dirs==.
|
2009-01-04 13:00:34 +00:00
|
|
|
if(NOT _dirs)
|
|
|
|
set(_dirs .)
|
2016-06-05 20:59:13 +00:00
|
|
|
endif()
|
|
|
|
# Select installation dir
|
|
|
|
if ("${_what}" STREQUAL "data")
|
2016-06-06 06:29:07 +00:00
|
|
|
get_data_destination(_dest_subdir)
|
2016-06-05 20:59:13 +00:00
|
|
|
elseif ("${_what}" STREQUAL "font")
|
2016-06-06 06:29:07 +00:00
|
|
|
get_font_destination(_dest_subdir)
|
2016-06-05 20:59:13 +00:00
|
|
|
elseif ("${_what}" STREQUAL "tex")
|
2016-06-06 06:29:07 +00:00
|
|
|
get_tex_destination(_dest_subdir)
|
2016-06-05 20:59:13 +00:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Undefined parameter _what = ${_what} in call to lyx_install")
|
|
|
|
endif()
|
2009-01-04 13:00:34 +00:00
|
|
|
foreach(_dir ${_dirs})
|
|
|
|
foreach(_glob_dir ${ARGN})
|
|
|
|
file(GLOB _dir_list ${_parent_src_dir}/${_dir}/${_glob_dir})
|
|
|
|
if(NOT _dir_list)
|
2009-01-18 14:45:57 +00:00
|
|
|
if(_glob_dir STREQUAL ".")
|
2009-01-17 19:17:51 +00:00
|
|
|
set(_dir_list ${_parent_src_dir}/${_dir}/.)
|
2009-01-18 14:45:57 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2009-01-04 13:00:34 +00:00
|
|
|
#message(STATUS "${_dir}/${_glob_dir} -> ${_dir_list} ")
|
|
|
|
foreach(_current_dir ${_dir_list})
|
|
|
|
file(GLOB _item_list ${_current_dir}/${_file_type})
|
2009-01-04 13:33:23 +00:00
|
|
|
#cmake bug: globbing with * also returns directories on Windows
|
2009-01-04 13:00:34 +00:00
|
|
|
set(files_list ${_item_list})
|
2017-11-05 16:06:38 +00:00
|
|
|
set(program_list)
|
2009-01-04 13:00:34 +00:00
|
|
|
foreach(_current_item ${_item_list})
|
2017-11-05 16:06:38 +00:00
|
|
|
if(files_list)
|
|
|
|
if(IS_DIRECTORY ${_current_item})
|
|
|
|
#message(STATUS "removing dir ${_current_item}")
|
2009-01-04 13:00:34 +00:00
|
|
|
list(REMOVE_ITEM files_list "${_current_item}")
|
2011-12-18 12:56:38 +00:00
|
|
|
else()
|
2017-11-05 16:06:38 +00:00
|
|
|
if ("${_file_type}" STREQUAL "*")
|
2019-03-19 13:34:32 +00:00
|
|
|
foreach(_mask "/\\.[^/]+$" "\\.in$" "\\.py$" "\\.patch$" "CMakeLists\\.txt$" "\\.lyx~$" "Attic")
|
2017-11-05 16:06:38 +00:00
|
|
|
if(_current_item MATCHES ${_mask})
|
|
|
|
#message(STATUS "removing item ${_current_item}")
|
|
|
|
list(REMOVE_ITEM files_list "${_current_item}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endif()
|
2009-01-04 13:00:34 +00:00
|
|
|
endif()
|
|
|
|
endforeach(_current_item)
|
|
|
|
if(files_list)
|
2011-12-20 13:49:55 +00:00
|
|
|
list(REMOVE_ITEM files_list "${_current_dir}/lyx.svg")
|
2009-01-04 13:00:34 +00:00
|
|
|
list(REMOVE_ITEM files_list "${_current_dir}/Makefile.am")
|
2011-03-31 07:59:33 +00:00
|
|
|
list(REMOVE_ITEM files_list "${_current_dir}/layouttranslations")
|
2017-11-05 16:06:38 +00:00
|
|
|
if (NOT WIN32)
|
|
|
|
# subscript.sty is installed only for MikTeX since it is part of texlive
|
|
|
|
list(REMOVE_ITEM files_list "${_current_dir}/subscript.sty")
|
|
|
|
endif()
|
2009-01-04 13:00:34 +00:00
|
|
|
GET_FILENAME_COMPONENT(_base_dir ${_current_dir} NAME)
|
|
|
|
if(_glob_dir STREQUAL ".")
|
|
|
|
set(_base_dir .)
|
|
|
|
endif()
|
2014-03-09 09:21:51 +00:00
|
|
|
|
2016-06-05 20:59:13 +00:00
|
|
|
install(FILES ${files_list} DESTINATION "${_dest_subdir}${_dir}/${_base_dir}")
|
|
|
|
#message(STATUS "Installing ${files_list} to ${_dest_subdir}${_dir}/${_base_dir}")
|
2009-01-04 13:00:34 +00:00
|
|
|
endif()
|
2017-11-05 16:06:38 +00:00
|
|
|
if(program_list)
|
|
|
|
if(_glob_dir STREQUAL ".")
|
|
|
|
set(_base_dir .)
|
|
|
|
endif()
|
2016-06-05 20:59:13 +00:00
|
|
|
install(FILES ${program_list} DESTINATION "${_dest_subdir}${_dir}/${_base_dir}")
|
2017-11-05 16:06:38 +00:00
|
|
|
endif()
|
2009-01-04 13:00:34 +00:00
|
|
|
endforeach(_current_dir)
|
|
|
|
endforeach(_glob_dir)
|
|
|
|
endforeach(_dir)
|
2007-05-02 20:59:48 +00:00
|
|
|
endmacro(lyx_install)
|
|
|
|
|
2009-01-11 18:50:24 +00:00
|
|
|
|
2009-01-04 13:00:34 +00:00
|
|
|
# language-specific-directories (like ca, de, es ...) are now globbed as "[a-z][a-z]"
|
|
|
|
set(_all_languages "[a-z][a-z]")
|
2007-05-02 20:59:48 +00:00
|
|
|
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib bind *.bind . ${_all_languages})
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib commands *.def .)
|
2009-01-04 13:00:34 +00:00
|
|
|
|
2009-01-11 18:50:24 +00:00
|
|
|
# this is handled in doc/CMakeLists.txt
|
2016-06-05 20:59:13 +00:00
|
|
|
#lyx_install("data" ${TOP_SRC_DIR}/lib doc *.lyx . ${_all_languages})
|
|
|
|
#lyx_install("data" ${TOP_SRC_DIR}/lib doc *.txt . ${_all_languages})
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib doc * biblio clipart)
|
2009-01-04 13:00:34 +00:00
|
|
|
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib doc/${_all_languages} * clipart)
|
2009-01-04 13:00:34 +00:00
|
|
|
|
2020-03-01 15:48:14 +00:00
|
|
|
set(example_subdirs ${_all_languages} pt_BR pt_PT Articles Curricula_Vitae External_Material "Graphics_and_Insets" Handouts Letters Modules Posters Presentations Scripts Theses Books Theses)
|
2019-03-19 13:34:32 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib examples * . *)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib examples/* * . *)
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("font" ${TOP_SRC_DIR}/lib/fonts . * .)
|
2015-04-01 15:26:13 +00:00
|
|
|
foreach(_imgext "png" "svgz" "gif" "xpm")
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib images "*.${_imgext}" . ipa commands attic classic oxygen)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib images/math "*.${_imgext}" . oxygen)
|
2015-04-01 15:26:13 +00:00
|
|
|
endforeach()
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib kbd * .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib layouts * .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib lyx2lyx *.py .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib scripts *.py .)
|
2017-01-13 16:18:25 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib citeengines *.citeengine .)
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib . *.py .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib scripts *.R .)
|
2019-03-19 13:34:32 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib templates * . *)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib templates/* * . *)
|
2017-03-26 13:32:01 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib xtemplates *.xtemplate .)
|
2016-06-05 20:59:13 +00:00
|
|
|
lyx_install("tex" ${TOP_SRC_DIR}/lib/tex . * .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib ui * .)
|
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/lib . * .)
|
2020-03-01 15:48:14 +00:00
|
|
|
lyx_install("data" ${TOP_SRC_DIR}/3rdparty scripts/evince_sync * .)
|
2011-12-06 11:48:33 +00:00
|
|
|
|
2012-10-13 07:53:20 +00:00
|
|
|
# Install
|
2020-04-18 07:06:56 +00:00
|
|
|
set(lyxrcorig "")
|
|
|
|
set(program_suffix ${PROGRAM_SUFFIX})
|
2020-04-19 07:45:32 +00:00
|
|
|
set(version_suffix ${LYX_VERSION})
|
2020-04-18 07:06:56 +00:00
|
|
|
|
2012-10-13 07:53:20 +00:00
|
|
|
if(APPLE)
|
2014-03-09 09:21:51 +00:00
|
|
|
if(LYX_BUNDLE)
|
|
|
|
install(FILES ${TOP_SRC_DIR}/development/MacOSX/spotlight/Info.plist DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents/Library/Spotlight/LyX-Metadata.mdimporter/Contents")
|
|
|
|
install(FILES "${TOP_SRC_DIR}/development/MacOSX/PkgInfo" DESTINATION "${MACOSX_BUNDLE_STARTUP_COMMAND}/Contents")
|
|
|
|
endif()
|
2012-03-10 14:23:33 +00:00
|
|
|
|
2017-10-02 00:00:47 +00:00
|
|
|
foreach(_i lyxeditor maxima inkscape)
|
2019-11-27 14:05:44 +00:00
|
|
|
install(PROGRAMS "${TOP_SRC_DIR}/development/MacOSX/${_i}" DESTINATION "${LYX_UTILITIES_INSTALL_PATH}")
|
2017-10-02 00:00:47 +00:00
|
|
|
endforeach()
|
2014-03-09 09:21:51 +00:00
|
|
|
install(FILES "${TOP_SRC_DIR}/development/MacOSX/LyX.icns" DESTINATION "${LYX_DATA_SUBDIR}")
|
2020-04-18 07:06:56 +00:00
|
|
|
set(lyxrcorig "${TOP_SRC_DIR}/development/MacOSX/lyxrc.dist.in")
|
2014-03-09 09:21:51 +00:00
|
|
|
elseif(UNIX)
|
2011-12-20 13:49:55 +00:00
|
|
|
configure_file(${TOP_SRC_DIR}/lib/lyx.desktop.in lyx${PROGRAM_SUFFIX}.desktop)
|
2014-05-09 08:04:42 +00:00
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx${PROGRAM_SUFFIX}.desktop DESTINATION ${SYSTEM_DATADIR}/applications)
|
|
|
|
install(FILES ${TOP_SRC_DIR}/lib/images/lyx.svg RENAME lyx${PROGRAM_SUFFIX}.svg DESTINATION ${SYSTEM_DATADIR}/icons/hicolor/scalable/apps/)
|
2020-04-18 07:06:56 +00:00
|
|
|
set(lyxrcorig "${TOP_SRC_DIR}/development/unix/lyxrc.dist.in")
|
|
|
|
elseif(CYGWIN)
|
|
|
|
set(lyxrcorig "${TOP_SRC_DIR}/development/cygwin/lyxrc.dist.in")
|
|
|
|
elseif(WIN32)
|
|
|
|
set(lyxrcorig "${TOP_SRC_DIR}/development/win32/lyxrc.dist.in")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT lyxrcorig STREQUAL "")
|
|
|
|
configure_file("${lyxrcorig}" lyxrc.dist)
|
2018-01-03 13:58:58 +00:00
|
|
|
lyx_install("data" ${CMAKE_CURRENT_BINARY_DIR} . lyxrc.dist .)
|
2011-12-06 11:48:33 +00:00
|
|
|
endif()
|
2016-11-22 15:51:44 +00:00
|
|
|
|
|
|
|
if(USE_POSIX_PACKAGING AND EXISTS "${TOP_SRC_DIR}/lib/usr.bin.lyxwrap.in")
|
|
|
|
# handle lyxwrap
|
|
|
|
#get_filename_component(prefix "${CMAKE_INSTALL_PREFIX}" REALPATH)
|
|
|
|
set(prefix "${CMAKE_INSTALL_PREFIX}")
|
|
|
|
string(REGEX REPLACE "^/" "" lyxwrapprefix1 "${prefix}")
|
|
|
|
string(REPLACE "/" "." lyxwrapprefix ${lyxwrapprefix1})
|
|
|
|
#message(STATUS "lyxwrapprefix = ${lyxwrapprefix}")
|
|
|
|
configure_file(${TOP_SRC_DIR}/lib/usr.bin.lyxwrap.in "${lyxwrapprefix}.${LYX_UTILITIES_INSTALL_PATH}.lyx${PROGRAM_SUFFIX}")
|
|
|
|
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${lyxwrapprefix}.${LYX_UTILITIES_INSTALL_PATH}.lyx${PROGRAM_SUFFIX}" DESTINATION /etc/apparmor.d/)
|
|
|
|
endif()
|