[packages/vislcg3] - updated to 1.3.0 - added static patch (don't use -flto for static library, breaks linking) - added

qboosh qboosh at pld-linux.org
Thu Oct 17 20:42:47 CEST 2019


commit 83e4822d3d7e948e4afb1bd0fdfa618d22d909e5
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Oct 17 20:46:14 2019 +0200

    - updated to 1.3.0
    - added static patch (don't use -flto for static library, breaks linking)
    - added python3 binding (python3-constraint_grammar package)

 vislcg3-static.patch | 15 +++++++++++++
 vislcg3.spec         | 61 ++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 69 insertions(+), 7 deletions(-)
---
diff --git a/vislcg3.spec b/vislcg3.spec
index 5a961db..80f1c6b 100644
--- a/vislcg3.spec
+++ b/vislcg3.spec
@@ -1,25 +1,31 @@
 #
 # Conditional build:
+%bcond_without	python		# Python(3) binding
 %bcond_without	static_libs	# static library
 
 Summary:	VISL CG-3 constraint grammar system
 Summary(pl.UTF-8):	VISL CG-3 - system ograniczonej gramatyki
 Name:		vislcg3
-Version:	1.1.7
-Release:	3
+Version:	1.3.0
+Release:	1
 License:	GPL v3+
 Group:		Applications/Text
 #Source0Download: https://github.com/TinoDidriksen/cg3/releases
 Source0:	https://github.com/TinoDidriksen/cg3/archive/v%{version}/cg3-%{version}.tar.gz
-# Source0-md5:	85e74c3e7fb5f5a13b7ab1690ffef910
+# Source0-md5:	e71a3c5d486832a5a6fad0ddc8651bac
+Patch0:		%{name}-static.patch
 URL:		http://beta.visl.sdu.dk/cg3.html
-BuildRequires:	cmake >= 2.8.9
+BuildRequires:	cmake >= 3.0
 BuildRequires:	boost-devel >= 1.63.0-4
 BuildRequires:	libicu-devel >= 50.0
 # -std=c++14
 BuildRequires:	libstdc++-devel >= 6:5.0
-BuildRequires:	rpmbuild(macros) >= 1.605
+BuildRequires:	rpmbuild(macros) >= 1.714
 BuildRequires:	sed >= 4.0
+%if %{with python}
+BuildRequires:	python3-devel >= 1:3.5
+BuildRequires:	swig-python >= 3.0
+%endif
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -52,6 +58,19 @@ Static VISL CG-3 library.
 %description static -l pl.UTF-8
 Statyczna biblioteka VISL CG-3.
 
+%package -n python3-constraint_grammar
+Summary:	Python 3 bindings for CG-3 library
+Summary(pl.UTF-8):	Wiązania Pythona 3 do biblioteki CG-3
+Group:		Libraries/Python
+Requires:	%{name} = %{version}-%{release}
+Requires:	python3-libs >= 1:3.5
+
+%description -n python3-constraint_grammar
+Python 3 bindings for CG-3 library.
+
+%description -n python3-constraint_grammar -l pl.UTF-8
+Wiązania Pythona 3 do biblioteki CG-3.
+
 %package -n emacs-cg-mode
 Summary:	CG-3 mode for Emacs
 Summary(pl.UTF-8):	Tryb CG-3 dla Emacsa
@@ -69,6 +88,7 @@ Tryb CG-3 dla Emacsa.
 
 %prep
 %setup -q -n cg3-%{version}
+%patch0 -p1
 
 # not executable
 %{__sed} -i -e '1s,.*/usr/bin/env perl,,' scripts/CG3_External.pm
@@ -76,12 +96,25 @@ Tryb CG-3 dla Emacsa.
 %{__sed} -i -e '1s,/usr/bin/env perl,%{__perl},' scripts/{cg-sort,cg-strictify,cg-untrace,cg3-autobin.pl.in}
 
 %build
+# it expectls only relative CMAKE_INSTALL_LIBDIR
+%if %{with static_libs}
+install -d build-static
+cd build-static
+%cmake .. \
+	-DBUILD_SHARED_LIBS=OFF \
+	-DCMAKE_INSTALL_LIBDIR=%{_lib} \
+	-DUSE_TCMALLOC=OFF
+
+%{__make}
+cd ..
+%endif
+
 install -d build
 cd build
-# it expectls only relative CMAKE_INSTALL_LIBDIR
 %cmake .. \
 	-DCMAKE_INSTALL_LIBDIR=%{_lib} \
-	%{?with_static_libs:-DINSTALL_STATIC=ON} \
+	%{?with_python:-DENABLE_PYTHON_BINDINGS=ON} \
+	-DPYTHON_INSTALL_PARAMS="--prefix=%{_prefix} --root=$RPM_BUILD_ROOT --optimize=2" \
 	-DUSE_TCMALLOC=OFF
 
 %{__make}
@@ -89,6 +122,11 @@ cd build
 %install
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with static_libs}
+%{__make} -C build-static/src install \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
+
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
@@ -130,6 +168,15 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libcg3.a
 %endif
 
+%if %{with python}
+%files -n python3-constraint_grammar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{py3_sitedir}/_constraint_grammar.cpython-*.so
+%{py3_sitedir}/constraint_grammar.py
+%{py3_sitedir}/__pycache__/constraint_grammar.cpython-*.py[co]
+%{py3_sitedir}/constraint_grammar-%{version}.*-py*.egg-info
+%endif
+
 %files -n emacs-cg-mode
 %defattr(644,root,root,755)
 %{_datadir}/emacs/site-lisp/cg.el
diff --git a/vislcg3-static.patch b/vislcg3-static.patch
new file mode 100644
index 0000000..164459e
--- /dev/null
+++ b/vislcg3-static.patch
@@ -0,0 +1,15 @@
+--- cg3-1.3.0/CMakeLists.txt.orig	2019-09-29 21:20:05.000000000 +0200
++++ cg3-1.3.0/CMakeLists.txt	2019-10-17 20:06:34.647892619 +0200
+@@ -50,7 +50,11 @@
+ 	include(CheckCCompilerFlag)
+ 	include(CheckCXXCompilerFlag)
+ 
+-	foreach(flag "-Wno-unused-result" "-flto")
++	set(flags_to_check "-Wno-unused-result")
++	if(BUILD_SHARED_LIBS)
++            set(flags_to_check "${flags_to_check} -flto")
++	endif()
++	foreach(flag ${flags_to_check})
+ 		string(REGEX REPLACE "[^A-Za-z0-9]" "-" _flag ${flag})
+ 		CHECK_CXX_COMPILER_FLAG(${flag} COMPILER_SUPPORTS_${_flag})
+ 		if(COMPILER_SUPPORTS_${_flag})
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vislcg3.git/commitdiff/83e4822d3d7e948e4afb1bd0fdfa618d22d909e5



More information about the pld-cvs-commit mailing list