File: LyxPackaging.cmake

package info (click to toggle)
lyx 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 138,444 kB
  • sloc: cpp: 244,268; ansic: 106,398; xml: 72,791; python: 39,384; sh: 7,666; makefile: 6,584; pascal: 2,143; perl: 2,101; objc: 1,084; tcl: 163; sed: 16
file content (258 lines) | stat: -rw-r--r-- 9,124 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258

# CPack packaging
#
# http://cmake.org/cmake/help/cmake-2-8-docs.html#module:CPack

if(LYX_BUNDLE)
	if(APPLE)
		set(CPACK_GENERATOR DragNDrop)
		set(CPACK_DMG_BACKGROUND_IMAGE "${TOP_CMAKE_PATH}/../MacOSX/dmg-background.png")
		set(CPACK_DMG_DS_STORE "${CMAKE_BINARY_DIR}/ds_store/.DS_Store")
	elseif(UNIX)
		set(CPACK_GENERATOR STGZ)
	elseif(WIN32)
		set(CPACK_GENERATOR ZIP)
	endif()
endif()

# Overwrite package name dependent on platform
# (Ignores the top project)
if(APPLE)
	# true on all systems whre __APPLE__ is defined in header files
	set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
elseif(UNIX)
	# True also for cygwin
	set(CPACK_PACKAGE_NAME "lyx${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
else()
	set(CPACK_PACKAGE_NAME "LyX${LYX_MAJOR_VERSION}${LYX_MINOR_VERSION}")
endif()

set(CPACK_PACKAGE_VERSION_MAJOR "${LYX_MAJOR_VERSION}")
set(CPACK_PACKAGE_VERSION_MINOR "${LYX_MINOR_VERSION}")
FILE(STRINGS "${TOP_CMAKE_PATH}/LyX_summary.txt" CPACK_PACKAGE_DESCRIPTION_SUMMARY)


set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${LYX_INSTALL_SUFFIX}")

if (APPLE)
	# We don't need absolute paths
	set(CPACK_SET_DESTDIR "OFF")
elseif(WIN32)
    set(CPACK_GENERATOR ZIP)
    set(CPACK_BINARY_ZIP 1)
    if(MINGW)
        set(runtime)
        if(LYX_XMINGW)
            execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIBGCC OUTPUT_STRIP_TRAILING_WHITESPACE)
        else()
            set(GCC_LIBGCC ${CMAKE_CXX_COMPILER})
        endif()

        # RKH
        # get_filename_component(MINGW_RUNTIME_PATH ${GCC_LIBGCC} PATH)
        set(MINGW_RUNTIME_PATH "/usr/i686-w64-mingw32/sys-root/mingw/bin")
        macro(add_runtime_dll _DLL)
            file(GLOB GCC_RUNTIME ${MINGW_RUNTIME_PATH}/${_DLL})
            list(APPEND runtime ${GCC_RUNTIME})
        endmacro()
        add_runtime_dll(iconv.dll)
        add_runtime_dll(libgcc*.dll)
        add_runtime_dll(libstd*.dll)
        add_runtime_dll(libwin*.dll)
        add_runtime_dll(libbz2-1.dll)
        add_runtime_dll(libfreetype-6.dll)
        add_runtime_dll(libglib-2.0-0.dll)
        add_runtime_dll(libgraphite2.dll)
        add_runtime_dll(libharfbuzz-0.dll)
        add_runtime_dll(libicudt6*.dll)
        add_runtime_dll(libicuin6*.dll)
        add_runtime_dll(libicuuc6*.dll)
        add_runtime_dll(libintl-8.dll)
        add_runtime_dll(libjpeg-62.dll)
        add_runtime_dll(libpcre-1.dll)
        add_runtime_dll(libpcre2-16-0.dll)
        add_runtime_dll(libpng16-16.dll)
        add_runtime_dll(libtiff-5.dll)
        add_runtime_dll(libwebp-7.dll)
        add_runtime_dll(libwebpdemux-2.dll)
        add_runtime_dll(zlib1.dll)

        if(NOT runtime)
            message(FATAL_ERROR "No mingw runtime found in ${MINGW_RUNTIME_PATH}")
        endif()

        if(LYX_USE_QT MATCHES "QT5")
            get_target_property(qmakebin Qt5::qmake IMPORTED_LOCATION)
            # RKH
            # get_filename_component(QT_BINARY_DIR ${qmakebin} PATH)
            set(QT_BINARY_DIR "/usr/i686-w64-mingw32/sys-root/mingw/bin")
            install(FILES
                ${runtime}
                ${QT_BINARY_DIR}/Qt5Core.dll
                ${QT_BINARY_DIR}/Qt5Network.dll
                ${QT_BINARY_DIR}/Qt5Gui.dll
                ${QT_BINARY_DIR}/Qt5Widgets.dll
                ${QT_BINARY_DIR}/Qt5Concurrent.dll
                ${QT_BINARY_DIR}/Qt5OpenGL.dll
                ${QT_BINARY_DIR}/Qt5PrintSupport.dll
                ${QT_BINARY_DIR}/Qt5Svg.dll
                ${QT_BINARY_DIR}/Qt5WinExtras.dll
                DESTINATION bin)
            install(FILES
                ${QT_BINARY_DIR}/../lib/qt5/plugins/platforms/qminimal.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/platforms/qwindows.dll
                DESTINATION bin/platforms)
            install(FILES
                ${QT_BINARY_DIR}/../lib/qt5/plugins/printsupport/windowsprintersupport.dll
                DESTINATION bin/printsupport)
            install(FILES
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qgif.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qicns.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qico.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qjpeg.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qsvg.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qtga.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qtiff.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qwbmp.dll
                ${QT_BINARY_DIR}/../lib/qt5/plugins/imageformats/qwebp.dll
                DESTINATION bin/imageformats)
            install(FILES
                ${QT_BINARY_DIR}/../lib/qt5/plugins/styles/qwindowsvistastyle.dll
                DESTINATION bin/styles)
            install(FILES
                ${QT_BINARY_DIR}/../lib/qt5/plugins/iconengines/qsvgicon.dll
                DESTINATION bin/iconengines)
        else()
            install(FILES
                ${runtime}
                ${QT_BINARY_DIR}/QtCore4.dll
                ${QT_BINARY_DIR}/QtGui4.dll
                ${QT_BINARY_DIR}/QtNetwork4.dll
                ${QT_PLUGINS_DIR}/imageformats/qgif4.dll
                ${QT_PLUGINS_DIR}/imageformats/qico4.dll
                ${QT_PLUGINS_DIR}/imageformats/qmng4.dll
                ${QT_PLUGINS_DIR}/imageformats/qsvg4.dll
                ${QT_PLUGINS_DIR}/imageformats/qtga4.dll
                ${QT_PLUGINS_DIR}/imageformats/qtiff4.dll
                DESTINATION bin)
        endif()
    endif()
else()
	# needed by rpm
	set(CPACK_SET_DESTDIR "ON")
endif()

FILE(READ "${TOP_CMAKE_PATH}/LyX_license.txt" CPACK_RPM_PACKAGE_LICENSE)
set(CPACK_RPM_PACKAGE_GROUP "Applications/Publishing")
set(CPACK_RPM_PACKAGE_VENDOR "The LyX team")
#
# the next ones are needed by deb
set(CPACK_PACKAGE_CONTACT "${PACKAGE_BUGREPORT}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${LYX_PROJECT}-${LYX_INSTALL_SUFFIX}")

# We depend on python scripting
# Currently no need to specify versions for pythonx since they are only
# available in newest distributions.
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python (>= 2.7) | python3 | python2")
set(CPACK_DEBIAN_PACKAGE_SECTION "universe/editors")

# use dpkg-shlibdeps to generate additional info for package dependency list.
set(CPACK_DEBIAN_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_DEBIAN_PACKAGE_DEBUG ON)

#
# for the next ones, cpack insists on data with values in some file
set(CPACK_PACKAGE_DESCRIPTION_FILE "${TOP_CMAKE_PATH}/LyX_description.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")

# Use the revision number saved in ${LYX_PACKAGE_RELEASE}
# as the release in rpm-package-build.
# This way we maycan omit the otherwise needed "--force" parameter when
# installing from that rpm package.
set(CPACK_RPM_PACKAGE_RELEASE ${LYX_PACKAGE_RELEASE})
set(CPACK_PACKAGE_VERSION_PATCH ${LYX_REVISION_VERSION})

# we do not have a readme or welcome data,
# so we do not provide infofiles for
# CPACK_RESOURCE_FILE_README and CPACK_RESOURCE_FILE_WELCOME

# sources
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${TOP_SRC_DIR};/") # http://www.mail-archive.com/cmake@cmake.org/msg33720.html


set(CPACK_STRIP_FILES 1)

# Finaly give some hints about files not to be included in source package
SET(CPACK_SOURCE_IGNORE_FILES
"/CVS/"
"/\\\\.svn/"
"/\\\\.bzr/"
"/\\\\.hg/"
"/\\\\.git/"
"/\\\\.project$"
"/\\\\.cproject$"
"/\\\\.history$"
"/\\\\.gitignore$"
"/\\\\.gitattributes$"
"\\\\.#"
"\\\\.swp$"
"\\\\.my$"
"\\\\.pyc$"
"\\\\.patch$"
"~$"
"/#"
"/_CPack_Packages/"
"/CMakeCache.txt$"
"/CPackSourceConfig\\\\.cmake$"
"/configCompiler\\\\.h$"
"/install_manifest\\\\.txt$"
"/cmake_install\\\\.cmake$"
"/POTFILES"
"\\\\.tar\\\\.gz$"
"\\\\.tar\\\\.bz2$"
"\\\\.tar\\\\.Z$"
"\\\\.deb$"
"\\\\.rpm$"
"\\\\.rej$"
"\\\\.orig$"
"/core$"
"/CMakeFiles/"
"/Makefile\\\\.in$"
"/Makefile$"
"/autom4te\\\\.cache/"
"/\\\\.deps/"
"/build/"
"/attic/"
"/HTML/"
"/lyx-2\\\\."
"/expectedTestFailures$"
"/MergedManuals.lyx$"
)

if(LYX_CPACK)
	include(CPack)
endif()


#Now it is possible to create some packages
# cd <BuildDir>
# make package
#############################################################################################
# So, e.g. for variables
#    CMAKE_PROJECT_NAME                     : lyx
#    CPACK_PACKAGE_VERSION_MAJOR            : 2
#    CPACK_PACKAGE_VERSION_MINOR            : 0
#    CPACK_PACKAGE_VERSION_PATCH            : 1
#    CMAKE_SYSTEM_NAME                      : Linux
#    CPACK_BINARY_DEB:BOOL                  : ON
#
# the package name builds as "lyx-2.0.1-Linux.deb"
#
############################## rpm ################################### deb ##################
# create    # cpack -G RPM --config CPackConfig.cmake   # cpack -G DEB --config CPackConfig.cmake
# creates =># lyx-2.0.1-Linux.rpm                       # lyx-2.0.1-Linux.deb
# list      # rpm -qlp lyx-2.0.1-Linux.rpm              # dpkg-deb -c lyx-2.0.1-Linux.deb
# install   # rpm -U lyx-2.0.1-Linux.rpm                # dpkg -i lyx-2.0.1-Linux.deb
#