Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/libsfml/, media-libs/libsfml/files/
Date: Sun, 25 Mar 2018 18:24:31
Message-Id: 1522002266.da3ff27aa3315ae8d276a724a2d8ff8b94dffeab.mgorny@gentoo
1 commit: da3ff27aa3315ae8d276a724a2d8ff8b94dffeab
2 Author: Marty E. Plummer <hanetzer <AT> startmail <DOT> com>
3 AuthorDate: Mon Mar 19 22:58:25 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 25 18:24:26 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da3ff27a
7
8 media-libs/libsfml: build and install pkgconfig on mingw-w64
9
10 This is an upstream commit, which will be in the 2.5.0 release, which
11 allows creation of the sfml pkgconfig files on mingw-w64 when either
12 SFML_INSTALL_PKGCONFIG_FILES is true or if their internal check
13 SFML_OS_SUPPORTS_PKGCONFIG returns true; since we explicitly set the
14 former this change will allow build and install of sfml pc files on
15 mingw-w64 and (I think) osx targets.
16
17 Closes: https://github.com/gentoo/gentoo/pull/7518
18 Package-Manager: Portage-2.3.24, Repoman-2.3.6
19
20 .../libsfml/files/libsfml-2.4.2-pkg-config.patch | 217 +++++++++++++++++++++
21 media-libs/libsfml/libsfml-2.4.2-r2.ebuild | 84 ++++++++
22 2 files changed, 301 insertions(+)
23
24 diff --git a/media-libs/libsfml/files/libsfml-2.4.2-pkg-config.patch b/media-libs/libsfml/files/libsfml-2.4.2-pkg-config.patch
25 new file mode 100644
26 index 00000000000..a281d46c9ba
27 --- /dev/null
28 +++ b/media-libs/libsfml/files/libsfml-2.4.2-pkg-config.patch
29 @@ -0,0 +1,217 @@
30 +commit 5fe5e5d6d7792e37685a437551ffa8ed5161fcc1
31 +Author: Rafael Kitover <rkitover@×××××.com>
32 +Date: Mon Dec 19 13:16:07 2016 -0800
33 +
34 + packaging support improvements
35 +
36 + This grew out of my work creating an sfml port for macports, but should
37 + be helpful for package maintainers of various distributions:
38 +
39 + * add an SFML_USE_SYSTEM_DEPS option to ignore everything in extlibs/
40 + except for headers/stb_image, and use the system versions
41 +
42 + * install pkg-config files if a pkg-config program is found
43 + and either lib/pkgconfig or libdata/pkgconfig exists under the
44 + INSTALL_PREFIX, or the SFML_INSTALL_PKGCONFIG_FILES flag is set
45 + explicitly
46 +
47 + * install pkg-config files for static libs too, add the necessary
48 + Requires.private and Libs.private entries to the .pc files to support
49 + static linking
50 +
51 + * on OS X, honor all INSTALL_NAME and RPATH related cmake variables and
52 + only set the INSTALL_NAME_DIR to "@rpath" if none of them is set, this
53 + preserves the default behavior of using @rpath but also allows
54 + overriding by the usual cmake mechanisms
55 +
56 +diff --git a/CMakeLists.txt b/CMakeLists.txt
57 +index e7914ac9..419d56d7 100644
58 +--- a/CMakeLists.txt
59 ++++ b/CMakeLists.txt
60 +@@ -16,6 +16,9 @@ sfml_set_option(CMAKE_BUILD_TYPE Release STRING "Choose the type of build (Debug
61 + # Suppress Cygwin legacy warning
62 + set(CMAKE_LEGACY_CYGWIN_WIN32 0)
63 +
64 ++# Suppress Mac OS X RPATH warnings and adopt new related behaviors
65 ++cmake_policy(SET CMP0042 NEW)
66 ++
67 + # set Android specific options
68 +
69 + # define the minimum API level to be used
70 +@@ -130,6 +133,39 @@ if(NOT BUILD_SHARED_LIBS)
71 + add_definitions(-DSFML_STATIC)
72 + endif()
73 +
74 ++# allow not using bundled dependencies with a switch
75 ++# (except for stb_image)
76 ++# yes this is horrible, but GLOB_RECURSE sucks
77 ++sfml_set_option(SFML_USE_SYSTEM_DEPS FALSE BOOL "TRUE to use system dependencies, FALSE to use the bundled ones.")
78 ++if(SFML_USE_SYSTEM_DEPS)
79 ++ if(SFML_INSTALL_XCODE_TEMPLATES)
80 ++ message(FATAL_ERROR "XCode templates installation cannot be used with the SFML_USE_SYSTEM_DEPS option (the bundled frameworks are required.)")
81 ++ endif()
82 ++
83 ++ file(GLOB_RECURSE DEP_LIBS "${CMAKE_SOURCE_DIR}/extlibs/libs*/*")
84 ++ file(GLOB_RECURSE DEP_BINS "${CMAKE_SOURCE_DIR}/extlibs/bin*/*")
85 ++ file(GLOB_RECURSE DEP_HEADERS "${CMAKE_SOURCE_DIR}/extlibs/headers/*")
86 ++
87 ++ foreach(DEP_FILE ${DEP_LIBS} ${DEP_BINS} ${DEP_HEADERS})
88 ++ get_filename_component(DEP_DIR ${DEP_FILE} PATH)
89 ++
90 ++ if(NOT DEP_DIR MATCHES "/stb_image(/|$)")
91 ++ set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH} ${DEP_DIR})
92 ++ endif()
93 ++
94 ++ get_filename_component(DEP_PARENT_DIR ${DEP_DIR} PATH)
95 ++ while(NOT DEP_PARENT_DIR STREQUAL "${CMAKE_SOURCE_DIR}/extlibs")
96 ++ if(NOT DEP_DIR MATCHES "/stb_image(/|$)")
97 ++ set(CMAKE_IGNORE_PATH ${CMAKE_IGNORE_PATH} ${DEP_PARENT_DIR})
98 ++ endif()
99 ++
100 ++ get_filename_component(DEP_PARENT_DIR ${DEP_PARENT_DIR} PATH)
101 ++ endwhile()
102 ++ endforeach()
103 ++
104 ++ list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH)
105 ++endif()
106 ++
107 + # Visual C++: remove warnings regarding SL security and algorithms on pointers
108 + if(SFML_COMPILER_MSVC)
109 + # add an option to choose whether PDB debug symbols should be generated (defaults to true when possible)
110 +@@ -202,30 +238,6 @@ if(SFML_OS_MACOSX)
111 + set(XCODE_TEMPLATES_ARCH "\$(NATIVE_ARCH_ACTUAL)")
112 + endif()
113 +
114 +-if(SFML_OS_LINUX OR SFML_OS_FREEBSD)
115 +- set(PKGCONFIG_DIR lib${LIB_SUFFIX}/pkgconfig)
116 +- if(SFML_OS_FREEBSD)
117 +- set(PKGCONFIG_DIR libdata/pkgconfig)
118 +- endif()
119 +- if(BUILD_SHARED_LIBS)
120 +- sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
121 +- if(SFML_INSTALL_PKGCONFIG_FILES)
122 +- foreach(sfml_module IN ITEMS all system window graphics audio network)
123 +- CONFIGURE_FILE(
124 +- "tools/pkg-config/sfml-${sfml_module}.pc.in"
125 +- "tools/pkg-config/sfml-${sfml_module}.pc"
126 +- @ONLY)
127 +- INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
128 +- DESTINATION "${CMAKE_INSTALL_PREFIX}/${PKGCONFIG_DIR}")
129 +- endforeach()
130 +- endif()
131 +- else()
132 +- if(SFML_INSTALL_PKGCONFIG_FILES)
133 +- message(WARNING "No pkg-config files are provided for the static SFML libraries (SFML_INSTALL_PKGCONFIG_FILES will be ignored).")
134 +- endif()
135 +- endif()
136 +-endif()
137 +-
138 + # enable project folders
139 + set_property(GLOBAL PROPERTY USE_FOLDERS ON)
140 + set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake")
141 +@@ -239,6 +251,19 @@ if(SFML_BUILD_DOC)
142 + add_subdirectory(doc)
143 + endif()
144 +
145 ++sfml_set_option(SFML_INSTALL_PKGCONFIG_FILES FALSE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML")
146 ++
147 ++if(SFML_OS_SUPPORTS_PKGCONFIG OR SFML_INSTALL_PKGCONFIG_FILES)
148 ++ foreach(sfml_module IN ITEMS all system window graphics audio network)
149 ++ CONFIGURE_FILE(
150 ++ "tools/pkg-config/sfml-${sfml_module}.pc.in"
151 ++ "tools/pkg-config/sfml-${sfml_module}.pc"
152 ++ @ONLY)
153 ++ INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc"
154 ++ DESTINATION "${CMAKE_INSTALL_PREFIX}/${SFML_OS_PKGCONFIG_DIR}")
155 ++ endforeach()
156 ++endif()
157 ++
158 + # setup the install rules
159 + if(NOT SFML_BUILD_FRAMEWORKS)
160 + install(DIRECTORY include
161 +diff --git a/cmake/Config.cmake b/cmake/Config.cmake
162 +index cff54d00..c447113a 100644
163 +--- a/cmake/Config.cmake
164 ++++ b/cmake/Config.cmake
165 +@@ -73,6 +73,19 @@ else()
166 + return()
167 + endif()
168 +
169 ++# check if OS or package system supports pkg-config
170 ++# this could be e.g. macports on mac or msys2 on windows etc.
171 ++find_package(PkgConfig QUIET)
172 ++if(PKG_CONFIG_EXECUTABLE)
173 ++ if(EXISTS "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig")
174 ++ set(SFML_OS_SUPPORTS_PKGCONFIG ON)
175 ++ set(SFML_OS_PKGCONFIG_DIR "/lib${LIB_SUFFIX}/pkgconfig")
176 ++ elseif(EXISTS "${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig")
177 ++ set(SFML_OS_SUPPORTS_PKGCONFIG ON)
178 ++ set(SFML_OS_PKGCONFIG_DIR "/libdata/pkgconfig")
179 ++ endif()
180 ++endif()
181 ++
182 + # detect the compiler and its version
183 + # Note: on some platforms (OS X), CMAKE_COMPILER_IS_GNUCXX is true
184 + # even when CLANG is used, therefore the Clang test is done first
185 +diff --git a/cmake/Macros.cmake b/cmake/Macros.cmake
186 +index cd2ca8fc..0f316034 100644
187 +--- a/cmake/Macros.cmake
188 ++++ b/cmake/Macros.cmake
189 +@@ -105,9 +105,17 @@ macro(sfml_add_library target)
190 + endif()
191 +
192 + # adapt install directory to allow distributing dylibs/frameworks in user's frameworks/application bundle
193 +- set_target_properties(${target} PROPERTIES
194 +- BUILD_WITH_INSTALL_RPATH 1
195 +- INSTALL_NAME_DIR "@rpath")
196 ++ # but only if cmake rpath options aren't set
197 ++ if(NOT CMAKE_SKIP_RPATH AND NOT CMAKE_SKIP_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH AND NOT CMAKE_INSTALL_RPATH_USE_LINK_PATH AND NOT CMAKE_INSTALL_NAME_DIR)
198 ++ if(CMAKE_SKIP_BUILD_RPATH)
199 ++ set_target_properties(${target} PROPERTIES
200 ++ INSTALL_NAME_DIR "@rpath")
201 ++ else()
202 ++ set_target_properties(${target} PROPERTIES
203 ++ BUILD_WITH_INSTALL_RPATH 1
204 ++ INSTALL_NAME_DIR "@rpath")
205 ++ endif()
206 ++ endif()
207 + endif()
208 +
209 + # enable automatic reference counting on iOS
210 +diff --git a/tools/pkg-config/sfml-audio.pc.in b/tools/pkg-config/sfml-audio.pc.in
211 +index 7456daaa..0d7a3ce1 100644
212 +--- a/tools/pkg-config/sfml-audio.pc.in
213 ++++ b/tools/pkg-config/sfml-audio.pc.in
214 +@@ -8,5 +8,8 @@ Description: The Simple and Fast Multimedia Library, audio module.
215 + URL: http://www.sfml-dev.org
216 + Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
217 + Requires: sfml-system
218 ++Requires.private: openal, vorbisenc, vorbisfile, vorbis, ogg, flac
219 + Libs: -L${libdir} -lsfml-audio
220 ++# openal may be a system framework
221 ++Libs.private: @OPENAL_LIBRARY@
222 + Cflags: -I${includedir}
223 +diff --git a/tools/pkg-config/sfml-graphics.pc.in b/tools/pkg-config/sfml-graphics.pc.in
224 +index d0a88a13..a96b72c9 100644
225 +--- a/tools/pkg-config/sfml-graphics.pc.in
226 ++++ b/tools/pkg-config/sfml-graphics.pc.in
227 +@@ -8,5 +8,8 @@ Description: The Simple and Fast Multimedia Library, graphics module.
228 + URL: http://www.sfml-dev.org
229 + Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
230 + Requires: sfml-window
231 ++Requires.private: sfml-system, freetype2
232 + Libs: -L${libdir} -lsfml-graphics
233 ++# gl and jpeg may not be in pkg-config
234 ++Libs.private: @OPENGL_gl_LIBRARY@ @OPENGL_glu_LIBRARY@ @JPEG_LIBRARY@
235 + Cflags: -I${includedir}
236 +diff --git a/tools/pkg-config/sfml-window.pc.in b/tools/pkg-config/sfml-window.pc.in
237 +index b0266e67..93bf344c 100644
238 +--- a/tools/pkg-config/sfml-window.pc.in
239 ++++ b/tools/pkg-config/sfml-window.pc.in
240 +@@ -9,4 +9,6 @@ URL: http://www.sfml-dev.org
241 + Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
242 + Requires: sfml-system
243 + Libs: -L${libdir} -lsfml-window
244 ++# gl may not be in pkg-config
245 ++Libs.private: @OPENGL_gl_LIBRARY@ @OPENGL_glu_LIBRARY@
246 + Cflags: -I${includedir}
247
248 diff --git a/media-libs/libsfml/libsfml-2.4.2-r2.ebuild b/media-libs/libsfml/libsfml-2.4.2-r2.ebuild
249 new file mode 100644
250 index 00000000000..dda2accf7c6
251 --- /dev/null
252 +++ b/media-libs/libsfml/libsfml-2.4.2-r2.ebuild
253 @@ -0,0 +1,84 @@
254 +# Copyright 1999-2018 Gentoo Foundation
255 +# Distributed under the terms of the GNU General Public License v2
256 +
257 +EAPI=6
258 +
259 +inherit cmake-utils versionator
260 +
261 +MY_P="SFML-${PV}"
262 +
263 +DESCRIPTION="Simple and Fast Multimedia Library (SFML)"
264 +HOMEPAGE="http://www.sfml-dev.org/ https://github.com/SFML/SFML"
265 +SRC_URI="https://github.com/SFML/SFML/archive/${PV}.tar.gz -> ${P}.tar.gz"
266 +
267 +LICENSE="ZLIB"
268 +SLOT="0/$(get_version_component_range 1-2)"
269 +KEYWORDS="~amd64 ~x86"
270 +IUSE="debug doc examples"
271 +
272 +RDEPEND="
273 + media-libs/flac
274 + media-libs/freetype:2
275 + media-libs/libpng:0=
276 + media-libs/libogg
277 + media-libs/libvorbis
278 + media-libs/openal
279 + sys-libs/zlib
280 + virtual/jpeg:0
281 + kernel_linux? (
282 + virtual/libudev:0
283 + )
284 + virtual/opengl
285 + !kernel_Winnt? (
286 + x11-libs/libX11
287 + x11-libs/libXrandr
288 + x11-libs/libxcb
289 + x11-libs/xcb-util-image
290 + )
291 +"
292 +DEPEND="
293 + ${RDEPEND}
294 + doc? ( app-doc/doxygen )
295 +"
296 +
297 +DOCS=( changelog.txt readme.txt )
298 +
299 +PATCHES=(
300 + "${FILESDIR}"/${PN}-2.2-no-docs.patch
301 + "${FILESDIR}"/${PN}-2.4.2-no-install-extlibs-mingw.patch
302 + "${FILESDIR}"/${PN}-2.4.2-pkg-config.patch
303 +)
304 +
305 +S="${WORKDIR}/${MY_P}"
306 +
307 +src_prepare() {
308 + sed -i "s:DESTINATION .*:DESTINATION /usr/share/doc/${PF}:" \
309 + doc/CMakeLists.txt || die
310 +
311 + find examples -name CMakeLists.txt -delete || die
312 + cmake-utils_src_prepare
313 +}
314 +
315 +src_configure() {
316 + local mycmakeargs=(
317 + -DSFML_BUILD_DOC=$(usex doc)
318 + -DSFML_INSTALL_PKGCONFIG_FILES=TRUE
319 + )
320 +
321 + if use kernel_Winnt; then
322 + mycmakeargs+=( -DSFML_USE_SYSTEM_DEPS=TRUE )
323 + fi
324 + cmake-utils_src_configure
325 +}
326 +
327 +src_install() {
328 + cmake-utils_src_install
329 +
330 + insinto /usr/share/cmake/Modules
331 + doins cmake/Modules/FindSFML.cmake
332 +
333 + if use examples ; then
334 + docompress -x /usr/share/doc/${PF}/examples
335 + dodoc -r examples
336 + fi
337 +}