From 783892bb509265ea3e5d03e7113d42093d5d2f60 Mon Sep 17 00:00:00 2001 From: Antonio Trande Date: Jun 02 2021 20:34:58 +0000 Subject: Release 2.65| Create Python binding| Create libraries --- diff --git a/.gitignore b/.gitignore index 797f485..92fab52 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /smoldyn-2.58.zip /smoldyn-2.61.zip /smoldyn-2.63.zip +/smoldyn-2.65.zip diff --git a/smoldyn-avoid_automatic_wheel.patch b/smoldyn-avoid_automatic_wheel.patch new file mode 100644 index 0000000..18ca1a2 --- /dev/null +++ b/smoldyn-avoid_automatic_wheel.patch @@ -0,0 +1,32 @@ +--- source/python/CMakeLists.origin.txt 2021-06-02 19:24:03.389265000 +0200 ++++ source/python/CMakeLists.txt 2021-06-02 19:27:04.725010640 +0200 +@@ -23,11 +23,13 @@ + target_link_libraries(_pysmoldyn PUBLIC ${PYTHON_LIBRARIES}) + + # A custom target to install dependencies. Useful on various CI ++if(WINDOWS_BUILD) + add_custom_target(install_deps + COMMAND ${Python3_EXECUTABLE} -m pip install wheel numpy setuptools --user + COMMENT "Installing Python modules for testing" + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + VERBATIM) ++endif() + + # FIXME: If it comes in your way, comment it out. + # FIXME: FOllowing runs on github actions and other CI (for Windows only). +@@ -124,6 +128,7 @@ + # + # Install target + # ++if(WINDOWS_BUILD) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/install_wheel.py.in + ${CMAKE_BINARY_DIR}/install_wheel.py) + +@@ -131,6 +136,7 @@ + COMMAND ${Python3_EXECUTABLE} install_wheel.py + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + )") ++endif() + + ### python tests ### + enable_testing() diff --git a/smoldyn-create_soname.patch b/smoldyn-create_soname.patch new file mode 100644 index 0000000..755cc1d --- /dev/null +++ b/smoldyn-create_soname.patch @@ -0,0 +1,36 @@ +--- CMakeLists.txt.fix_libpaths 2021-05-24 21:00:30.000000000 +0200 ++++ CMakeLists.txt 2021-06-02 18:44:48.679744434 +0200 +@@ -437,15 +437,15 @@ + + if (APPLE_BUILD) + set_target_properties(smoldyn_shared PROPERTIES LINK_FLAGS "-framework Glut -framework OpenGL") +- elseif (WINDOWS_BUILD) +- set_target_properties(smoldyn_shared PROPERTIES PREFIX "lib") ++ elseif (UNIX) ++ set_target_properties(smoldyn_shared PROPERTIES PREFIX "lib" SOVERSION "${SMOLDYN_VERSION_MAJOR}" VERSION "${SMOLDYN_VERSION}") + set_target_properties(smoldyn_static PROPERTIES PREFIX "lib") + endif () + endif () + + if (OPTION_TARGET_SMOLDYN) + add_executable(smoldyn ${MAIN_FILES}) +- target_link_libraries(smoldyn PUBLIC smoldyn_static) ++ target_link_libraries(smoldyn PUBLIC smoldyn_shared) + target_link_libraries(smoldyn PUBLIC ${DEP_LIBS}) + endif () + +@@ -470,11 +470,9 @@ + endif() + + if (OPTION_TARGET_LIBSMOLDYN) +- install(TARGETS smoldyn_shared LIBRARY DESTINATION lib) +- install(TARGETS smoldyn_static ARCHIVE DESTINATION lib) +- install(FILES source/Smoldyn/libsmoldyn.h source/Smoldyn/smoldyn.h +- ${CMAKE_CURRENT_BINARY_DIR}/smoldynconfigure.h +- DESTINATION include) ++ install(TARGETS smoldyn_shared LIBRARY DESTINATION lib${LIB_SUFFIX}) ++ install(TARGETS smoldyn_static ARCHIVE DESTINATION lib${LIB_SUFFIX}) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/../source/Smoldyn/libsmoldyn.h ${CMAKE_CURRENT_BINARY_DIR}/../source/Smoldyn/smoldyn.h ${CMAKE_CURRENT_BINARY_DIR}/smoldynconfigure.h DESTINATION include/smoldyn) + endif () + endif () + diff --git a/smoldyn-fix_libpaths.patch b/smoldyn-fix_libpaths.patch index 3f4d155..e5cb901 100644 --- a/smoldyn-fix_libpaths.patch +++ b/smoldyn-fix_libpaths.patch @@ -1,17 +1,6 @@ ---- CMakeLists.txt.fix_libpaths 2018-09-18 23:33:59.000000000 +0200 -+++ CMakeLists.txt 2019-02-03 19:25:01.064012276 +0100 -@@ -103,10 +103,7 @@ - ${CMAKE_SOURCE_DIR}/source/libSteve/SFMT/SFMT.h - ${CMAKE_SOURCE_DIR}/source/Smoldyn/smoldyn.h - ${CMAKE_SOURCE_DIR}/source/Smoldyn/smoldynfuncs.h -- ${CMAKE_SOURCE_DIR}/source/vcell/SimpleMesh.h -- ${CMAKE_SOURCE_DIR}/source/vcell/SimpleValueProvider.h - ${CMAKE_SOURCE_DIR}/source/NextSubVolume/nsvc.h -- ${CMAKE_SOURCE_DIR}/source/vtk/vtkwrapper.h - ) - - set(SRC_FILES -@@ -213,7 +210,7 @@ +--- CMakeLists.txt.fix_libpaths 2021-05-24 21:00:30.000000000 +0200 ++++ CMakeLists.txt 2021-06-02 18:34:02.336369885 +0200 +@@ -209,7 +209,7 @@ set(APPLE_BUILD ON) message(STATUS "Compiling on an Apple computer") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-deprecated -mmacosx-version-min=10.9") @@ -20,7 +9,7 @@ elseif (WIN32) set(WINDOWS_BUILD ON) if(MSVC) -@@ -229,7 +226,7 @@ +@@ -225,7 +225,7 @@ else () set(NIX_BUILD ON) message(STATUS "Compiling on a Linux computer") @@ -29,7 +18,7 @@ endif () message(STATUS "CMAKE_CXX_FLAGS variable: '${CMAKE_CXX_FLAGS}'") -@@ -397,7 +394,8 @@ +@@ -389,7 +382,8 @@ find_path(ZLIB_INCLUDE_DIRS zlib.h) find_library(ZLIB_LIBRARIES libz.a) else() @@ -39,27 +28,13 @@ endif() if(ZLIB_INCLUDE_DIRS AND ZLIB_LIBRARIES) -@@ -479,7 +477,7 @@ - endif () - - -- set(Boost_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/source/NextSubVolume/boost_include) -+ set(Boost_INCLUDE_DIR ${INCLUDE_INSTALL_DIR}/boost) - include_directories(SYSTEM ${Boost_INCLUDE_DIR}) - message(STATUS "Boost headers found: '${Boost_INCLUDE_DIR}'") - -@@ -554,11 +545,9 @@ - endif() - - if (OPTION_TARGET_LIBSMOLDYN) -- install(TARGETS smoldyn_shared LIBRARY DESTINATION lib) -- install(TARGETS smoldyn_static ARCHIVE DESTINATION lib) -- install(FILES source/Smoldyn/libsmoldyn.h source/Smoldyn/smoldyn.h -- ${CMAKE_CURRENT_BINARY_DIR}/smoldynconfigure.h -- DESTINATION include) -+ install(TARGETS smoldyn_shared LIBRARY DESTINATION lib${LIB_SUFFIX}/smoldyn) -+ install(TARGETS smoldyn_static ARCHIVE DESTINATION lib${LIB_SUFFIX}/smoldyn) -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/source/Smoldyn/libsmoldyn.h ${CMAKE_CURRENT_BINARY_DIR}/source/Smoldyn/smoldyn.h ${CMAKE_CURRENT_BINARY_DIR}/smoldynconfigure.h ${CMAKE_CURRENT_BINARY_DIR}/smoldynconfigure.h DESTINATION include/smoldyn) - endif () - +@@ -462,8 +456,7 @@ + if (OPTION_PYTHON) + # Find python before using pybind11. There is a possibility of version mismatch later. + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) +- set(PYBIND11_SOURCE_DIR ${CMAKE_SOURCE_DIR}/source/pybind11) +- add_subdirectory(${PYBIND11_SOURCE_DIR}) ++ find_package(pybind11) + add_subdirectory(${CMAKE_SOURCE_DIR}/source/python) endif () + diff --git a/smoldyn.spec b/smoldyn.spec index 3cb6391..590b6bd 100644 --- a/smoldyn.spec +++ b/smoldyn.spec @@ -8,8 +8,8 @@ Name: smoldyn Summary: A particle-based spatial stochastic simulator -Version: 2.63 -Release: 2%{?dist} +Version: 2.65 +Release: 1%{?dist} # The rxnparam.c and SurfaceParam.c source code files are in the public domain. # @@ -26,10 +26,16 @@ Source0: %{url}/%{name}-%{version}.zip # Fix library paths according to the Fedora Project guidelines Patch0: %{name}-fix_libpaths.patch + Patch1: %{name}-freeglut.patch +Patch2: %{name}-create_soname.patch +Patch3: %{name}-avoid_automatic_wheel.patch -BuildRequires: make +%if 0%{?fedora} || 0%{?rhel} > 7 +BuildRequires: cmake +%else BuildRequires: cmake3 +%endif BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: boost-devel @@ -38,12 +44,17 @@ BuildRequires: libXmu-devel BuildRequires: libXi-devel BuildRequires: libtiff-devel BuildRequires: libglvnd-devel +BuildRequires: make BuildRequires: perl-macros BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-wheel +BuildRequires: pybind11-devel %if %{?with_vtk} BuildRequires: vtk-devel %endif BuildRequires: zlib-devel +Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: bionetgen-perl Provides: bundled(SFMT) = 1.3.3 @@ -64,19 +75,40 @@ manipulate or measure the simulated system, support for spatial compartments, molecules with excluded volume, and simulations in 1, 2, or 3 dimensions. %package doc -Summary: %{name} PDF documentation +Summary: %{name} documentation Requires: %{name} = %{version}-%{release} BuildArch: noarch %description doc -%{name} PDF documentation. +%{name} documentation. + +%package libs +Summary: %{name} libraries +%description libs +%{name} shared libraries. + +%package libs-devel +Summary: %{name} libraries for development +Requires: %{name}-libs%{?_isa} = %{version}-%{release} +%description libs-devel +%{name} shared and static libraries for development. + +%package -n python3-smoldyn +Summary: %{name} libraries for Python +Requires: python3-numpy +%{?python_provide:%python_provide python3-%{name}} +%description -n python3-smoldyn +%{name} libraries for Python. %prep %autosetup -n %{name}-%{version} -N %patch0 -p0 -b .fix_libpaths %patch1 -p0 -b .freeglut +%patch2 -p0 -b .create_soname +%patch3 -p0 -b .avoid_automatic_wheel # Remove bundled archives -rm -rf source/MSVClibs source/pybind11 +rm -rf source/MSVClibs +rm -rf source/pybind11 # Remove bundled libraries rm -rf source/BioNetGen source/MinGWlibs Toolchain-mingw32.cmake @@ -106,7 +138,7 @@ cp -p source/libSteve/SFMT/README.txt source/libSteve/SFMT/SFMT-README.txt %build # Python binding needs shared libraries -%cmake3 -Wno-dev -B . -S . \ +%cmake -Wno-dev -B build \ -DCPACK_BINARY_STGZ:BOOL=OFF \ -DCPACK_BINARY_TGZ:BOOL=OFF \ -DCPACK_BINARY_TZ:BOOL=OFF \ @@ -120,11 +152,12 @@ cp -p source/libSteve/SFMT/README.txt source/libSteve/SFMT/SFMT-README.txt %else -DOPTION_VTK:BOOL=OFF \ %endif - -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=ON \ -DSMOLDYN_VERSION:STRING=%{version} \ - -DOPTION_TARGET_LIBSMOLDYN:BOOL=OFF \ + -DSMOLDYN_VERSION_MAJOR:STRING=2 \ + -DOPTION_TARGET_LIBSMOLDYN:BOOL=ON \ -DOPTION_STATIC:BOOL=OFF \ - -DOPTION_PYTHON:BOOL=OFF -DPYBIND11_FINDPYTHON:BOOL=OFF \ + -DOPTION_PYTHON:BOOL=ON -DPYBIND11_FINDPYTHON:BOOL=ON -Dpybind11_DIR:PATH=%{_datadir}/cmake/pybind11 \ -DOPTION_USE_ZLIB:BOOL=ON \ -DOPTION_PDE:BOOL=ON \ -DPERL_VENDORLIB:PATH=%{perl_vendorlib} \ @@ -133,19 +166,42 @@ cp -p source/libSteve/SFMT/README.txt source/libSteve/SFMT/SFMT-README.txt -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DCMAKE_COLOR_MAKEFILE:BOOL=ON \ -DCMAKE_SKIP_RPATH:BOOL=YES \ -DHAVE_GL_FREEGLUT_H=TRUE -%make_build +%make_build -C build %install -%make_install +%make_install -C build +pushd build/py +mkdir -p %{buildroot}%{python3_sitearch} +cp -a smoldyn *.egg-info %{buildroot}%{python3_sitearch}/ +popd %files -%license License.txt source/libSteve/SFMT/SFMT-LICENSE.txt %{_bindir}/%{name} +%files libs +%license License.txt source/libSteve/SFMT/SFMT-LICENSE.txt +%{_libdir}/lib%{name}_shared.so.%{version} +%{_libdir}/lib%{name}_shared.so.2 +%{_includedir}/%{name}/ + +%files libs-devel +%{_libdir}/lib%{name}_shared.so +%{_libdir}/lib%{name}_static.a + +%files -n python3-smoldyn +%license License.txt source/libSteve/SFMT/SFMT-LICENSE.txt +%{python3_sitearch}/%{name}/ +%{python3_sitearch}/*.egg-info + %files doc -%doc documentation/* +%doc docs/* %changelog +* Wed Jun 02 2021 Antonio Trande - 2.65-1 +- Release 2.65 +- Create Python binding +- Create libraries + * Sat Jan 30 2021 Antonio Trande - 2.63-2 - Exclude example files (strange permissions) diff --git a/sources b/sources index c1894c7..65aa419 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (smoldyn-2.63.zip) = 289f80e891b3bea5ab7175c410814750ce1bf4f949a73c17a46e7be36ec43cb19d632ee0cc94367003dabe2b760c9badf61db613ced732d7f7e7724f9b50d24c +SHA512 (smoldyn-2.65.zip) = 9e08b6e226b57df84834ed43badff8e6bc52bec3fa6416588c194897fffd790df76f81310580d74453917a0744ada6fefbc20615ff6b153356e0bdf8ab1bdab9