]> git.pld-linux.org Git - packages/CGAL.git/blob - CGAL.spec
- from fc9, CGAL is one hell of a painful lib to package
[packages/CGAL.git] / CGAL.spec
1 %define boost_version 1.32
2
3 Summary:        Computational Geometry Algorithms Library
4 Name:           CGAL
5 Version:        3.3.1
6 Release:        0.99
7 License:        QPL and LGPLv2 and LGPLv2+
8 Group:          Libraries
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)
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
34 %package devel
35 Summary:        Development files and tools for CGAL applications
36 Group:          Development/Libraries
37 Requires:       %{_sysconfdir}/profile.d
38 Requires:       %{name} = %{version}-%{release}
39 Requires:       blas-devel
40 Requires:       lapack-devel
41 Requires:       qt-devel
42 Requires:       zlib-devel
43 Requires:       gmp-devel
44 Requires:       boost-devel >= %{boost_version}
45 Requires:       mpfr-devel
46 Requires:       gmp-c++-devel
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
52 %package demos-source
53 Summary:        Examples and demos of CGAL algorithms
54 Group:          Documentation
55 Requires:       %{name}-devel = %{version}-%{release}
56
57 %description demos-source
58 The %{name}-demos-source package provides the sources of examples and
59 demos of CGAL algorithms.
60
61
62 %prep
63 %setup -q
64 %patch1 -p0 -b .support-required.bak
65 %patch2 -p1 -b .build-library.bak
66 %patch4 -p1 -b .no_versions.bak
67
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;
74 do
75   if [ -r $f ]; then
76     sed -i.bak 's/\r//' $f;
77     touch -r ${f}.bak $f
78     rm -f ${f}.bak
79   fi
80 done
81
82 %build
83 export QTDIR=%{_prefix}
84 ./install_cgal -ni g++ --CUSTOM_CXXFLAGS "$RPM_OPT_FLAGS" \
85                            --without-autofind \
86                            --with-ZLIB \
87                            --with-BOOST \
88                            --with-BOOST_PROGRAM_OPTIONS \
89                            --with-X11 \
90                            --with-GMP \
91                            --with-GMPXX \
92                            --with-MPFR \
93                            --with-QT3MT \
94                            --with-REFBLASSHARED \
95                            --with-DEFAULTLAPACK \
96                            --with-OPENGL \
97                            --QT_INCL_DIR=%{_includedir}/qt \
98                            --QT_LIB_DIR=%{_libdir} \
99                            --disable-static
100
101
102 %install
103 rm -rf $RPM_BUILD_ROOT
104
105 case "%{_arch}" in
106         *64* | s390 )
107            SUFFIX=64 ;;
108         * )
109            SUFFIX=32 ;;
110 esac
111
112 # Install headers
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
117
118
119 # remove the arch-specific comment
120 sed -i -e '/System: / d' $RPM_BUILD_ROOT%{_includedir}/CGAL/compiler_config.h
121
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
125
126 # Install scripts (only those prefixed with "cgal_").
127 install -d $RPM_BUILD_ROOT%{_bindir}
128 install -p scripts/cgal_* $RPM_BUILD_ROOT%{_bindir}
129
130 # Install libraries
131 install -d $RPM_BUILD_ROOT%{_libdir}
132 cp -a lib/*/lib* $RPM_BUILD_ROOT%{_libdir}
133
134 # Install makefile:
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
138
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
144
145 # Modify makefile
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
154 EOF
155
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
159
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
165
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;
171 EOF
172
173 sed -i -f makefile-noprefix.sed  $RPM_BUILD_ROOT%{_datadir}/CGAL/cgal-${SUFFIX}.mk
174
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
178
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
182
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
186 ARCH=`uname -m`
187
188 case \$ARCH in
189         x86_64 | ia64 | s390 )
190            SUFFIX=64 ;;
191         * )
192            SUFFIX=32 ;;
193 esac
194
195 if [ -z "\$CGAL_MAKEFILE" ] ; then
196   CGAL_MAKEFILE="%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
197   export CGAL_MAKEFILE
198 fi
199 EOF
200
201 cat > $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.csh <<EOF
202 set ARCH=`uname -m`
203
204 switch( \$ARCH )
205         case x86_64:
206         case ia64:
207         case s390:
208           set SUFFIX=64;
209           breaksw;
210         default:
211           set SUFFIX=62;
212 endsw
213
214 if ( ! \$?CGAL_MAKEFILE ) then
215   setenv CGAL_MAKEFILE "%{_datadir}/CGAL/cgal-${SUFFIX}.mk"
216 endif
217 EOF
218
219 # use the timestamp of install_cgal
220 touch -r install_cgal $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/cgal.*sh
221
222 %clean
223 rm -rf $RPM_BUILD_ROOT
224
225
226 %post -p /sbin/ldconfig
227
228 %postun -p /sbin/ldconfig
229
230
231 %files
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
236
237
238 %files devel
239 %defattr(644,root,root,755)
240 %{_includedir}/CGAL
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.*
247
248
249 %files demos-source
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
This page took 0.06308 seconds and 3 git commands to generate.