Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-cpp/pystring/files/, dev-cpp/pystring/
Date: Sat, 12 Jun 2021 12:55:21
Message-Id: 1623502494.91773fd1eb57d4c080c0151f5899f1631ddf2aac.sam@gentoo
1 commit: 91773fd1eb57d4c080c0151f5899f1631ddf2aac
2 Author: Sebastian Parborg <darkdefende <AT> gmail <DOT> com>
3 AuthorDate: Sat Jun 12 12:00:18 2021 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 12 12:54:54 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91773fd1
7
8 dev-cpp/pystring: Don't use hardcoded g++ (convert to CMake)
9
10 Convert the project into cmake so we get compiler switching for free.
11
12 Closes: https://bugs.gentoo.org/795156
13 Closes: https://bugs.gentoo.org/795168
14 Signed-off-by: Sebastian Parborg <darkdefende <AT> gmail.com>
15 Closes: https://github.com/gentoo/gentoo/pull/21209
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 dev-cpp/pystring/files/cmake.patch | 84 ++++++++++++++++++++++
19 ...tring-1.1.3.ebuild => pystring-1.1.3-r1.ebuild} | 20 ++----
20 2 files changed, 91 insertions(+), 13 deletions(-)
21
22 diff --git a/dev-cpp/pystring/files/cmake.patch b/dev-cpp/pystring/files/cmake.patch
23 new file mode 100644
24 index 00000000000..bd4e01e6658
25 --- /dev/null
26 +++ b/dev-cpp/pystring/files/cmake.patch
27 @@ -0,0 +1,84 @@
28 +From 4f653fc35421129eae8a2c424901ca7170059370 Mon Sep 17 00:00:00 2001
29 +From: Harry Mallon <harry.mallon@×××××.online>
30 +Date: Thu, 15 Apr 2021 15:50:22 +0100
31 +Subject: [PATCH] Add a CMake configuration
32 +
33 +---
34 + CMakeLists.txt | 56 +++++++++++++++++++++++++++++++++++
35 + cmake/pystringConfig.cmake.in | 4 +++
36 + 2 files changed, 60 insertions(+)
37 + create mode 100644 CMakeLists.txt
38 + create mode 100644 cmake/pystringConfig.cmake.in
39 +
40 +diff --git a/CMakeLists.txt b/CMakeLists.txt
41 +new file mode 100644
42 +index 0000000..0081a83
43 +--- /dev/null
44 ++++ b/CMakeLists.txt
45 +@@ -0,0 +1,56 @@
46 ++cmake_minimum_required(VERSION 3.2)
47 ++
48 ++option(BUILD_SHARED_LIBS "Create shared libraries if ON" OFF)
49 ++
50 ++project(pystring LANGUAGES CXX)
51 ++
52 ++# pystring library ======
53 ++
54 ++add_library(pystring
55 ++ pystring.cpp
56 ++ pystring.h
57 ++)
58 ++set_target_properties(pystring
59 ++ PROPERTIES
60 ++ PUBLIC_HEADER pystring.h
61 ++ SOVERSION 0.0)
62 ++
63 ++set(EXPORT_NAME "${PROJECT_NAME}Targets")
64 ++set(NAMESPACE "${PROJECT_NAME}::")
65 ++
66 ++# test ======
67 ++
68 ++include(CTest)
69 ++
70 ++if(BUILD_TESTING)
71 ++ add_executable(pystring_test
72 ++ test.cpp
73 ++ unittest.h
74 ++ )
75 ++
76 ++ target_link_libraries(pystring_test pystring)
77 ++
78 ++ add_test(NAME pystring_test COMMAND pystring_test)
79 ++endif()
80 ++
81 ++# install and cmake configs ======
82 ++
83 ++include(GNUInstallDirs)
84 ++install(TARGETS pystring
85 ++ EXPORT "${EXPORT_NAME}"
86 ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
87 ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
88 ++ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
89 ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pystring)
90 ++
91 ++include(CMakePackageConfigHelpers)
92 ++configure_package_config_file(cmake/pystringConfig.cmake.in
93 ++ ${CMAKE_CURRENT_BINARY_DIR}/pystringConfig.cmake
94 ++ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring)
95 ++
96 ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pystringConfig.cmake
97 ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring)
98 ++
99 ++install(EXPORT "${EXPORT_NAME}"
100 ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring
101 ++ NAMESPACE "${NAMESPACE}")
102 +diff --git a/cmake/pystringConfig.cmake.in b/cmake/pystringConfig.cmake.in
103 +new file mode 100644
104 +index 0000000..82e3995
105 +--- /dev/null
106 ++++ b/cmake/pystringConfig.cmake.in
107 +@@ -0,0 +1,4 @@
108 ++@PACKAGE_INIT@
109 ++
110 ++include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake")
111 ++check_required_components("@PROJECT_NAME@")
112
113 diff --git a/dev-cpp/pystring/pystring-1.1.3.ebuild b/dev-cpp/pystring/pystring-1.1.3-r1.ebuild
114 similarity index 67%
115 rename from dev-cpp/pystring/pystring-1.1.3.ebuild
116 rename to dev-cpp/pystring/pystring-1.1.3-r1.ebuild
117 index 65cd43ca763..808484d4a23 100644
118 --- a/dev-cpp/pystring/pystring-1.1.3.ebuild
119 +++ b/dev-cpp/pystring/pystring-1.1.3-r1.ebuild
120 @@ -3,6 +3,8 @@
121
122 EAPI=7
123
124 +inherit cmake
125 +
126 DESCRIPTION="C++ functions matching the interface and behavior of python string methods"
127 HOMEPAGE="https://github.com/imageworks/pystring"
128
129 @@ -23,16 +25,8 @@ RESTRICT="mirror"
130 LICENSE="BSD"
131 SLOT="0"
132
133 -src_compile() {
134 - sed -i -e "s|-O3|${CXXFLAGS}|g" Makefile || die
135 - emake LIBDIR="${S}" install
136 -
137 - # Fix header location
138 - mkdir ${S}/pystring || die
139 - mv ${S}/pystring.h ${S}/pystring || die
140 -}
141 -
142 -src_install() {
143 - dolib.so ${S}/libpystring.so{,.0{,.0.0}}
144 - doheader -r ${S}/pystring
145 -}
146 +PATCHES=(
147 + # Patch to convert the project into cmake. Taken from:
148 + # https://github.com/imageworks/pystring/pull/29
149 + "${FILESDIR}/cmake.patch"
150 +)