commit:     53ed21af3a713116e76bc67013ad056d02953374
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 17 07:54:45 2021 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Jul 17 07:54:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53ed21af

dev-games/physfs: Patch to fix pkg-config libdir entry

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-games/physfs/files/GNUInstallDirs.patch | 74 +++++++++++++++++++++++++++++
 dev-games/physfs/physfs-3.0.2-r1.ebuild     | 58 ++++++++++++++++++++++
 2 files changed, 132 insertions(+)

diff --git a/dev-games/physfs/files/GNUInstallDirs.patch 
b/dev-games/physfs/files/GNUInstallDirs.patch
new file mode 100644
index 00000000000..ef7bb5d1f14
--- /dev/null
+++ b/dev-games/physfs/files/GNUInstallDirs.patch
@@ -0,0 +1,74 @@
+From 727d7a5265ad856fd473ad1c621d6c03dd306d6d Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <[email protected]>
+Date: Sat, 10 Jul 2021 22:55:53 +0100
+Subject: [PATCH] Use the GNUInstallDirs CMake module to respect installation
+ locations
+
+Apparently use of LIB_SUFFIX is now discouraged. GNUInstallDirs does a
+better job of setting a default.
+
+The libdir of ${prefix}/lib in the pkg-config file caused warnings,
+and possibly even failures, when linking on multilib systems where
+/usr/lib is for 32-bit libraries rather than 64-bit libraries.
+---
+ CMakeLists.txt      | 15 ++++++++-------
+ extras/physfs.pc.in |  6 +++---
+ 2 files changed, 11 insertions(+), 10 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 4a67c27..6c26cb1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,6 +14,8 @@ cmake_minimum_required(VERSION 2.8.4)
+ project(PhysicsFS)
+ set(PHYSFS_VERSION 3.0.2)
+ 
++include(GNUInstallDirs)
++
+ # Increment this if/when we break backwards compatibility.
+ set(PHYSFS_SOVERSION 1)
+ 
+@@ -213,11 +215,11 @@ if(PHYSFS_BUILD_TEST)
+     set(PHYSFS_INSTALL_TARGETS ${PHYSFS_INSTALL_TARGETS} ";test_physfs")
+ endif()
+ 
+-install(TARGETS ${PHYSFS_INSTALL_TARGETS}
+-        RUNTIME DESTINATION bin
+-        LIBRARY DESTINATION lib${LIB_SUFFIX}
+-        ARCHIVE DESTINATION lib${LIB_SUFFIX})
+-install(FILES src/physfs.h DESTINATION include)
++install(TARGETS ${PHYSFS_INSTALL_TARGETS} EXPORT PhysFSExport
++        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
++install(FILES src/physfs.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+ find_package(Doxygen)
+ if(DOXYGEN_FOUND)
+@@ -271,7 +273,7 @@ if(NOT MSVC)
+     )
+     install(
+         FILES "${CMAKE_CURRENT_BINARY_DIR}/extras/physfs.pc"
+-        DESTINATION "lib${LIB_SUFFIX}/pkgconfig"
++        DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig"
+     )
+ endif()
+ 
+diff --git a/extras/physfs.pc.in b/extras/physfs.pc.in
+index 6cd0972..f7e0307 100644
+--- a/extras/physfs.pc.in
++++ b/extras/physfs.pc.in
+@@ -1,7 +1,7 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+-exec_prefix=${prefix}
+-libdir=${exec_prefix}/lib
+-includedir=${prefix}/include
++exec_prefix=@CMAKE_INSTALL_PREFIX@
++libdir=@CMAKE_INSTALL_FULL_LIBDIR@
++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
+ 
+ Name: PhysicsFS
+ Description: PhysicsFS is a library to provide abstract access to various 
archives.
+-- 
+2.31.1
+

diff --git a/dev-games/physfs/physfs-3.0.2-r1.ebuild 
b/dev-games/physfs/physfs-3.0.2-r1.ebuild
new file mode 100644
index 00000000000..0d225b66a06
--- /dev/null
+++ b/dev-games/physfs/physfs-3.0.2-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+CMAKE_ECLASS=cmake
+inherit cmake-multilib
+
+DESCRIPTION="Abstraction layer for filesystem and archive access"
+HOMEPAGE="https://icculus.org/physfs/";
+
+if [[ ${PV} == *9999* ]]; then
+       EHG_REPO_URI="https://hg.icculus.org/icculus/physfs";
+       inherit mercurial
+else
+       KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc64 ~x86"
+       SRC_URI="https://icculus.org/physfs/downloads/${P}.tar.bz2";
+fi
+
+LICENSE="ZLIB"
+SLOT="0"
+IUSE="7zip doc grp hog iso mvl qpak slb static-libs vdf wad +zip"
+
+BDEPEND="doc? ( app-doc/doxygen )"
+
+PATCHES=(
+       "${FILESDIR}"/GNUInstallDirs.patch
+)
+
+DOCS=( docs/CHANGELOG.txt docs/CREDITS.txt docs/TODO.txt )
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               -DPHYSFS_BUILD_SHARED=ON
+               -DPHYSFS_BUILD_TEST=OFF
+               -DPHYSFS_BUILD_STATIC="$(usex static-libs)"
+               -DPHYSFS_ARCHIVE_7Z="$(usex 7zip)"
+               -DPHYSFS_ARCHIVE_GRP="$(usex grp)"
+               -DPHYSFS_ARCHIVE_HOG="$(usex hog)"
+               -DPHYSFS_ARCHIVE_ISO9660="$(usex iso)"
+               -DPHYSFS_ARCHIVE_MVL="$(usex mvl)"
+               -DPHYSFS_ARCHIVE_SLB="$(usex slb)"
+               -DPHYSFS_ARCHIVE_VDF="$(usex vdf)"
+               -DPHYSFS_ARCHIVE_WAD="$(usex wad)"
+               -DPHYSFS_ARCHIVE_QPAK="$(usex qpak)"
+               -DPHYSFS_ARCHIVE_ZIP="$(usex zip)"
+       )
+       cmake_src_configure
+}
+
+multilib_src_compile() {
+       cmake_src_compile
+
+       if multilib_is_native_abi && use doc; then
+               cmake_src_compile docs
+               HTML_DOCS=( "${BUILD_DIR}"/docs/html/. )
+       fi
+}

Reply via email to