commit 06a91b8b8a2255aa332c836fa25e540da935e121
Author: Jan Rękorajski <bagg...@pld-linux.org>
Date:   Sat Jul 1 19:38:24 2017 +0200

    - added ocaml_opt bcond

 ocaml-facile.spec | 34 +++++++++++++++++++++++++++++++---
 opt.patch         | 10 ++++++++++
 2 files changed, 41 insertions(+), 3 deletions(-)
---
diff --git a/ocaml-facile.spec b/ocaml-facile.spec
index a70335e..f6876b0 100644
--- a/ocaml-facile.spec
+++ b/ocaml-facile.spec
@@ -1,3 +1,12 @@
+#
+# Conditional build:
+%bcond_without ocaml_opt       # skip building native optimized binaries 
(bytecode is always built)
+
+# not yet available on x32 (ocaml 4.02.1), update when upstream will support it
+%ifnarch %{ix86} %{x8664} arm aarch64 ppc sparc sparcv9
+%undefine      with_ocaml_opt
+%endif
+
 Summary:       Functional Constraint Library implemented in Objective Caml
 Name:          ocaml-facile
 Version:       1.1.3
@@ -6,11 +15,19 @@ License:     LGPL
 Group:         Libraries
 Source0:       
http://opti.recherche.enac.fr/facile/distrib/facile-%{version}.tar.gz
 # Source0-md5: 172c4fbea636a8fa575b988390639d8d
+Patch0:                opt.patch
 URL:           http://www.recherche.enac.fr/opti/facile/
 BuildRequires: ocaml >= 3.02
 %requires_eq   ocaml-runtime
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
+%define                debug_package   %{nil}
+%if %{without ocaml_opt}
+%define                no_install_post_strip   1
+# no opt means no native binary, stripping bytecode breaks such programs
+%define                _enable_debug_packages  0
+%endif
+
 %description
 FaCiLe is a constraint programming library on integer and integer set
 finite domains written in OCaml. It offers all usual facilities to
@@ -32,17 +49,23 @@ and foreword of the online documentation
 
 %prep
 %setup -q -n facile-%{version}
+%patch0 -p1
 
 %build
 # use ./configure because of 'Unknown option "LDFLAGS=-Wl,--as-needed 
-Wl,-z,relro -Wl,-z,-combreloc "
 ./configure
 
-%{__make}
+%{__make} -C src all %{?with_ocaml_opt:opt} \
+       CC="%{__cc} %{rpmcflags} -fPIC"
 
 %install
 rm -rf $RPM_BUILD_ROOT
 install -d $RPM_BUILD_ROOT%{_libdir}/ocaml/facile
-install src/facile.cmi src/facile.cma src/facile.cmxa src/facile.a 
$RPM_BUILD_ROOT%{_libdir}/ocaml/facile
+
+install src/facile.cmi src/facile.cma $RPM_BUILD_ROOT%{_libdir}/ocaml/facile
+%if %{with ocaml_opt}
+install src/facile.cmxa src/facile.a $RPM_BUILD_ROOT%{_libdir}/ocaml/facile
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -51,4 +74,9 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc LICENSE README
 %dir %{_libdir}/ocaml/facile
-%{_libdir}/ocaml/facile/*
+%{_libdir}/ocaml/facile/*.cma
+%{_libdir}/ocaml/facile/*.cmi
+%if %{with ocaml_opt}
+%{_libdir}/ocaml/facile/*.a
+%{_libdir}/ocaml/facile/*.cmxa
+%endif
diff --git a/opt.patch b/opt.patch
new file mode 100644
index 0000000..2cc7a98
--- /dev/null
+++ b/opt.patch
@@ -0,0 +1,10 @@
+--- facile-1.1.3/src/Makefile~ 2016-12-15 17:10:07.000000000 +0100
++++ facile-1.1.3/src/Makefile  2017-07-01 19:37:40.399941508 +0200
+@@ -17,6 +17,7 @@
+ 
+ # Default target: libraries and toplevel
+ all : facile.cma facile.cmxa facile
++opt : facile.cmxa
+ 
+ # Libraries
+ facile.cma : $(CSTRCMO)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ocaml-facile.git/commitdiff/06a91b8b8a2255aa332c836fa25e540da935e121

_______________________________________________
pld-cvs-commit mailing list
pld-cvs-commit@lists.pld-linux.org
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to