ThirdParty packages: Fix typos for some .csh files. Add some comments in the etc...
[OpenFOAM-1.6-ext.git] / ThirdParty / rpmBuild / SPECS / ParaView-3.8.1.spec
blob6cc6ca21f011ab0976b97b74dd4b5af956c48073
1 #------------------------------------------------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright held by original author
6 # \\/ M anipulation |
7 #-------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by the
13 # Free Software Foundation; either version 2 of the License, or (at your
14 # option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM; if not, write to the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 # RPM spec file for ParaView-3.8.1
28 # Description
29 # RPM spec file for creating a relocatable RPM
31 # Author:
32 # Martin Beaudoin, Hydro-Quebec, (2010)
34 #------------------------------------------------------------------------------
36 # We grab the value of WM_THIRD_PARTY and WM_OPTIONS from the environment variable
37 %{expand:%%define _WM_THIRD_PARTY_DIR %(echo $WM_THIRD_PARTY_DIR)}
38 %{expand:%%define _WM_OPTIONS %(echo $WM_OPTIONS)}
40 # The topdir needs to point to the $WM_THIRD_PARTY/rpmbuild directory
41 %define _topdir %{_WM_THIRD_PARTY_DIR}/rpmBuild
42 %define _tmppath %{_topdir}/tmp
44 # Will install the package directly $WM_THIRD_PARTY_DIR
45 # Some comments about package relocation:
46 # By using this prefix for the Prefix: parameter in thi file, you will make this
47 # package relocatable.
49 # This is fine, as long as your software is itself relocatable.
51 # Simply take note that libraries built with libtool are not relocatable because the
52 # prefix we specify will be hard-coded in the library .la files.
53 # Ref: http://sourceware.org/autobook/autobook/autobook_80.html
55 # In that case, if you ever change the value of the $WM_THIRD_PARTY_DIR, you will
56 # not be able to reutilize this RPM, even though it is relocatable. You will need to
57 # regenerate the RPM.
59 %define _prefix %{_WM_THIRD_PARTY_DIR}
61 %define name ParaView
62 %define release %{_WM_OPTIONS}
63 %define version 3.8.1
65 %define buildroot %{_topdir}/BUILD/%{name}-%{version}-root
67 BuildRoot: %{buildroot}
68 Summary: ParaView
69 License: Unkown
70 Name: %{name}
71 Version: %{version}
72 Release: %{release}
73 URL: http://www.paraview.org/files/v3.8/
74 Source: %url/%{name}-%{version}.tar.gz
75 Prefix: %{_prefix}
76 Group: Development/Tools
77 Patch0: ParaView-3.8.1.patch_darwin
79 %define _installPrefix %{_prefix}/packages/%{name}-%{version}/platforms/%{_WM_OPTIONS}
81 #--------------------------------------------------------------------------
83 # Here, we define default compiling options for cmake
85 # One can override the option on the commande line : --define='MACRO EXPR'
87 %{!?_withVerbose: %define _withVerbose false}
88 %{!?_withMesa: %define _withMesa false}
89 %{!?_withMPI: %define _withMPI false}
90 %{!?_withPython: %define _withPython false}
91 %{!?_withQt: %define _withQt true}
92 %{!?_qmakePath: %define _qmakePath Undefined}
93 %{!?_mesaIncludePath: %define _mesaIncludePath Undefined}
94 %{!?_mesaLibPath: %define _mesaLibPath Undefined}
95 %{!?_pythonLibPath: %define _pythonLibPath Undefined}
97 #--------------------------------------------------------------------------
99 %description
100 %{summary}
102 %prep
103 %setup -q
105 %ifos darwin
106 %patch0 -p1
107 %endif
109 %build
111 # set CMake cache variables
113 addCMakeVariable()
115 while [ -n "$1" ]
117 CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
118 shift
119 done
122 # export WM settings in a form that GNU configure recognizes
123 [ -n "$WM_CC" ] && export CC="$WM_CC"
124 [ -n "$WM_CXX" ] && export CXX="$WM_CXX"
125 [ -n "$WM_CFLAGS" ] && export CFLAGS="$WM_CFLAGS"
126 [ -n "$WM_CXXFLAGS" ] && export CXXFLAGS="$WM_CXXFLAGS"
127 [ -n "$WM_LDFLAGS" ] && export LDFLAGS="$WM_LDFLAGS"
129 set +x
130 echo ""
131 echo "Compilation options:"
132 echo " _withVerbose : %{_withVerbose}"
133 echo " _withMesa : %{_withMesa}"
134 echo " _withMPI : %{_withMPI}"
135 echo " _withPython : %{_withPython}"
136 echo " _withQt : %{_withQt}"
137 echo " _qmakePath : %{_qmakePath}"
138 echo " _mesaIncludePath : %{_mesaIncludePath}"
139 echo " _mesaLibPath : %{_mesaLibPath}"
140 echo " _pythonLibPath : %{_pythonLibPath}"
141 echo ""
142 set -x
144 # start with these general settings
145 addCMakeVariable VTK_USE_TK:BOOL=OFF
146 addCMakeVariable BUILD_SHARED_LIBS:BOOL=ON VTK_USE_RPATH:BOOL=OFF
147 addCMakeVariable CMAKE_BUILD_TYPE:STRING=Release
149 # include development files in "make install"
150 addCMakeVariable PARAVIEW_INSTALL_DEVELOPMENT:BOOL=ON
152 # new alternative to "make HTMLDocumentation"
153 addCMakeVariable PARAVIEW_GENERATE_PROXY_DOCUMENTATION:BOOL=ON
155 %ifos darwin
156 # Additional installation rules for Mac OS X
157 addCMakeVariable PARAVIEW_EXTRA_INSTALL_RULES_FILE:FILEPATH=%{_topdir}/BUILD/%{name}-%{version}/Applications/ParaView-3.8.1_extra_install_Darwin.cmake
158 %endif
160 # Add the value of _qmakePath for QT_QMAKE_EXECUTABLE
161 addCMakeVariable QT_QMAKE_EXECUTABLE:FILEPATH=%{_qmakePath}
163 echo "CMAKE_VARIABLES: $CMAKE_VARIABLES"
165 mkdir -p ./buildObj
166 cd ./buildObj
168 cmake \
169 -DCMAKE_INSTALL_PREFIX:PATH=$RPM_BUILD_ROOT%{_installPrefix} \
170 $CMAKE_VARIABLES \
173 [ -z "$WM_NCOMPPROCS" ] && WM_NCOMPPROCS=1
174 make -j $WM_NCOMPPROCS
176 %install
177 # On OpenSUSE, rpmbuild, will choke when detecting unreferenced symlinks
178 # created during installation.
179 # Qt version 4.6.3 will generate some unreferenced symlinks when
180 # ParaView is compiled and installed. By enabling the following
181 # environment variable, the command brp-symlink will still complain
182 # about missing link targets, but it won't stop rpmbuild from generating
183 # the final rpm.
184 # For all other Unix distros, this is a no-op.
185 export NO_BRP_STALE_LINK_ERROR=yes
187 cd buildObj
188 make install
190 # Creation of OpenFOAM specific .csh and .sh files"
192 echo ""
193 echo "Generating OpenFOAM specific .csh and .sh files for the package %{name}-%{version}"
194 echo ""
196 # Generate package specific .sh file for OpenFOAM
198 mkdir -p $RPM_BUILD_ROOT/%{_installPrefix}/etc
199 cat << DOT_SH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.sh
200 # Load %{name}-%{version} libraries and binaries if available
201 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
203 export PARAVIEW_DIR=\$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
204 export PARAVIEW_BIN_DIR=\$PARAVIEW_DIR/bin
205 export PARAVIEW_LIB_DIR=\$PARAVIEW_DIR/lib
206 export PARAVIEW_INCLUDE_DIR=\$PARAVIEW_DIR/include
208 export PARAVIEW_VERSION=%{version}
210 # NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins.
211 # Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the
212 # specified directory to see if a given library is a paraview plugin.
213 # In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the
214 # startup of paraview or even make paraview crash on startup.
215 export PV_PLUGIN_PATH=\$FOAM_LIBBIN/paraview_plugins
217 [ -d \$PARAVIEW_LIB_DIR/paraview-3.8 ] && _foamAddLib \$PARAVIEW_LIB_DIR/paraview-3.8
219 # Enable access to the package applications if present
220 [ -d \$PARAVIEW_BIN_DIR ] && _foamAddPath \$PARAVIEW_BIN_DIR
222 # Additional binary path if running on Mac OS X
223 [ -d \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ] && _foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS
225 DOT_SH_EOF
228 # Generate package specific .csh file for OpenFOAM
230 cat << DOT_CSH_EOF > $RPM_BUILD_ROOT/%{_installPrefix}/etc/%{name}-%{version}.csh
231 # Load %{name}-%{version} libraries and binaries if available
232 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233 setenv PARAVIEW_DIR \$WM_THIRD_PARTY_DIR/packages/%{name}-%{version}/platforms/\$WM_OPTIONS
234 setenv PARAVIEW_BIN_DIR \$PARAVIEW_DIR/bin
235 setenv PARAVIEW_LIB_DIR \$PARAVIEW_DIR/lib
236 setenv PARAVIEW_INCLUDE_DIR \$PARAVIEW__DIR/include
238 setenv PARAVIEW_VERSION %{version}
240 # NB: It is important to set the PV_PLUGIN_PATH location to a directory containing only the ParaView plugins.
241 # Otherwise, paraview will try to automatically autoload each and every dynamic library it can find in the
242 # specified directory to see if a given library is a paraview plugin.
243 # In the case of \$FOAM_LIBBIN, with over 80 libraries, this is a total waste of time that will slow down the
244 # startup of paraview or even make paraview crash on startup.
245 setenv PV_PLUGIN_PATH \$FOAM_LIBBIN/paraview_plugins
247 if ( -e \$PARAVIEW_BIN_DIR ) then
248 _foamAddPath \$PARAVIEW_BIN_DIR
249 endif
251 if ( -e \$PARAVIEW_LIB_DIR/paraview-3.8 ) then
252 _foamAddLib \$PARAVIEW_LIB_DIR/paraview-3.8
253 endif
256 # Additional binary path if running on Mac OS X
257 if ( -e \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS ) then
258 _foamAddPath \$PARAVIEW_BIN_DIR/paraview.app/Contents/MacOS
259 endif
260 DOT_CSH_EOF
262 %clean
264 %files
265 %defattr(-,root,root)
266 %{_installPrefix}