Fix Fedora 29+ builds & Python3
Patch for building against ICU 61+ Patch for building Python bindings in 2/3 Add python3 package
This commit is contained in:
parent
09b4f78af3
commit
dab06ef8dc
|
@ -0,0 +1,138 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 5cbd06a..1d3a2d2 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1,5 +1,4 @@
|
||||
-# TODO: write FindICU (icu-config only for 2.2 and up) -- currently taken from another CMake system
|
||||
-# limit pkg-config version to >= 0.14, demo, utilities, doc, tests
|
||||
+# TODO: limit pkg-config version to >= 0.14, demo, utilities, doc, tests
|
||||
# use BUILD_SHARED_LIBS
|
||||
# convince perl swig bindings to build properly
|
||||
#
|
||||
@@ -13,7 +12,7 @@
|
||||
# all posterity and eternity, wherever such transfer is possible. Where it is
|
||||
# not, then this file is released under the GPLv2 by myself.
|
||||
PROJECT(libsword CXX C)
|
||||
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
|
||||
+CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
|
||||
SET(SWORD_VERSION 1.8.1)
|
||||
|
||||
# Make sure it's an out-of-stream build
|
||||
@@ -56,7 +55,8 @@ IF(MSVC)
|
||||
ELSE(MSVC)
|
||||
FIND_PACKAGE(BZIP2 QUIET)
|
||||
FIND_PACKAGE(XZ QUIET)
|
||||
- FIND_PACKAGE(ICU QUIET)
|
||||
+ FIND_PACKAGE(ICU
|
||||
+ COMPONENTS data i18n io uc)
|
||||
FIND_PACKAGE(CURL QUIET)
|
||||
ENDIF(MSVC)
|
||||
FIND_PACKAGE(CLucene QUIET)
|
||||
@@ -237,7 +237,11 @@ ENDIF(WITH_CLUCENE)
|
||||
IF(WITH_ICU)
|
||||
INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIRS})
|
||||
ADD_DEFINITIONS(${ICU_DEFINITIONS})
|
||||
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
|
||||
+ MESSAGE(STATUS "ICU Version: ${ICU_VERSION}")
|
||||
+ IF("${ICU_VERSION}" VERSION_GREATER "61")
|
||||
+ ADD_DEFINITIONS(-DU_USING_ICU_NAMESPACE)
|
||||
+ ENDIF("${ICU_VERSION}" VERSION_GREATER "61")
|
||||
+ SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ICU_LIBRARIES})
|
||||
ENDIF(WITH_ICU)
|
||||
IF(REGEX_FOUND AND CROSS_COMPILE_MINGW32)
|
||||
SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${REGEX_LIBRARY})
|
||||
diff --git a/cmake/FindICU.cmake b/cmake/FindICU.cmake
|
||||
deleted file mode 100644
|
||||
index 451c2f3..0000000
|
||||
--- a/cmake/FindICU.cmake
|
||||
+++ /dev/null
|
||||
@@ -1,68 +0,0 @@
|
||||
-# Finds the International Components for Unicode (ICU) Library
|
||||
-#
|
||||
-# ICU_FOUND - True if ICU found.
|
||||
-# ICU_I18N_FOUND - True if ICU's internationalization library found.
|
||||
-# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
|
||||
-# Note: always include ICU headers as, e.g.,
|
||||
-# unicode/utypes.h
|
||||
-# ICU_LIBRARIES - Libraries to link against for the common ICU
|
||||
-# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
|
||||
-# (note: in addition to ICU_LIBRARIES)
|
||||
-
|
||||
-# Look for the header file.
|
||||
-find_path(
|
||||
- ICU_INCLUDE_DIR
|
||||
- NAMES unicode/utypes.h
|
||||
- DOC "Include directory for the ICU library")
|
||||
-mark_as_advanced(ICU_INCLUDE_DIR)
|
||||
-
|
||||
-# Look for the library.
|
||||
-find_library(
|
||||
- ICU_LIBRARY
|
||||
- NAMES icuuc cygicuuc cygicuuc32
|
||||
- DOC "Libraries to link against for the common parts of ICU")
|
||||
-mark_as_advanced(ICU_LIBRARY)
|
||||
-
|
||||
-# Copy the results to the output variables.
|
||||
-if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
- set(ICU_FOUND 1)
|
||||
- set(ICU_LIBRARIES ${ICU_LIBRARY})
|
||||
- set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
|
||||
-
|
||||
- # Look for the ICU internationalization libraries
|
||||
- find_library(
|
||||
- ICU_I18N_LIBRARY
|
||||
- NAMES icuin icui18n cygicuin cygicuin32
|
||||
- DOC "Libraries to link against for ICU internationalization")
|
||||
- if(MSVC)
|
||||
- find_library(ICU_DATA_LIBRARY
|
||||
- NAMES icudt
|
||||
- DOC "Libraries to link against for ICU data")
|
||||
- set(ICU_LIBRARIES ${ICU_LIBRARIES} ${ICU_DATA_LIBRARY})
|
||||
- endif(MSVC)
|
||||
- mark_as_advanced(ICU_I18N_LIBRARY)
|
||||
- mark_as_advanced(ICU_DATA_LIBRARY)
|
||||
- if (ICU_I18N_LIBRARY)
|
||||
- set(ICU_I18N_FOUND 1)
|
||||
- set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
|
||||
- else (ICU_I18N_LIBRARY)
|
||||
- set(ICU_I18N_FOUND 0)
|
||||
- set(ICU_I18N_LIBRARIES)
|
||||
- endif (ICU_I18N_LIBRARY)
|
||||
-else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
- set(ICU_FOUND 0)
|
||||
- set(ICU_I18N_FOUND 0)
|
||||
- set(ICU_LIBRARIES)
|
||||
- set(ICU_I18N_LIBRARIES)
|
||||
- set(ICU_INCLUDE_DIRS)
|
||||
-endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
|
||||
-
|
||||
-IF(ICU_FOUND)
|
||||
- IF(NOT ICU_FIND_QUIETLY)
|
||||
- MESSAGE(STATUS "ICU: Yes ${ICU_I18N_LIBRARY}")
|
||||
- ENDIF(NOT ICU_FIND_QUIETLY)
|
||||
-ELSE(ICU_FOUND)
|
||||
- IF(ICU_FIND_REQUIRED)
|
||||
- MESSAGE(FATAL_ERROR "ICU: No")
|
||||
- ENDIF(ICU_FIND_REQUIRED)
|
||||
-ENDIF(ICU_FOUND)
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index 30818a8..08bc573 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -75,10 +75,12 @@ ENDFOREACH(TEST ${test_PROGRAMS})
|
||||
|
||||
########################################################################################
|
||||
# The following tests require extra libraries to run
|
||||
-#
|
||||
-FOREACH(ICUTEST icutest translittest)
|
||||
- TARGET_LINK_LIBRARIES(${ICUTEST} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
|
||||
-ENDFOREACH(ICUTEST icutest translittest)
|
||||
+#
|
||||
+IF(WITH_ICU)
|
||||
+ FOREACH(ICUTEST icutest translittest)
|
||||
+ TARGET_LINK_LIBRARIES(${ICUTEST} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
|
||||
+ ENDFOREACH(ICUTEST icutest translittest)
|
||||
+ENDIF(WITH_ICU)
|
||||
|
||||
# Excluded until I know we have the tests working
|
||||
ADD_SUBDIRECTORY(testsuite)
|
|
@ -0,0 +1,154 @@
|
|||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1d3a2d2..f627850 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -293,9 +293,10 @@ INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/install.cmake")
|
||||
# Bindings are good, right?
|
||||
#
|
||||
|
||||
-IF(NOT SWORD_BINDINGS STREQUAL "" AND SWORD_BINDINGS)
|
||||
+MESSAGE(STATUS "${SWORD_SWIG_BINDINGS}")
|
||||
+IF(SWORD_SWIG_BINDINGS)
|
||||
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/bindings")
|
||||
-ENDIF(NOT SWORD_BINDINGS STREQUAL "" AND SWORD_BINDINGS)
|
||||
+ENDIF(SWORD_SWIG_BINDINGS)
|
||||
|
||||
##############################################################################################
|
||||
# Utilities are hawt
|
||||
diff --git a/bindings/CMakeLists.txt b/bindings/CMakeLists.txt
|
||||
index 9caf6d6..729b499 100644
|
||||
--- a/bindings/CMakeLists.txt
|
||||
+++ b/bindings/CMakeLists.txt
|
||||
@@ -1,5 +1,3 @@
|
||||
-IF(SWORD_BINDINGS MATCHES ".*Python.*"
|
||||
- OR SWORD_BINDINGS MATCHES ".*Perl.*")
|
||||
+IF(SWORD_SWIG_BINDINGS)
|
||||
ADD_SUBDIRECTORY("${CMAKE_CURRENT_SOURCE_DIR}/swig")
|
||||
-ENDIF(SWORD_BINDINGS MATCHES ".*Python.*"
|
||||
- OR SWORD_BINDINGS MATCHES ".*Perl.*")
|
||||
+ENDIF(SWORD_SWIG_BINDINGS)
|
||||
diff --git a/bindings/swig/CMakeLists.txt b/bindings/swig/CMakeLists.txt
|
||||
index d2f4b16..93d55f1 100644
|
||||
--- a/bindings/swig/CMakeLists.txt
|
||||
+++ b/bindings/swig/CMakeLists.txt
|
||||
@@ -15,27 +15,33 @@ IF(NOT SWIG_FOUND)
|
||||
MESSAGE(FATAL_ERROR "Swig: no")
|
||||
ELSE(NOT SWIG_FOUND)
|
||||
MESSAGE(STATUS "Swig: yes")
|
||||
-
|
||||
+
|
||||
SET(CMAKE_SWIG_FLAGS "-w-451,-402;-shadow;-c++")
|
||||
-
|
||||
+
|
||||
MACRO(SWORD_SWIG_GENERATE LANG)
|
||||
- ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx
|
||||
+ ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx"
|
||||
COMMAND ${SWIG_EXECUTABLE} ${CMAKE_SWIG_FLAGS} -${LANG} -o "${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx"
|
||||
"-I${CMAKE_SOURCE_DIR}/bindings/swig" ${SWIG_INCLUDES} "${CMAKE_SOURCE_DIR}/bindings/swig/sword.i"
|
||||
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
ENDMACRO(SWORD_SWIG_GENERATE)
|
||||
-
|
||||
+
|
||||
GET_DIRECTORY_PROPERTY(cmake_include_directories INCLUDE_DIRECTORIES)
|
||||
SET(SWIG_INCLUDES)
|
||||
FOREACH(directory ${cmake_include_directories})
|
||||
SET(SWIG_INCLUDES ${SWIG_INCLUDES} "-I${directory}")
|
||||
ENDFOREACH(directory ${cmake_include_directories})
|
||||
-
|
||||
- IF(SWORD_BINDINGS MATCHES ".*Python.*")
|
||||
- ADD_SUBDIRECTORY(python)
|
||||
- ENDIF(SWORD_BINDINGS MATCHES ".*Python.*")
|
||||
-
|
||||
- IF(SWORD_BINDINGS MATCHES ".*Perl.*")
|
||||
+
|
||||
+ IF(SWORD_PYTHON_2)
|
||||
+ SET(SWORD_PYTHON_VERSION 2)
|
||||
+ ADD_SUBDIRECTORY(python python2)
|
||||
+ ENDIF(SWORD_PYTHON_2)
|
||||
+
|
||||
+ IF(SWORD_PYTHON_3)
|
||||
+ SET(SWORD_PYTHON_VERSION 3)
|
||||
+ ADD_SUBDIRECTORY(python python3)
|
||||
+ ENDIF(SWORD_PYTHON_3)
|
||||
+
|
||||
+ IF(SWORD_PERL)
|
||||
ADD_SUBDIRECTORY(perl)
|
||||
- ENDIF(SWORD_BINDINGS MATCHES ".*Perl.*")
|
||||
+ ENDIF(SWORD_PERL)
|
||||
ENDIF(NOT SWIG_FOUND)
|
||||
diff --git a/bindings/swig/python/CMakeLists.txt b/bindings/swig/python/CMakeLists.txt
|
||||
index bbf7561..eced324 100644
|
||||
--- a/bindings/swig/python/CMakeLists.txt
|
||||
+++ b/bindings/swig/python/CMakeLists.txt
|
||||
@@ -11,6 +11,11 @@
|
||||
#
|
||||
#SWIG_LINK_LIBRARIES(Sword ${PYTHON_LIBRARIES} ${SWORD_LINK_NAME})
|
||||
|
||||
+UNSET(PYTHON_EXECUTABLE CACHE)
|
||||
+UNSET(PYTHON_LIBS CACHE)
|
||||
+SET(PythonInterp_FIND_VERSION "${SWORD_PYTHON_VERSION}")
|
||||
+SET(PythonInterp_FIND_VERSION_MAJOR "${SWORD_PYTHON_VERSION}")
|
||||
+SET(PythonLibs_FIND_VERSION "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
|
||||
FIND_PACKAGE(PythonInterp REQUIRED)
|
||||
FIND_PACKAGE(PythonLibs)
|
||||
|
||||
@@ -38,10 +43,10 @@ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/setup.py "${PY_SCRIPT}")
|
||||
|
||||
SWORD_SWIG_GENERATE(python)
|
||||
|
||||
-ADD_CUSTOM_TARGET(swordswig ALL
|
||||
- COMMAND python setup.py build
|
||||
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx ${SWORD_LINK_NAME}
|
||||
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
+ADD_CUSTOM_TARGET(swordswig_python${SWORD_PYTHON_VERSION} ALL
|
||||
+ COMMAND "${PYTHON_EXECUTABLE}" setup.py build
|
||||
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/Sword.cxx" ${SWORD_LINK_NAME}
|
||||
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# Allow user installation to custom directory
|
||||
IF(NOT SWORD_PYTHON_INSTALL_DIR STREQUAL "")
|
||||
diff --git a/bindings/swig/python/install.cmake.in b/bindings/swig/python/install.cmake.in
|
||||
index 5dbd52e..9b7da58 100644
|
||||
--- a/bindings/swig/python/install.cmake.in
|
||||
+++ b/bindings/swig/python/install.cmake.in
|
||||
@@ -1,4 +1,4 @@
|
||||
EXECUTE_PROCESS(COMMAND
|
||||
- python setup.py install @SETUP_ARGS@
|
||||
+ "@PYTHON_EXECUTABLE@" setup.py install @SETUP_ARGS@
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
)
|
||||
diff --git a/cmake/options.cmake b/cmake/options.cmake
|
||||
index 19b7004..b20370e 100644
|
||||
--- a/cmake/options.cmake
|
||||
+++ b/cmake/options.cmake
|
||||
@@ -46,6 +46,12 @@ _SET_FANCY(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Directory to in
|
||||
|
||||
_SET_FANCY(SWORD_PYTHON_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}" STRING "Directory where the Python bindings will be installed. Defaults to default Python path.")
|
||||
|
||||
+_SET_FANCY(SWORD_PYTHON_2 FALSE STRING "Set to TRUE to build Swig Python bindings for Python 2")
|
||||
+
|
||||
+_SET_FANCY(SWORD_PYTHON_3 FALSE STRING "Set to TRUE to build Swig Python bindings for Python 3")
|
||||
+
|
||||
+_SET_FANCY(SWORD_PERL FALSE STRING "Set to TRUE to build Swig Perl bindings")
|
||||
+
|
||||
# Post-processing of variables
|
||||
MACRO(PROCESS_VERSION LEVEL VALUE)
|
||||
SET(SWORD_VERSION_${LEVEL} ${VALUE})
|
||||
@@ -74,3 +80,16 @@ SET(SWORD_VERSION_STR "${SWORD_VERSION}")
|
||||
SET(SWORD_VERSION_NUM "${SWORD_VERSION_MAJOR}${MINOR}${MICRO}${NANO}")
|
||||
|
||||
MESSAGE(STATUS "SWORD Version ${SWORD_VERSION_NUM}")
|
||||
+
|
||||
+IF(SWORD_PYTHON_2 OR SWORD_PYTHON_3 OR SWORD_PERL)
|
||||
+ MESSAGE(STATUS "Building SWIG Bindings")
|
||||
+ SET(SWORD_SWIG_BINDINGS 1)
|
||||
+ELSE()
|
||||
+ SET(SWORD_SWIG_BINDINGS 0)
|
||||
+ENDIF()
|
||||
+
|
||||
+IF(SWORD_SWIG_BINDINGS)
|
||||
+ SET(SWORD_BINDINGS TRUE)
|
||||
+ELSE()
|
||||
+ SET(SWORD_BINDINGS FALSE)
|
||||
+ENDIF()
|
30
sword.spec
30
sword.spec
|
@ -2,13 +2,16 @@
|
|||
|
||||
Name: sword
|
||||
Version: 1.8.1
|
||||
Release: 6%{?dist}
|
||||
Release: 7%{?dist}
|
||||
Summary: Free Bible Software Project
|
||||
License: GPLv2
|
||||
URL: http://www.crosswire.org/sword/
|
||||
Source0: http://www.crosswire.org/ftpmirror/pub/sword/source/v1.8/sword-%{version}.tar.gz
|
||||
Patch0: sword-1.8.1-cmake.diff
|
||||
Patch1: sword-1.8.1-icu61.diff
|
||||
Patch2: sword-1.8.1-swig.diff
|
||||
BuildRequires: cmake
|
||||
BuildRequires: cmake-data
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: curl-devel
|
||||
BuildRequires: zlib-devel
|
||||
|
@ -18,6 +21,7 @@ BuildRequires: clucene-core-devel
|
|||
BuildRequires: cppunit-devel
|
||||
BuildRequires: swig
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: gcc
|
||||
BuildRequires: gcc-c++
|
||||
|
||||
|
@ -70,15 +74,27 @@ Requires: python2
|
|||
%description -n python2-sword
|
||||
Python bindings for The SWORD Library.
|
||||
|
||||
%package -n python3-sword
|
||||
%{?python_provide:%python_provide python3-sword}
|
||||
Summary: Python bindings for Sword
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: python3
|
||||
|
||||
%description -n python3-sword
|
||||
Python bindings for The SWORD Library.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
|
||||
%build
|
||||
mkdir build
|
||||
pushd build
|
||||
%cmake -DLIBSWORD_LIBRARY_TYPE=Shared \
|
||||
-DSWORD_BINDINGS="Python" \
|
||||
-DSWORD_PYTHON_3:BOOL=TRUE \
|
||||
-DSWORD_PYTHON_2:BOOL=TRUE \
|
||||
-DSWORD_BUILD_UTILITIES="Yes" \
|
||||
-DLIBSWORD_SOVERSION=%{soversion} \
|
||||
-DLIBDIR=%{_libdir} \
|
||||
|
@ -139,7 +155,17 @@ make tests
|
|||
%{python2_sitearch}/_Sword.so
|
||||
%{python2_sitearch}/sword-%{version}-py%{python2_version}.egg-info
|
||||
|
||||
%files -n python3-sword
|
||||
%{python3_sitearch}/Sword.py
|
||||
%{python3_sitearch}/_Sword.cpython-%{python3_version_nodots}m-x86_64-linux-gnu.so
|
||||
%{python3_sitearch}/__pycache__/*
|
||||
%{python3_sitearch}/sword-%{version}-py%{python3_version}.egg-info
|
||||
|
||||
%changelog
|
||||
* Wed Jul 11 2018 Greg Hellings <greg.hellings@gmail.com> - 1.8.1-7
|
||||
- Add flags for building ICU 61+
|
||||
- Patch Python building for Python 2/3 combined
|
||||
|
||||
* Tue Jul 10 2018 Pete Walter <pwalter@fedoraproject.org> - 1.8.1-6
|
||||
- Rebuild for ICU 62
|
||||
|
||||
|
|
Loading…
Reference in New Issue