diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..addc96c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/pystring-1.1.3.tar.gz diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7077dbc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +project(pystring + LANGUAGES CXX + ) + +cmake_minimum_required(VERSION 3.0) + +set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra -Wshadow -Wconversion -Wcast-qual -Wformat=2 ${CMAKE_CXX_FLAGS}") + +include(GNUInstallDirs) +mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_INCLUDEDIR + ) + +add_library(pystring SHARED + pystring.cpp + ) + +set_target_properties(pystring PROPERTIES + SOVERSION 0.0 + ) + +install(TARGETS pystring + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + +install(FILES pystring.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pystring + ) + +add_executable(test pystring.cpp test.cpp) +target_compile_definitions(test PRIVATE PYSTRING_UNITTEST=1) diff --git a/pystring.spec b/pystring.spec new file mode 100644 index 0000000..92a481b --- /dev/null +++ b/pystring.spec @@ -0,0 +1,69 @@ +%undefine __cmake_in_source_build + +Name: pystring +Version: 1.1.3 +Release: 1%{?dist} +Summary: Collection of C++ functions emulating Python's string class methods +License: BSD +URL: https://github.com/imageworks/pystring +Source0: https://github.com/imageworks/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz +Source100: CMakeLists.txt + +BuildRequires: cmake +BuildRequires: gcc-c++ + +%description +Pystring is a collection of C++ functions which match the interface and +behavior of Python's string class methods using std::string. Implemented in +C++, it does not require or make use of a Python interpreter. It provides +convenience and familiarity for common string operations not included in the +standard C++ library. It's also useful in environments where both C++ and +Python are used. + +Overlapping functionality (such as index and slice/substr) of std::string is +included to match Python interfaces. + +Originally developed at Sony Pictures Imageworks. +http://opensource.imageworks.com/ + +%package devel + +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +%{summary}. + + +%prep +%autosetup -p1 +cp %{SOURCE100} . + + +%build +%cmake +%cmake_build + + +%install +%cmake_install + + +%check +pushd %{__cmake_builddir} +./test + + +%files +%license LICENSE +%doc README +%{_libdir}/libpystring.so.0.0 + +%files devel +%{_includedir}/pystring/ +%{_libdir}/libpystring.so + + +%changelog +* Sat Nov 28 2020 Richard Shaw - 1.1.3-1 +- Initial packaging. diff --git a/sources b/sources new file mode 100644 index 0000000..8b6af94 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pystring-1.1.3.tar.gz) = a46bb2e96d6eb351a4a8097cde46ac2877d28e88f9e57e0ac36c42e8fc8543517c4be70306a01e2f88a891fc53c612494aeb37f47a200d94b8e1b050ed16eff6