[normaliz] New upstream release. Package libnormaliz and jNormaliz separately.

Jerry James jjames at fedoraproject.org
Tue Jan 14 17:01:26 UTC 2014


commit 419f7b01590b9fba0f24e120f09b8f62e53a504a
Author: Jerry James <jamesjer at betterlinux.com>
Date:   Tue Jan 14 10:01:19 2014 -0700

    New upstream release.
    Package libnormaliz and jNormaliz separately.

 .gitignore           |    3 +-
 normaliz-shlib.patch |  142 +++++++++++++++++++++++++++++++++++++++++++++++
 normaliz.spec        |  151 ++++++++++++++++++++++++++++++++++++++++++--------
 sources              |    2 +-
 4 files changed, 271 insertions(+), 27 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 05810d0..767dc11 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1 @@
-/Normaliz2.2Linux64.zip
-/Normaliz2.7.zip
+/Normaliz2.10.1.zip
diff --git a/normaliz-shlib.patch b/normaliz-shlib.patch
new file mode 100644
index 0000000..e21d50c
--- /dev/null
+++ b/normaliz-shlib.patch
@@ -0,0 +1,142 @@
+--- ./source/Makefile.configuration.orig	2013-05-10 06:15:14.000000000 -0600
++++ ./source/Makefile.configuration	2013-10-22 20:00:00.000000000 -0600
+@@ -4,8 +4,8 @@
+ CXX = g++ 
+ #CXX = linux32 g++ -m32 -march=i686  #compile it for linux32
+ CXXFLAGS += -std=c++0x
+-CXXFLAGS += -Wall -pedantic
+-CXXFLAGS += -O3 -funroll-loops
++#CXXFLAGS += -Wall -pedantic
++#CXXFLAGS += -O3 -funroll-loops
+ #CXXFLAGS += -I /usr/local/boost_1_45_0
+ #CXXFLAGS += -g       ## debugging
+ #CXXFLAGS += -pg      ## profiling
+--- ./source/libnormaliz/HilbertSeries.cpp.orig	2013-04-17 05:16:06.000000000 -0600
++++ ./source/libnormaliz/HilbertSeries.cpp	2013-10-22 20:00:00.000000000 -0600
+@@ -31,6 +31,7 @@
+ namespace libnormaliz {
+ using std::cout; using std::endl; using std::flush;
+ 
++#ifndef HILBERT_NON_TEMPLATE
+ long lcm_of_keys(const map<long, denom_t>& m){
+     long l = 1;
+     map<long, denom_t>::const_iterator it;
+@@ -398,7 +399,7 @@ ostream& operator<< (ostream& out, const
+     out << " )" << std::endl;
+     return out;
+ }
+-
++#endif
+ 
+ 
+ //---------------------------------------------------------------------------
+--- ./source/libnormaliz/libnormaliz-templated.cpp.orig	2013-04-17 05:16:06.000000000 -0600
++++ ./source/libnormaliz/libnormaliz-templated.cpp	2013-10-22 20:00:00.000000000 -0600
+@@ -27,6 +27,8 @@
+ #include "full_cone.cpp"
+ #include "cone_dual_mode.cpp"
+ #include "cone.cpp"
++#define HILBERT_NON_TEMPLATE
++#include "HilbertSeries.cpp"
+ 
+ namespace libnormaliz {
+ 
+@@ -68,4 +70,47 @@ template ostream& operator<< <long>(ostr
+ template ostream& operator<< <long long>(ostream& out, const vector<long long>& v);
+ template ostream& operator<< <mpz_class>(ostream& out, const vector<mpz_class>& v);
+ 
++template void poly_add_to<long>(vector<long>& a, const vector<long>& b);
++template void poly_add_to<long long>(vector<long long>& a, const vector<long long>& b);
++template void poly_add_to<mpz_class>(vector<mpz_class>& a, const vector<mpz_class>& b);
++
++template void poly_sub_to<long>(vector<long>& a, const vector<long>& b);
++template void poly_sub_to<long long>(vector<long long>& a, const vector<long long>& b);
++template void poly_sub_to<mpz_class>(vector<mpz_class>& a, const vector<mpz_class>& b);
++
++template vector<long> poly_mult<long>(const vector<long>& a, const vector<long>& b);
++template vector<long long> poly_mult<long long>(const vector<long long>& a, const vector<long long>& b);
++template vector<mpz_class> poly_mult<mpz_class>(const vector<mpz_class>& a, const vector<mpz_class>& b);
++
++template void poly_mult_to<long>(vector<long>& a, long d, long e = 1);
++template void poly_mult_to<long long>(vector<long long>& a, long d, long e = 1);
++template void poly_mult_to<mpz_class>(vector<mpz_class>& a, long d, long e = 1);
++
++template void poly_div<long>(vector<long>& q, vector<long>& r, const vector<long>& a, const vector<long>& b);
++template void poly_div<long long>(vector<long long>& q, vector<long long>& r, const vector<long long>& a, const vector<long long>& b);
++template void poly_div<mpz_class>(vector<mpz_class>& q, vector<mpz_class>& r, const vector<mpz_class>& a, const vector<mpz_class>& b);
++
++template void remove_zeros<long>(vector<long>& a);
++template void remove_zeros<long long>(vector<long long>& a);
++template void remove_zeros<mpz_class>(vector<mpz_class>& a);
++
++template vector<long> cyclotomicPoly<long>(long n);
++template vector<long long> cyclotomicPoly<long long>(long n);
++template vector<mpz_class> cyclotomicPoly<mpz_class>(long n);
++
++template vector<long> coeff_vector<long>(size_t i);
++template vector<long long> coeff_vector<long long>(size_t i);
++template vector<mpz_class> coeff_vector<mpz_class>(size_t i);
++
++template void linear_substitution<long>(vector<long>& poly, const long& a);
++template void linear_substitution<long long>(vector<long long>& poly, const long long& a);
++template void linear_substitution<mpz_class>(vector<mpz_class>& poly, const mpz_class& a);
++
++template vector<long> compute_e_vector<long>(vector<long> h_vector, int dim);
++template vector<long long> compute_e_vector<long long>(vector<long long> h_vector, int dim);
++template vector<mpz_class> compute_e_vector<mpz_class>(vector<mpz_class> h_vector, int dim);
++
++template vector<long> compute_polynomial<long>(vector<long> h_vector, int dim);
++template vector<long long> compute_polynomial<long long>(vector<long long> h_vector, int dim);
++template vector<mpz_class> compute_polynomial<mpz_class>(vector<mpz_class> h_vector, int dim);
+ }
+--- ./source/libnormaliz/Makefile.orig	2013-03-21 09:30:36.000000000 -0600
++++ ./source/libnormaliz/Makefile	2013-10-22 20:00:00.000000000 -0600
+@@ -5,8 +5,9 @@ include ../Makefile.configuration
+ 
+ LIBSOURCES = $(wildcard *.cpp)
+ LIBHEADERS = $(wildcard *.h)
++CXXFLAGS += -fPIC
+ 
+-default: libnormaliz.a
++default: libnormaliz.so
+ 
+ all: default
+ 
+@@ -25,8 +26,14 @@ libnormaliz-templated.o: $(LIBHEADERS) $
+ libnormaliz.a: cone_property.o hilbert_series.o libnormaliz-templated.o
+ 	ar -cr $@ $^
+ 
++libnormaliz.so: cone_property.o hilbert_series.o libnormaliz-templated.o
++	$(CXX) $(CXXFLAGS) $(NORMFLAGS) -shared -o libnormaliz.so.$(VERSION) \
++	-Wl,-h,libnormaliz.so.$(VERSION) $^ -lgmpxx -lgmp
++	ln -s libnormaliz.so.$(VERSION) libnormaliz.so.$(MAJOR)
++	ln -s libnormaliz.so.$(MAJOR) $@
++
+ clean:
+ 	-rm -f *.o
+-	-rm -f libnormaliz.a
++	-rm -f libnormaliz.a libnormaliz.so*
+ 
+ .PHONY : default clean all
+--- ./source/Makefile.orig	2013-03-28 09:13:56.000000000 -0600
++++ ./source/Makefile	2013-10-22 20:00:00.000000000 -0600
+@@ -16,8 +16,8 @@ all: lib normaliz normaliz1
+ linknormaliz: lib
+ 	@$(MAKE) normaliz
+ 
+-normaliz: $(SOURCES) $(HEADERS) libnormaliz/libnormaliz.a
+-	$(CXX) $(CXXFLAGS) $(NORMFLAGS) Normaliz.cpp libnormaliz/libnormaliz.a $(GMPFLAGS) -o normaliz
++normaliz: $(SOURCES) $(HEADERS) libnormaliz/libnormaliz.so
++	$(CXX) $(CXXFLAGS) $(NORMFLAGS) Normaliz.cpp -L libnormaliz -lnormaliz $(GMPFLAGS) -o normaliz
+ 
+ normaliz1: $(SOURCES) $(HEADERS) $(LIBHEADERS) $(LIBSOURCES)
+ 	$(CXX) $(CXXFLAGS) $(NORMFLAGS) Normaliz-impl.cpp $(GMPFLAGS) -o normaliz1
+@@ -29,7 +29,7 @@ normaliz-pg: $(SOURCES) $(HEADERS) $(LIB
+ #always go down the directory and let the make there check what has to be done
+ .PHONY : lib
+ lib:
+-	$(MAKE) --directory=libnormaliz libnormaliz.a
++	$(MAKE) --directory=libnormaliz libnormaliz.so
+ 
+ 
+ .PHONY : clean
diff --git a/normaliz.spec b/normaliz.spec
index e396d3f..be82724 100644
--- a/normaliz.spec
+++ b/normaliz.spec
@@ -1,39 +1,110 @@
 Name:           normaliz
-Version:        2.7
-Release:        8%{?dist}
+Version:        2.10.1
+Release:        1%{?dist}
 Summary:        A tool for mathematical computations
 
-Group:          Applications/Engineering
-License:        GPLv3
+License:        GPLv3+
 URL:            http://www.mathematik.uni-osnabrueck.de/normaliz/
 # Warning: This zip-ball contains .jar binaries, source only zip-ball not
 # available
 Source0:        http://www.mathematik.uni-osnabrueck.de/normaliz/Normaliz%{version}/Normaliz%{version}.zip
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
+# Change the Makefiles to use our build flags, build libnormaliz as a shared
+# library, and link the normaliz binary with the shared library
+Patch0:         %{name}-shlib.patch
+
+BuildRequires:  ant
+BuildRequires:  apache-commons-exec
+BuildRequires:  apache-commons-exec-javadoc
+BuildRequires:  appframework
 BuildRequires:  boost-devel
 BuildRequires:  gmp-devel
+BuildRequires:  java-devel >= 1:1.6.0
+BuildRequires:  javasysmon
+BuildRequires:  jpackage-utils
+
+Requires:       lib%{name}%{?_isa} = %{version}-%{release}
+
+%global nopatchver %(cut -d. -f1-2 <<< %{version})
 
 %description
-Normaliz is a (command line) tool for computations in affine
-monoids, vector configurations, lattice polytopes,  and rational
-cones.
+Normaliz is a tool for computations in affine monoids, vector
+configurations, lattice polytopes, and rational cones.
 
 Documentation and examples can be found in %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}},
 in particular you may find Normaliz%{version}Documentation.pdf useful.  
 
+%package -n libnormaliz
+Summary:        Normaliz internals as a library
+
+%description -n libnormaliz
+This package contains the normaliz internals as a library, often called
+libnormaliz.
+
+%package -n libnormaliz-devel
+Summary:        Developer files for libnormaliz
+Requires:       %{name}-libs%{?_isa} = %{version}-%{release}
+
+%description -n libnormaliz-devel
+Header files and library links to develop applications that use the
+Normaliz internals as a library (libnormaliz).
+
+%package -n jnormaliz
+Summary:        Graphical interface for Normaliz
+Requires:       %{name} = %{version}-%{release}
+Requires:       apache-commons-exec
+Requires:       appframework
+Requires:       java >= 1:1.6.0
+Requires:       javasysmon
+Requires:       jpackage-utils
+BuildArch:      noarch
+
+%description -n jnormaliz
+JNormaliz is a graphic interface for Normaliz, written in Java.
+
+%package -n jnormaliz-javadoc
+Summary:        Javadoc documentation for jNormaliz
+Requires:       jnormaliz = %{version}-%{release}
+Requires:       apache-commons-exec-javadoc
+Requires:       jpackage-utils
+BuildArch:      noarch
+
+%description -n jnormaliz-javadoc
+Javadoc documentation for jNormaliz
+
 %prep
-%setup -q -n Normaliz%{version}
+%setup -q -n Normaliz%{nopatchver}
+%patch0
+
+# Remove prebuilt class files, jars, and javadocs, except for one netbeans jar
+# used for building only (no runtime dependencies).
+find . -name \*.jar -a \! -name \*copylibstask.jar | xargs rm -f
+rm -fr source/jNormaliz/build
+
+# Use system jars instead of bundled jars
+ln -s %{_javadir}/appframework.jar lib/appframework-1.0.3.jar
+ln -s %{_javadir}/commons-exec.jar lib/commons-exec-1.0.1.jar
+ln -s %{_javadir}/javasysmon.jar lib/javasysmon.jar
+
+cd source/jNormaliz/lib
+ln -s %{_javadir}/commons-exec.jar commons-exec-1.0.1/commons-exec-1.0.1.jar
+ln -s %{_javadocdir}/apache-commons-exec commons-exec-1.0.1/apidocs
+ln -s %{_javadir}/javasysmon.jar javasysmon.jar
+ln -s %{_javadir}/junit.jar junit_4/junit-4.5.jar
+ln -s %{_javadir}/appframework.jar swing-app-framework/appframework-1.0.3.jar
 
 %build
+# Build the C library and the binaries
 pushd source
-# We want to use our build flags
-sed -i 's/^\(CXXFLAGS\s*=\)/#\1/' Makefile
-# Static linking should be avoided
-sed -i 's/^\(N[A-Z0-9]*FLAGS\s*=.*\s\)-static/\1/' Makefile Makefile.configuration
-
-CXXFLAGS="%{optflags}" \
+export CXXFLAGS="%{optflags}"
+export NORMFLAGS="-Wl,--as-needed $RPM_LD_FLAGS"
+export VERSION="%{nopatchver}"
+export MAJOR="%(cut -d. -f1 <<< %{version})"
 make %{?_smp_mflags}
+
+# Build the Java interface and documentation
+cd jNormaliz
+ant jar
+ant javadoc
 popd
 
 mkdir -p docs/example
@@ -47,26 +118,58 @@ do
 done
 popd
 
-mv doc/Normaliz%{version}Documentation.pdf docs
+mv doc/Normaliz%{nopatchver}Documentation.pdf docs
 mv "doc/Computing the integral closure of an affine semigroup.pdf" \
     docs/Computing_the_integral_closure_of_an_affine_semigroup.pdf
 
-
 %install
-rm -rf %{buildroot}
-
+# Install the binary
 install -D -m 755 source/normaliz %{buildroot}%{_bindir}/normaliz
 
-%clean
-rm -rf %{buildroot}
+# Install the library
+mkdir -p %{buildroot}%{_libdir}
+cp -a source/libnormaliz/libnormaliz.so* %{buildroot}%{_libdir}
+
+# Install the headers
+mkdir -p %{buildroot}%{_includedir}/libnormaliz
+cp -p source/libnormaliz/*.h %{buildroot}%{_includedir}/libnormaliz
+
+# Install the jar
+mkdir -p %{buildroot}%{_javadir}
+cp -p source/jNormaliz/dist/jNormaliz.jar %{buildroot}%{_javadir}
+
+# Install the javadoc
+mkdir -p %{buildroot}%{_javadocdir}
+cp -a source/jNormaliz/dist/javadoc %{buildroot}%{_javadocdir}/jnormaliz
+
+%post -n libnormaliz -p /sbin/ldconfig
+
+%postun -n libnormaliz -p /sbin/ldconfig
 
 %files
-%defattr(-,root,root,-)
-%doc COPYING
+%doc source/COPYING
 %doc docs/*
 %{_bindir}/normaliz
 
+%files -n libnormaliz
+%{_libdir}/libnormaliz.so.*
+
+%files -n libnormaliz-devel
+%doc source/libnormaliz/README
+%{_libdir}/libnormaliz.so
+%{_includedir}/libnormaliz/
+
+%files -n jnormaliz
+%{_javadir}/jNormaliz.jar
+
+%files -n jnormaliz-javadoc
+%{_javadocdir}/jnormaliz
+
 %changelog
+* Tue Jan 14 2014 Jerry James <loganjerry at gmail.com> - 2.10.1-1
+- New upstream release
+- Package libnormaliz and jNormaliz separately
+
 * Wed Aug 21 2013 Ville Skyttä <ville.skytta at iki.fi> - 2.7-8
 - Adjust for unversioned %%{_docdir_fmt} (#994006).
 
diff --git a/sources b/sources
index 202f033..07ffddf 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-2ed0c6ce3d4d5ebdd43f750260e19b39  Normaliz2.7.zip
+639f08130e03c8bf489bd11513b2aaf3  Normaliz2.10.1.zip


More information about the scm-commits mailing list