]> git.pld-linux.org Git - packages/CGAL.git/blob - CGAL.spec
- rel 1
[packages/CGAL.git] / CGAL.spec
1 %define boost_version 1.32
2 Summary:        Computational Geometry Algorithms Library
3 Name:           CGAL
4 Version:        3.3.1
5 Release:        1
6 License:        QPL and LGPLv2 and LGPLv2+
7 Group:          Libraries
8 URL:            http://www.cgal.org/
9 Source0:        ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/%{name}-%{version}.tar.gz
10 # Source0-md5:  733339b6b05b48d4c7934a6e735b6fc0
11 Patch1:         %{name}-install_cgal-SUPPORT_REQUIRED.patch
12 Patch2:         %{name}-build-library.patch
13 Patch4:         %{name}-install_cgal-no_versions_in_compiler_config.h.patch
14 BuildRequires:  blas-devel
15 BuildRequires:  boost-devel >= %{boost_version}
16 BuildRequires:  gmp-c++-devel
17 BuildRequires:  gmp-devel
18 BuildRequires:  lapack-devel
19 BuildRequires:  mpfr-devel
20 BuildRequires:  qt-devel >= 3.0
21 BuildRequires:  sed >= 4.0
22 BuildRequires:  zlib-devel
23 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
24
25 %description
26 Libraries for CGAL applications. CGAL is a collaborative effort of
27 several sites in Europe and Israel. The goal is to make the most
28 important of the solutions and methods developed in computational
29 geometry available to users in industry and academia in a C++ library.
30 The goal is to provide easy access to useful, reliable geometric
31 algorithms.
32
33 %package devel
34 Summary:        Development files and tools for CGAL applications
35 Group:          Development/Libraries
36 Requires:       %{_sysconfdir}/profile.d
37 Requires:       %{name} = %{version}-%{release}
38 Requires:       blas-devel
39 Requires:       boost-devel >= %{boost_version}
40 Requires:       gmp-c++-devel
41 Requires:       gmp-devel
42 Requires:       lapack-devel
43 Requires:       mpfr-devel
44 Requires:       qt-devel
45 Requires:       zlib-devel
46
47 %description devel
48 The %{name}-devel package provides the headers files and tools you may
49 need to develop applications using CGAL.
50
51 %package demos-source
52 Summary:        Examples and demos of CGAL algorithms
53 Group:          Documentation
54 Requires:       %{name}-devel = %{version}-%{release}
55
56 %description demos-source
57 The %{name}-demos-source package provides the sources of examples and
58 demos of CGAL algorithms.
59
60
61 %prep
62 %setup -q
63 %patch1 -p0 -b .support-required.bak
64 %patch2 -p1 -b .build-library.bak
65 %patch4 -p1 -b .no_versions.bak
66
67 chmod a-x examples/Nef_3/handling_double_coordinates.cin
68 # fix end-of-lines of several files
69 for f in demo/Straight_skeleton_2/data/vertex_event_9.poly \
70          demo/Straight_skeleton_2/data/vertex_event_0.poly \
71          examples/Surface_mesh_parameterization/data/mask_cone.off \
72          examples/Boolean_set_operations_2/test.dxf; do
73         if [ -r $f ]; then
74                 sed -i -e 's/\r//' $f
75         fi
76 done
77
78 %build
79 export QTDIR=%{_prefix}
80 ./install_cgal -ni g++ --CUSTOM_CXXFLAGS "$RPM_OPT_FLAGS" \
81                            --without-autofind \
82                            --with-ZLIB \
83                            --with-BOOST \
84                            --with-BOOST_PROGRAM_OPTIONS \
85                            --with-X11 \
86                            --with-GMP \
87                            --with-GMPXX \
88                            --with-MPFR \
89                            --with-QT3MT \
90                            --with-REFBLASSHARED \
91                            --with-DEFAULTLAPACK \
92                            --with-OPENGL \
93                            --QT_INCL_DIR=%{_includedir}/qt \
94                            --QT_LIB_DIR=%{_libdir} \
95                            --disable-static
96
97
98 %install
99 rm -rf $RPM_BUILD_ROOT
100 case "%{_arch}" in
101 *64* | s390)
102         SUFFIX=64 ;;
103 *)
104         SUFFIX=32 ;;
105 esac
106
107 # Install headers
108 install -d $RPM_BUILD_ROOT%{_includedir}
109 cp -a include/* $RPM_BUILD_ROOT%{_includedir}
110 rm -rf $RPM_BUILD_ROOT%{_includedir}/CGAL/config/msvc*
111 mv $RPM_BUILD_ROOT%{_includedir}/CGAL/config/*/CGAL/compiler_config.h $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
112
113 # remove the arch-specific comment
114 %{__sed} -i -e '/System: / d' $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
115
116 # use the timestamp of install_cgal
117 touch -r install_cgal $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
118 rm -rf $RPM_BUILD_ROOT%{_includedir}/CGAL/config
119
120 # Install scripts (only those prefixed with "cgal_").
121 install -d $RPM_BUILD_ROOT%{_bindir}
122 install -p scripts/cgal_* $RPM_BUILD_ROOT%{_bindir}
123
124 # Install libraries
125 install -d $RPM_BUILD_ROOT%{_libdir}
126 cp -a lib/*/lib* $RPM_BUILD_ROOT%{_libdir}
127
128 # Install makefile:
129 install -d $RPM_BUILD_ROOT%{_datadir}/CGAL
130 touch -r make $RPM_BUILD_ROOT%{_datadir}/CGAL
131 install -p make/makefile_* $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
132
133 # Install demos and examples
134 install -d $RPM_BUILD_ROOT%{_datadir}/CGAL/
135 touch -r demo $RPM_BUILD_ROOT%{_datadir}/CGAL/
136 cp -a demo $RPM_BUILD_ROOT%{_datadir}/CGAL/demo
137 cp -a examples $RPM_BUILD_ROOT%{_datadir}/CGAL/examples
138
139 # Modify makefile
140 cat > makefile.sed <<'EOF'
141 s,CGAL_INCL_DIR *=.*,CGAL_INCL_DIR = %{_includedir},;
142 s,CGAL_LIB_DIR *=.*,CGAL_LIB_DIR = %{_libdir},;
143 /CUSTOM_CXXFLAGS/ s/-O2 //;
144 /CUSTOM_CXXFLAGS/ s/-g //;
145 /CGAL_INCL_DIR/ s,/CGAL/config/.*,,;
146 s,/$(CGAL_OS_COMPILER),,g;
147 /-I.*CGAL_INCL_CONF_DIR/ d
148 EOF
149
150 # use -i.bak to generate cgal-${SUFFIX}.mk.bak with right timestamp
151 # used below to restore the timestamp
152 sed -i.bak -f makefile.sed $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
153
154 # check if the sed script above has worked:
155 grep -q %{_builddir} $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
156 grep -q $RPM_BUILD_ROOT $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
157 grep -q CGAL/config $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
158 grep -q -E 'CUSTOM_CXXFLAGS.*(-O2|-g )' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
159
160 # Remove -L and -R flags from the makefile
161 cat > makefile-noprefix.sed <<'EOF'
162 /'-L$(CGAL_LIB_DIR)'/ d;
163 /-R$(CGAL_LIB_DIR)/ d;
164 /'-I$(CGAL_INCL_DIR)'/ d;
165 EOF
166
167 sed -i -f makefile-noprefix.sed  $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
168
169 # restore the timestamp and remove the .bak file
170 touch -r $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk.bak $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
171 rm -f $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk.bak
172
173 # check that the sed script has worked
174 grep -q -E -- '-[LI]\$' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
175 grep -q -E -- '-R' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
176
177 # Create %{_sysconfdir}/profile.d/ scripts
178 install -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
179 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.sh <<EOF
180 ARCH=`uname -m`
181
182 case \$ARCH in
183         x86_64|ia64|s390)
184            SUFFIX=64 ;;
185         *)
186            SUFFIX=32 ;;
187 esac
188
189 if [ -z "\$CGAL_MAKEFILE" ] ; then
190         CGAL_MAKEFILE="%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
191         export CGAL_MAKEFILE
192 fi
193 EOF
194
195 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.csh <<EOF
196 set ARCH=`uname -m`
197
198 switch (\$ARCH)
199 case x86_64:
200 case ia64:
201 case s390:
202         set SUFFIX=64;
203         breaksw;
204 default:
205         set SUFFIX=62;
206 endsw
207
208 if (! \$?CGAL_MAKEFILE ) then
209         setenv CGAL_MAKEFILE "%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
210 endif
211 EOF
212
213 # use the timestamp of install_cgal
214 touch -r install_cgal $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.*sh
215
216 %clean
217 rm -rf $RPM_BUILD_ROOT
218
219 %post   -p /sbin/ldconfig
220 %postun -p /sbin/ldconfig
221
222 %files
223 %defattr(644,root,root,755)
224 %doc AUTHORS LICENSE LICENSE.FREE_USE LICENSE.LGPL LICENSE.QPL CHANGES
225 %attr(755,root,root) %{_libdir}/libCGAL*.so.*.*.*
226 %attr(755,root,root) %ghost %{_libdir}/libCGAL*.so.2
227
228 %files devel
229 %defattr(644,root,root,755)
230 %{_includedir}/CGAL
231 %{_libdir}/libCGAL*.so
232 %dir %{_datadir}/CGAL
233 %{_datadir}/CGAL/cgal*.mk
234 %attr(755,root,root) %{_bindir}/*
235 %exclude %{_bindir}/cgal_make_macosx_app
236 %config(noreplace,missingok) %verify(not md5 mtime size) %attr(755,root,root) /etc/profile.d/cgal.*
237
238 %files demos-source
239 %defattr(644,root,root,755)
240 %{_datadir}/CGAL/demo
241 %{_datadir}/CGAL/examples
242 %exclude %{_datadir}/CGAL/*/*/*.vcproj
243 %exclude %{_datadir}/CGAL/*/*/skip_vcproj_auto_generation
This page took 0.146852 seconds and 3 git commands to generate.