public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-cpp/pystring/files/, dev-cpp/pystring/
Date: Sat, 12 Jun 2021 12:55:17 +0000 (UTC)	[thread overview]
Message-ID: <1623502494.91773fd1eb57d4c080c0151f5899f1631ddf2aac.sam@gentoo> (raw)

commit:     91773fd1eb57d4c080c0151f5899f1631ddf2aac
Author:     Sebastian Parborg <darkdefende <AT> gmail <DOT> com>
AuthorDate: Sat Jun 12 12:00:18 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 12 12:54:54 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=91773fd1

dev-cpp/pystring: Don't use hardcoded g++ (convert to CMake)

Convert the project into cmake so we get compiler switching for free.

Closes: https://bugs.gentoo.org/795156
Closes: https://bugs.gentoo.org/795168
Signed-off-by: Sebastian Parborg <darkdefende <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/21209
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-cpp/pystring/files/cmake.patch                 | 84 ++++++++++++++++++++++
 ...tring-1.1.3.ebuild => pystring-1.1.3-r1.ebuild} | 20 ++----
 2 files changed, 91 insertions(+), 13 deletions(-)

diff --git a/dev-cpp/pystring/files/cmake.patch b/dev-cpp/pystring/files/cmake.patch
new file mode 100644
index 00000000000..bd4e01e6658
--- /dev/null
+++ b/dev-cpp/pystring/files/cmake.patch
@@ -0,0 +1,84 @@
+From 4f653fc35421129eae8a2c424901ca7170059370 Mon Sep 17 00:00:00 2001
+From: Harry Mallon <harry.mallon@codex.online>
+Date: Thu, 15 Apr 2021 15:50:22 +0100
+Subject: [PATCH] Add a CMake configuration
+
+---
+ CMakeLists.txt                | 56 +++++++++++++++++++++++++++++++++++
+ cmake/pystringConfig.cmake.in |  4 +++
+ 2 files changed, 60 insertions(+)
+ create mode 100644 CMakeLists.txt
+ create mode 100644 cmake/pystringConfig.cmake.in
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+new file mode 100644
+index 0000000..0081a83
+--- /dev/null
++++ b/CMakeLists.txt
+@@ -0,0 +1,56 @@
++cmake_minimum_required(VERSION 3.2)
++
++option(BUILD_SHARED_LIBS "Create shared libraries if ON" OFF)
++
++project(pystring LANGUAGES CXX)
++
++# pystring library ======
++
++add_library(pystring
++    pystring.cpp
++    pystring.h
++)
++set_target_properties(pystring
++    PROPERTIES
++        PUBLIC_HEADER pystring.h
++        SOVERSION 0.0)
++
++set(EXPORT_NAME "${PROJECT_NAME}Targets")
++set(NAMESPACE "${PROJECT_NAME}::")
++
++# test ======
++
++include(CTest)
++
++if(BUILD_TESTING)
++    add_executable(pystring_test
++        test.cpp
++        unittest.h
++    )
++
++    target_link_libraries(pystring_test pystring)
++
++    add_test(NAME pystring_test COMMAND pystring_test)
++endif()
++
++# install and cmake configs ======
++
++include(GNUInstallDirs)
++install(TARGETS pystring
++        EXPORT "${EXPORT_NAME}"
++        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++        INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
++        PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pystring)
++
++include(CMakePackageConfigHelpers)
++configure_package_config_file(cmake/pystringConfig.cmake.in
++    ${CMAKE_CURRENT_BINARY_DIR}/pystringConfig.cmake
++    INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring)
++
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pystringConfig.cmake
++    DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring)
++
++install(EXPORT "${EXPORT_NAME}"
++        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/pystring
++        NAMESPACE "${NAMESPACE}")
+diff --git a/cmake/pystringConfig.cmake.in b/cmake/pystringConfig.cmake.in
+new file mode 100644
+index 0000000..82e3995
+--- /dev/null
++++ b/cmake/pystringConfig.cmake.in
+@@ -0,0 +1,4 @@
++@PACKAGE_INIT@
++
++include("${CMAKE_CURRENT_LIST_DIR}/@EXPORT_NAME@.cmake")
++check_required_components("@PROJECT_NAME@")

diff --git a/dev-cpp/pystring/pystring-1.1.3.ebuild b/dev-cpp/pystring/pystring-1.1.3-r1.ebuild
similarity index 67%
rename from dev-cpp/pystring/pystring-1.1.3.ebuild
rename to dev-cpp/pystring/pystring-1.1.3-r1.ebuild
index 65cd43ca763..808484d4a23 100644
--- a/dev-cpp/pystring/pystring-1.1.3.ebuild
+++ b/dev-cpp/pystring/pystring-1.1.3-r1.ebuild
@@ -3,6 +3,8 @@
 
 EAPI=7
 
+inherit cmake
+
 DESCRIPTION="C++ functions matching the interface and behavior of python string methods"
 HOMEPAGE="https://github.com/imageworks/pystring"
 
@@ -23,16 +25,8 @@ RESTRICT="mirror"
 LICENSE="BSD"
 SLOT="0"
 
-src_compile() {
-	sed -i -e "s|-O3|${CXXFLAGS}|g" Makefile || die
-	emake LIBDIR="${S}" install
-
-	# Fix header location
-	mkdir ${S}/pystring || die
-	mv ${S}/pystring.h ${S}/pystring || die
-}
-
-src_install() {
-	dolib.so ${S}/libpystring.so{,.0{,.0.0}}
-	doheader -r ${S}/pystring
-}
+PATCHES=(
+	# Patch to convert the project into cmake. Taken from:
+	# https://github.com/imageworks/pystring/pull/29
+	"${FILESDIR}/cmake.patch"
+)


             reply	other threads:[~2021-06-12 12:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 12:55 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-22  1:30 [gentoo-commits] repo/gentoo:master commit in: dev-cpp/pystring/files/, dev-cpp/pystring/ Sam James
2025-05-20 19:12 Andreas Sturmlechner
2025-05-26 10:27 Sam James

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623502494.91773fd1eb57d4c080c0151f5899f1631ddf2aac.sam@gentoo \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox