1 %define boost_version 1.32
2 Summary: Computational Geometry Algorithms Library
6 License: QPL and LGPLv2 and LGPLv2+
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)
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
34 Summary: Development files and tools for CGAL applications
35 Group: Development/Libraries
36 Requires: %{_sysconfdir}/profile.d
37 Requires: %{name} = %{version}-%{release}
39 Requires: boost-devel >= %{boost_version}
40 Requires: gmp-c++-devel
42 Requires: lapack-devel
48 The %{name}-devel package provides the headers files and tools you may
49 need to develop applications using CGAL.
52 Summary: Examples and demos of CGAL algorithms
54 Requires: %{name}-devel = %{version}-%{release}
56 %description demos-source
57 The %{name}-demos-source package provides the sources of examples and
58 demos of CGAL algorithms.
63 %patch1 -p0 -b .support-required.bak
64 %patch2 -p1 -b .build-library.bak
65 %patch4 -p1 -b .no_versions.bak
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
79 export QTDIR=%{_prefix}
80 ./install_cgal -ni g++ --CUSTOM_CXXFLAGS "$RPM_OPT_FLAGS" \
84 --with-BOOST_PROGRAM_OPTIONS \
90 --with-REFBLASSHARED \
91 --with-DEFAULTLAPACK \
93 --QT_INCL_DIR=%{_includedir}/qt \
94 --QT_LIB_DIR=%{_libdir} \
99 rm -rf $RPM_BUILD_ROOT
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
113 # remove the arch-specific comment
114 %{__sed} -i -e '/System: / d' $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
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
120 # Install scripts (only those prefixed with "cgal_").
121 install -d $RPM_BUILD_ROOT%{_bindir}
122 install -p scripts/cgal_* $RPM_BUILD_ROOT%{_bindir}
125 install -d $RPM_BUILD_ROOT%{_libdir}
126 cp -a lib/*/lib* $RPM_BUILD_ROOT%{_libdir}
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
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
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
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
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
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;
167 sed -i -f makefile-noprefix.sed $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
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
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
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
189 if [ -z "\$CGAL_MAKEFILE" ] ; then
190 CGAL_MAKEFILE="%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
195 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.csh <<EOF
208 if (! \$?CGAL_MAKEFILE ) then
209 setenv CGAL_MAKEFILE "%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
213 # use the timestamp of install_cgal
214 touch -r install_cgal $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.*sh
217 rm -rf $RPM_BUILD_ROOT
219 %post -p /sbin/ldconfig
220 %postun -p /sbin/ldconfig
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
229 %defattr(644,root,root,755)
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.*
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