]> git.lyx.org Git - lyx.git/blob - development/cmake/LyxPackaging.cmake
Create proper undo groups for advanced find and replace
[lyx.git] / development / cmake / LyxPackaging.cmake
1
2 # CPack packaging
3 #
4 # http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack
5
6 if(LYX_BUNDLE)
7         if(APPLE)
8                 set(CPACK_GENERATOR DragNDrop)
9                 set(CPACK_DMG_BACKGROUND_IMAGE "${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png")
10                 set(CPACK_DMG_DS_STORE "${CMAKE_BINARY_DIR}/ds_store/.DS_Store")
11         elseif(UNIX)
12                 set(CPACK_GENERATOR STGZ)
13         elseif(WIN32)
14                 set(CPACK_GENERATOR ZIP)
15         endif()
16 endif()
17
18 # Overwrite package name dependent on platform
19 # (Ignores the top project)
20 if(APPLE)
21         # true on all systems whre __APPLE__ is defined in header files
22         set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
23 elseif(UNIX)
24         # True also for cygwin
25         set(CPACK_PACKAGE_NAME "lyx${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
26 else()
27         set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
28 endif()
29
30 set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
31 set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
32 FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)
33
34
35 set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")
36
37 if (APPLE)
38         # We don't need absolute paths
39         set(CPACK_SET_DESTDIR "OFF")
40 elseif(WIN32)
41     set(CPACK_GENERATOR ZIP)
42     set(CPACK_BINARY_ZIP 1)
43     if(MINGW)
44         get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH)
45         if(LYX_XMINGW)
46                 get_filename_component(mingw_name ${LYX_XMINGW} NAME)
47                 set(MINGW_BIN_PATH ${MINGW_BIN_PATH}/../${mingw_name}/lib)
48         endif()
49         if(EXISTS ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
50             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_sjlj-1.dll)
51         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
52             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_seh-1.dll)
53         elseif(EXISTS ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
54             list(APPEND runtime ${MINGW_BIN_PATH}/libgcc_s_dw2-1.dll)
55         endif()
56         if(EXISTS ${MINGW_BIN_PATH}/libstdc++-6.dll)
57             list(APPEND runtime ${MINGW_BIN_PATH}/libstdc++-6.dll)
58         endif()
59         if(EXISTS ${MINGW_BIN_PATH}/libwinpthread-1.dll)
60             list(APPEND runtime ${MINGW_BIN_PATH}/libwinpthread-1.dll)
61         endif()
62         if(NOT runtime)
63                 message(FATAL_ERROR "No mingw runtime found in ${MINGW_BIN_PATH}")
64         endif()
65
66         install(FILES
67                     ${runtime}
68                     ${QT_BINARY_DIR}/QtCore4.dll
69                     ${QT_BINARY_DIR}/QtGui4.dll
70                     ${QT_BINARY_DIR}/QtNetwork4.dll
71                     ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
72                     ${QT_PLUGINS_DIR}/imageformats/qico4.dll
73                     ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
74                     ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
75                     ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
76                     ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
77                 DESTINATION bin CONFIGURATIONS Release)
78     endif()
79 else()
80         # needed by rpm
81         set(CPACK_SET_DESTDIR "ON")
82 endif()
83
84 FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
85 set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
86 set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
87 #
88 # the next ones are needed by deb
89 set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
90 set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")
91
92 # We depend on python scripting
93 set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.6)")
94
95 # use dpkg-shlibdeps to generate additional info for package dependency list.
96 set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
97 set(CPACK_DEBIAN_PACKAGE_DEBUG ON)
98
99 #
100 # for the next ones, cpack insists on data with values in some file
101 set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
102 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
103
104 # Use the revision number saved in ${LYX_PACKAGE_RELEASE}
105 # as the release in rpm-package-build.
106 # This way we maycan omit the otherwise needed "--force" parameter when
107 # installing from that rpm package.
108 set(CPACK_RPM_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
109 set(CPACK_PACKAGE_VERSION_PATCH ${LYX_REVISION_VERSION})
110
111 # we do not have a readme or welcome data,
112 # so we do not provide infofiles for
113 # CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME
114
115 # sources
116 set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html
117
118
119 set(CPACK_STRIP_FILES 1)
120
121 # Finaly give some hints about files not to be included in source package
122 SET(CPACK_SOURCE_IGNORE_FILES
123 "/CVS/"
124 "/\\\\.svn/"
125 "/\\\\.bzr/"
126 "/\\\\.hg/"
127 "/\\\\.git/"
128 "/\\\\.project$"
129 "/\\\\.cproject$"
130 "/\\\\.history$"
131 "\\\\.#"
132 "\\\\.swp$"
133 "~$"
134 "/#"
135 "/_CPack_Packages/"
136 "/CMakeCache.txt$"
137 "/CPackSourceConfig\\\\.cmake$"
138 "/configCompiler\\\\.h$"
139 "/install_manifest\\\\.txt$"
140 "/cmake_install\\\\.cmake$"
141 "/POTFILES"
142 "\\\\.tar\\\\.gz$"
143 "\\\\.tar\\\\.bz2$"
144 "\\\\.tar\\\\.Z$"
145 "\\\\.deb$"
146 "\\\\.rpm$"
147 "\\\\.rej$"
148 "\\\\.orig$"
149 "/core$"
150 "/CMakeFiles/"
151 "/Makefile\\\\.in$"
152 "/Makefile$"
153 "/autom4te\\\\.cache/"
154 "/\\\\.deps/"
155 "/build/"
156 "/lyx-2\\\\."
157 )
158
159 if(LYX_CPACK)
160         include(CPack)
161 endif()
162
163
164 #Now it is possible to create some packages
165 # cd <BuildDir>
166 # make package
167 #############################################################################################
168 # So, e.g. for variables
169 #    CMAKE_PROJECT_NAME                     : lyx
170 #    CPACK_PACKAGE_VERSION_MAJOR            : 2
171 #    CPACK_PACKAGE_VERSION_MINOR            : 0
172 #    CPACK_PACKAGE_VERSION_PATCH            : 1
173 #    CMAKE_SYSTEM_NAME                      : Linux
174 #    CPACK_BINARY_DEB:BOOL                  : ON
175 #
176 # the package name builds as "lyx-2.0.1-Linux.deb"
177 #
178 ############################## rpm ################################### deb ##################
179 # create    # cpack -G RPM --config CPackConfig.cmake   # cpack -G DEB --config CPackConfig.cmake
180 # creates =># lyx-2.0.1-Linux.rpm                       # lyx-2.0.1-Linux.deb
181 # list      # rpm -qlp lyx-2.0.1-Linux.rpm              # dpkg-deb -c lyx-2.0.1-Linux.deb
182 # install   # rpm -U lyx-2.0.1-Linux.rpm                # dpkg -i lyx-2.0.1-Linux.deb
183 #
184