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