1 %define boost_version 1.32
3 Summary: Computational Geometry Algorithms Library
7 License: QPL and LGPLv2 and LGPLv2+
9 URL: http://www.cgal.org/
10 Source0: ftp://ftp.mpi-sb.mpg.de/pub/outgoing/CGAL/%{name}-%{version}.tar.gz
11 # Source0-md5: 733339b6b05b48d4c7934a6e735b6fc0
12 Patch1: %{name}-install_cgal-SUPPORT_REQUIRED.patch
13 Patch2: %{name}-build-library.patch
14 Patch4: %{name}-install_cgal-no_versions_in_compiler_config.h.patch
15 BuildRequires: blas-devel
16 BuildRequires: lapack-devel
17 BuildRequires: boost-devel >= %boost_version
18 BuildRequires: gmp-devel
19 BuildRequires: qt-devel >= 3.0
20 BuildRequires: zlib-devel
21 BuildRequires: mpfr-devel
22 BuildRequires: gmp-c++-devel
23 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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
35 Summary: Development files and tools for CGAL applications
36 Group: Development/Libraries
37 Requires: %{_sysconfdir}/profile.d
38 Requires: %{name} = %{version}-%{release}
40 Requires: lapack-devel
44 Requires: boost-devel >= %{boost_version}
46 Requires: gmp-c++-devel
48 The %{name}-devel package provides the headers files and tools you may
49 need to develop applications using CGAL.
53 Summary: Examples and demos of CGAL algorithms
55 Requires: %{name}-devel = %{version}-%{release}
57 %description demos-source
58 The %{name}-demos-source package provides the sources of examples and
59 demos of CGAL algorithms.
64 %patch1 -p0 -b .support-required.bak
65 %patch2 -p1 -b .build-library.bak
66 %patch4 -p1 -b .no_versions.bak
68 chmod a-x examples/Nef_3/handling_double_coordinates.cin
69 # fix end-of-lines of several files
70 for f in demo/Straight_skeleton_2/data/vertex_event_9.poly \
71 demo/Straight_skeleton_2/data/vertex_event_0.poly \
72 examples/Surface_mesh_parameterization/data/mask_cone.off \
73 examples/Boolean_set_operations_2/test.dxf;
76 sed -i.bak 's/\r//' $f;
83 export QTDIR=%{_prefix}
84 ./install_cgal -ni g++ --CUSTOM_CXXFLAGS "$RPM_OPT_FLAGS" \
88 --with-BOOST_PROGRAM_OPTIONS \
94 --with-REFBLASSHARED \
95 --with-DEFAULTLAPACK \
97 --QT_INCL_DIR=%{_includedir}/qt \
98 --QT_LIB_DIR=%{_libdir} \
103 rm -rf $RPM_BUILD_ROOT
113 install -d $RPM_BUILD_ROOT%{_includedir}
114 cp -a include/* $RPM_BUILD_ROOT%{_includedir}
115 rm -rf $RPM_BUILD_ROOT%{_includedir}/CGAL/config/msvc*
116 mv $RPM_BUILD_ROOT%{_includedir}/CGAL/config/*/CGAL/compiler_config.h $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
119 # remove the arch-specific comment
120 sed -i -e '/System: / d' $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
122 # use the timestamp of install_cgal
123 touch -r install_cgal $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
124 rm -rf $RPM_BUILD_ROOT%{_includedir}/CGAL/config
126 # Install scripts (only those prefixed with "cgal_").
127 install -d $RPM_BUILD_ROOT%{_bindir}
128 install -p scripts/cgal_* $RPM_BUILD_ROOT%{_bindir}
131 install -d $RPM_BUILD_ROOT%{_libdir}
132 cp -a lib/*/lib* $RPM_BUILD_ROOT%{_libdir}
135 install -d $RPM_BUILD_ROOT%{_datadir}/CGAL
136 touch -r make $RPM_BUILD_ROOT%{_datadir}/CGAL
137 install -p make/makefile_* $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
139 # Install demos and examples
140 install -d $RPM_BUILD_ROOT%{_datadir}/CGAL/
141 touch -r demo $RPM_BUILD_ROOT%{_datadir}/CGAL/
142 cp -a demo $RPM_BUILD_ROOT%{_datadir}/CGAL/demo
143 cp -a examples $RPM_BUILD_ROOT%{_datadir}/CGAL/examples
146 cat > makefile.sed <<'EOF'
147 s,CGAL_INCL_DIR *=.*,CGAL_INCL_DIR = %{_includedir},;
148 s,CGAL_LIB_DIR *=.*,CGAL_LIB_DIR = %{_libdir},;
149 /CUSTOM_CXXFLAGS/ s/-O2 //;
150 /CUSTOM_CXXFLAGS/ s/-g //;
151 /CGAL_INCL_DIR/ s,/CGAL/config/.*,,;
152 s,/$(CGAL_OS_COMPILER),,g;
153 /-I.*CGAL_INCL_CONF_DIR/ d
156 # use -i.bak to generate cgal-${SUFFIX}.mk.bak with right timestamp
157 # used below to restore the timestamp
158 sed -i.bak -f makefile.sed $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
160 # check if the sed script above has worked:
161 grep -q %{_builddir} $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
162 grep -q $RPM_BUILD_ROOT $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
163 grep -q CGAL/config $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
164 grep -q -E 'CUSTOM_CXXFLAGS.*(-O2|-g)' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
166 # Remove -L and -R flags from the makefile
167 cat > makefile-noprefix.sed <<'EOF'
168 /'-L$(CGAL_LIB_DIR)'/ d;
169 /-R$(CGAL_LIB_DIR)/ d;
170 /'-I$(CGAL_INCL_DIR)'/ d;
173 sed -i -f makefile-noprefix.sed $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
175 # restore the timestamp and remove the .bak file
176 touch -r $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk.bak $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
177 rm -f $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk.bak
179 # check that the sed script has worked
180 grep -q -E -- '-[LI]\$' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
181 grep -q -E -- '-R' $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk && false
183 # Create %{_sysconfdir}/profile.d/ scripts
184 install -d $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
185 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.sh <<EOF
189 x86_64 | ia64 | s390 )
195 if [ -z "\$CGAL_MAKEFILE" ] ; then
196 CGAL_MAKEFILE="%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
201 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.csh <<EOF
214 if ( ! \$?CGAL_MAKEFILE ) then
215 setenv CGAL_MAKEFILE "%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
219 # use the timestamp of install_cgal
220 touch -r install_cgal $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.*sh
223 rm -rf $RPM_BUILD_ROOT
226 %post -p /sbin/ldconfig
228 %postun -p /sbin/ldconfig
232 %defattr(644,root,root,755)
233 %doc AUTHORS LICENSE LICENSE.FREE_USE LICENSE.LGPL LICENSE.QPL CHANGES
234 %attr(755,root,root) %{_libdir}/libCGAL*.so.2
235 %attr(755,root,root) %{_libdir}/libCGAL*.so.2.0.1
239 %defattr(644,root,root,755)
241 %{_libdir}/libCGAL*.so
242 %dir %{_datadir}/CGAL
243 %{_datadir}/CGAL/cgal*.mk
244 %attr(755,root,root) %{_bindir}/*
245 %exclude %{_bindir}/cgal_make_macosx_app
246 %config(noreplace) /etc/profile.d/cgal.*
250 %defattr(644,root,root,755)
251 %{_datadir}/CGAL/demo
252 %{_datadir}/CGAL/examples
253 %exclude %{_datadir}/CGAL/*/*/*.vcproj
254 %exclude %{_datadir}/CGAL/*/*/skip_vcproj_auto_generation