awips2/rpms/python.site-packages/Installer.h5py/component.spec
Bryan Kowal 0bee225031 Issue #2163 - 64-bit RHEL6 rpm conversion
- converted ant and added ant source to the repository (will no longer need to be retrieved from awipscm)
- converted Java
- converted the hdf5 tools and lzf is now built from source in addition to the hdf5 tools
- fixed python h5py to correctly include the built libsz libraries


Former-commit-id: ffc8892888976ee4b9d9edeb315b74edc5bb375f
2013-08-15 15:24:48 -05:00

190 lines
3.7 KiB
Ruby

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%define _build_arch %(uname -i)
%define _python_pkgs_dir "%{_baseline_workspace}/pythonPackages"
%define _python_build_loc %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
#
# AWIPS II Python h5py Spec File
#
Name: awips2-python-h5py
Summary: AWIPS II Python h5py Distribution
Version: 1.3.0
Release: 3.el6
Group: AWIPSII
BuildRoot: %{_build_root}
BuildArch: %{_build_arch}
URL: N/A
License: N/A
Distribution: N/A
Vendor: Raytheon
Packager: Bryan Kowal
AutoReq: no
requires: awips2-python
requires: awips2-python-numpy
requires: libz.so.1
provides: awips2-python-h5py
%description
AWIPS II Python h5py Site-Package
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "" ]
then
echo "A Build Root has not been specified."
echo "Unable To Continue ... Terminating"
exit 1
fi
rm -rf %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
mkdir -p %{_build_root}
if [ $? -ne 0 ]; then
exit 1
fi
mkdir -p %{_build_root}/awips2/python/lib
if [ $? -ne 0 ]; then
exit 1
fi
PRE_REQS_HDF5_TAR=""
if [ "%{_build_arch}" = "i386" ]; then
PRE_REQS_HDF5_TAR="hdf5-1.8.4-patch1-linux-shared.tar.gz"
else
if [ "%{_build_arch}" = "x86_64" ]; then
PRE_REQS_HDF5_TAR="hdf5-1.8.4-patch1-linux-x86_64-shared.tar.gz"
else
echo "ERROR: Unrecognized Architecture."
exit 1
fi
fi
if [ -d %{_python_build_loc} ]; then
rm -rf %{_python_build_loc}
fi
mkdir -p %{_python_build_loc}
PRE_REQS_DIR="%{_baseline_workspace}/rpms/python.site-packages/deploy.builder/pre-reqs"
cp -v ${PRE_REQS_DIR}/${PRE_REQS_HDF5_TAR} \
%{_python_build_loc}
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
cd %{_python_build_loc}
/bin/tar -xvf ${PRE_REQS_HDF5_TAR}
RC=$?
if [ ${RC} -ne 0 ]; then
exit 1
fi
rm -f ${PRE_REQS_HDF5_TAR}
popd > /dev/null
%build
HDF5_PATH=
if [ "%{_build_arch}" = "i386" ]; then
HDF5_PATH="%{_python_build_loc}/hdf5-1.8.4-patch1-linux-shared"
else
HDF5_PATH="%{_python_build_loc}/hdf5-1.8.4-patch1-linux-x86_64-shared"
fi
H5PY_SRC_DIR="%{_python_pkgs_dir}/h5py"
SZIP_SRC_DIR="%{_baseline_workspace}/rpms/python.site-packages/Installer.h5py/src"
SZIP_TAR="szip-2.1.tar"
# Copy the h5py source.
cp -rv ${H5PY_SRC_DIR}/* \
%{_python_build_loc}
if [ $? -ne 0 ]; then
exit 1
fi
# Copy the szip source.
cp -rv ${SZIP_SRC_DIR}/${SZIP_TAR} \
%{_python_build_loc}
if [ $? -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
# build h5py
cd %{_python_build_loc}
export LD_LIBRARY_PATH=/awips2/python/lib
/awips2/python/bin/python setup.py build \
--hdf5=${HDF5_PATH}
if [ $? -ne 0 ]; then
exit 1
fi
# build szip
/bin/tar -xf ${SZIP_TAR}
if [ $? -ne 0 ]; then
exit 1
fi
cd szip-2.1
./configure
if [ $? -ne 0 ]; then
exit 1
fi
make
if [ $? -ne 0 ]; then
exit 1
fi
cd ..
/bin/rm -f ${SZIP_TAR}
if [ $? -ne 0 ]; then
exit 1
fi
popd > /dev/null
%install
HDF5_PATH=
if [ "%{_build_arch}" = "i386" ]; then
HDF5_PATH="%{_python_build_loc}/hdf5-1.8.4-patch1-linux-shared"
else
HDF5_PATH="%{_python_build_loc}/hdf5-1.8.4-patch1-linux-x86_64-shared"
fi
pushd . > /dev/null
cd %{_python_build_loc}
export LD_LIBRARY_PATH=/awips2/python/lib
/awips2/python/bin/python setup.py install \
--root=%{_build_root} \
--prefix=/awips2/python
popd > /dev/null
pushd . > /dev/null
cd %{_python_build_loc}/szip-2.1
cp -P src/.libs/libsz.so* \
%{_build_root}/awips2/python/lib
if [ $? -ne 0 ]; then
exit 1
fi
cd ..
/bin/rm -rf szip-2.1
if [ $? -ne 0 ]; then
exit 1
fi
popd > /dev/null
rm -rf ${HDF5_PATH}
%pre
%post
%preun
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
rm -rf %{_python_build_loc}
%files
%defattr(644,awips,fxalpha,755)
%dir /awips2/python/lib
/awips2/python/lib/*