Upload Tizen:Base source
[external/gmp.git] / packaging / gmp.spec
1 #
2 # Important for %{ix86}:
3 # This rpm has to be build on a CPU with sse2 support like Pentium 4 !
4 #
5
6 Name: gmp
7 Summary: A GNU arbitrary precision library
8 Version: 5.0.1
9 Release: 1
10 URL: http://gmplib.org/
11 Source0: ftp://ftp.gnu.org/pub/gnu/gmp/gmp-%{version}.tar.bz2
12 Source2: gmp.h
13 Source3: gmp-mparam.h
14 License: GPLv3+ and LGPLv3
15 Group: System/Libraries
16 BuildRequires: autoconf
17 BuildRequires: automake
18 BuildRequires: libtool
19
20 %description
21 The gmp package contains GNU MP, a library for arbitrary precision
22 arithmetic, signed integers operations, rational numbers and floating
23 point numbers. GNU MP is designed for speed, for both small and very
24 large operands. GNU MP is fast because it uses fullwords as the basic
25 arithmetic type, it uses fast algorithms, it carefully optimizes
26 assembly code for many CPUs' most common inner loops, and it generally
27 emphasizes speed over simplicity/elegance in its operations.
28
29 Install the gmp package if you need a fast arbitrary precision
30 library.
31
32 %package devel
33 Summary: Development tools for the GNU MP arbitrary precision library
34 Group: Development/Libraries
35 Requires: %{name} = %{version}-%{release}
36
37 %description devel
38 The libraries, header files and documentation for using the GNU MP 
39 arbitrary precision library in applications.
40
41 If you want to develop applications which will use the GNU MP library,
42 you'll need to install the gmp-devel package.  You'll also need to
43 install the gmp package.
44
45 %package static
46 Summary: Development tools for the GNU MP arbitrary precision library
47 Group: Development/Libraries
48 Requires: %{name}-devel = %{version}-%{release}
49
50 %description static
51 The static libraries for using the GNU MP arbitrary precision library 
52 in applications.
53
54 %prep
55 %setup -q 
56
57 %build
58 autoreconf -if
59 if as --help | grep -q execstack; then
60   # the object files do not require an executable stack
61   export CCAS="gcc -c -Wa,--noexecstack"
62 fi
63 mkdir base
64 cd base
65 ln -s ../configure .
66 ./configure --build=%{_build} --host=%{_host} \
67          --program-prefix=%{?_program_prefix} \
68          --prefix=%{_prefix} \
69          --exec-prefix=%{_exec_prefix} \
70          --bindir=%{_bindir} \
71          --sbindir=%{_sbindir} \
72          --sysconfdir=%{_sysconfdir} \
73          --datadir=%{_datadir} \
74          --includedir=%{_includedir} \
75          --libdir=%{_libdir} \
76          --libexecdir=%{_libexecdir} \
77          --localstatedir=%{_localstatedir} \
78          --sharedstatedir=%{_sharedstatedir} \
79          --mandir=%{_mandir} \
80          --infodir=%{_infodir} \
81          --enable-mpbsd --enable-cxx
82 perl -pi -e 's|hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"-L\\\$libdir\"|g;' libtool
83 export LD_LIBRARY_PATH=`pwd`/.libs
84 make CFLAGS="$RPM_OPT_FLAGS" %{?_smp_mflags}
85 cd ..
86 %ifarch %{ix86}
87 mkdir build-sse2
88 cd build-sse2
89 ln -s ../configure .
90 CFLAGS="%{optflags} -march=pentium4"
91 ./configure --build=%{_build} --host=%{_host} \
92          --program-prefix=%{?_program_prefix} \
93          --prefix=%{_prefix} \
94          --exec-prefix=%{_exec_prefix} \
95          --bindir=%{_bindir} \
96          --sbindir=%{_sbindir} \
97          --sysconfdir=%{_sysconfdir} \
98          --datadir=%{_datadir} \
99          --includedir=%{_includedir} \
100          --libdir=%{_libdir} \
101          --libexecdir=%{_libexecdir} \
102          --localstatedir=%{_localstatedir} \
103          --sharedstatedir=%{_sharedstatedir} \
104          --mandir=%{_mandir} \
105          --infodir=%{_infodir} \
106          --enable-mpbsd --enable-cxx
107 perl -pi -e 's|hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=\"-L\\\$libdir\"|g;' libtool
108 export LD_LIBRARY_PATH=`pwd`/.libs
109 make %{?_smp_mflags}
110 unset CFLAGS
111 cd ..
112 %endif
113
114 %install
115 rm -rf $RPM_BUILD_ROOT
116 cd base
117 export LD_LIBRARY_PATH=`pwd`/.libs
118 make install DESTDIR=$RPM_BUILD_ROOT
119 install -m 644 gmp-mparam.h ${RPM_BUILD_ROOT}%{_includedir}
120 rm -f $RPM_BUILD_ROOT%{_libdir}/lib{gmp,mp,gmpxx}.la
121 rm -f $RPM_BUILD_ROOT%{_infodir}/dir
122 /sbin/ldconfig -n $RPM_BUILD_ROOT%{_libdir}
123 ln -sf libgmpxx.so.4 $RPM_BUILD_ROOT%{_libdir}/libgmpxx.so
124 cd ..
125 %ifarch %{ix86}
126 cd build-sse2
127 export LD_LIBRARY_PATH=`pwd`/.libs
128 mkdir $RPM_BUILD_ROOT%{_libdir}/sse2
129 install -m 755 .libs/libgmp.so.10.* $RPM_BUILD_ROOT%{_libdir}/sse2
130 cp -a .libs/libgmp.so.10 $RPM_BUILD_ROOT%{_libdir}/sse2
131 chmod 755 $RPM_BUILD_ROOT%{_libdir}/sse2/libgmp.so.10
132 install -m 755 .libs/libgmpxx.so.4.* $RPM_BUILD_ROOT%{_libdir}/sse2
133 cp -a .libs/libgmpxx.so.4 $RPM_BUILD_ROOT%{_libdir}/sse2
134 chmod 755 $RPM_BUILD_ROOT%{_libdir}/sse2/libgmpxx.so.4
135 install -m 755 .libs/libmp.so.3.* $RPM_BUILD_ROOT%{_libdir}/sse2
136 cp -a .libs/libmp.so.3 $RPM_BUILD_ROOT%{_libdir}/sse2
137 chmod 755 $RPM_BUILD_ROOT%{_libdir}/sse2/libmp.so.3
138 cd ..
139 %endif
140
141 # Rename gmp.h to gmp-<arch>.h and gmp-mparam.h to gmp-mparam-<arch>.h to 
142 # avoid file conflicts on multilib systems and install wrapper include files
143 # gmp.h and gmp-mparam-<arch>.h
144 basearch=%{_arch}
145 # always use i386 for iX86
146 %ifarch %{ix86}
147 basearch=i386
148 %endif
149 # always use arm for arm*
150 %ifarch %{arm}
151 basearch=arm
152 %endif
153 # superH architecture support
154 %ifarch sh3 sh4
155 basearch=sh
156 %endif
157 # Rename files and install wrappers
158
159 mv %{buildroot}/%{_includedir}/gmp.h %{buildroot}/%{_includedir}/gmp-${basearch}.h
160 install -m644 %{SOURCE2} %{buildroot}/%{_includedir}/gmp.h
161 mv %{buildroot}/%{_includedir}/gmp-mparam.h %{buildroot}/%{_includedir}/gmp-mparam-${basearch}.h
162 install -m644 %{SOURCE3} %{buildroot}/%{_includedir}/gmp-mparam.h
163
164
165 %check
166 cd base
167 export LD_LIBRARY_PATH=`pwd`/.libs
168 make %{?_smp_mflags} check
169 cd ..
170 %ifarch %{ix86}
171 cd build-sse2
172 export LD_LIBRARY_PATH=`pwd`/.libs
173 make %{?_smp_mflags} check
174 cd ..
175 %endif
176
177
178 %remove_docs
179
180 %post -p /sbin/ldconfig
181
182 %postun -p /sbin/ldconfig
183
184
185 %clean
186 rm -rf $RPM_BUILD_ROOT
187
188 %files
189 %defattr(-,root,root,-)
190 %{_libdir}/libgmp.so.*
191 %{_libdir}/libmp.so.*
192 %{_libdir}/libgmpxx.so.*
193 %ifarch %{ix86}
194 %{_libdir}/sse2/*
195 %endif
196
197 %files devel
198 %defattr(-,root,root,-)
199 %{_libdir}/libmp.so
200 %{_libdir}/libgmp.so
201 %{_libdir}/libgmpxx.so
202 %{_includedir}/*.h
203
204 %files static
205 %defattr(-,root,root,-)
206 %{_libdir}/libmp.a
207 %{_libdir}/libgmp.a
208 %{_libdir}/libgmpxx.a
209
210