%define _libdir64 %{_prefix}/lib64 Name: hdf Version: 4.2.8 Release: 1 Summary: A general purpose library and file format for storing scientific data License: BSD Group: System Environment/Libraries URL: http://hdfgroup.org/products/hdf4/index.html Source0: ftp://ftp.hdfgroup.org/HDF/HDF_Current/src/%{name}-%{version}.tar.bz2 Source1: ftp://ftp.hdfgroup.org/HDF/HDF_Current/src/%{name}-%{version}.tar.md5 Patch0: %{name}-%{version}-aix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: flex bison BuildRequires: libjpeg-devel >= 6b, zlib-devel >= 1.2.3 Requires: libjpeg >= 6b, zlib >= 1.2.3 %description HDF is a general purpose library and file format for storing scientific data. HDF can store two primary objects: datasets and groups. A dataset is essentially a multidimensional array of data elements, and a group is a structure for organizing objects in an HDF file. Using these two basic objects, one can create and store almost any kind of scientific data structure, such as images, arrays of vectors, and structured and unstructured grids. You can also mix and match them in HDF files according to your needs. The library is available as 32-bit and 64-bit. %package devel Summary: HDF development files Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: libjpeg-devel >= 6b, zlib-devel >= 1.2.3 %description devel HDF development headers and libraries. If you are compiling a 32-bit program, no special compiler options are needed. If you are compiling a 64-bit program, you have to compile and link your application with "cc -q64" or "gcc -maix64". %prep %setup -q %patch0 mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cd 32bit && tar cf - . | (cd ../64bit ; tar xpf -) %build export CONFIG_SHELL=/usr/bin/ksh export CONFIG_ENV_ARGS=/usr/bin/ksh # function to build a shared library build_shared_library() { f=$2 CreateExportList $1 ${f}.exp ${f}.a ${CC} -qmkshrobj ${f}.a -o $3 -bE:${f}.exp -bernotok $4 $5 $6 $7 $8 $9 rm -f ${f}.exp ${f}.a /usr/bin/ar $1 -rv ${f}.a $3 } # ------------------- 64-bits start ------------------ cd 64bit # first build the 64-bit version export OBJECT_MODE=64 export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" ./configure \ --prefix=%{_prefix} \ --libdir=%{_libdir64} \ --includedir=%{_includedir}/%{name} \ --mandir=%{_mandir} \ --disable-shared --enable-static \ --disable-netcdf \ --enable-production cd hdf/src make %{?_smp_mflags} libdf.la cd .libs build_shared_library -X64 libdf shr64.o -ljpeg -lz cd ../../../mfhdf/libsrc make %{?_smp_mflags} libmfhdf.la cd .libs build_shared_library -X64 libmfhdf shr64.o -L../../../hdf/src/.libs -ldf cd ../../.. make %{?_smp_mflags} # ------------------- 64-bits end ------------------ # ------------------- 32-bits start ------------------ # now build the 32-bit version cd ../32bit export OBJECT_MODE=32 export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" ./configure \ --prefix=%{_prefix} \ --includedir=%{_includedir}/%{name} \ --mandir=%{_mandir} \ --disable-shared --enable-static \ --disable-netcdf \ --enable-production cd hdf/src make %{?_smp_mflags} libdf.la cd .libs build_shared_library -X32 libdf shr.o -ljpeg -lz cd ../../../mfhdf/libsrc make %{?_smp_mflags} libmfhdf.la cd .libs build_shared_library -X32 libmfhdf shr.o -L../../../hdf/src/.libs -ldf cd ../../.. make %{?_smp_mflags} # ------------------- 32-bits end ------------------ # now create the AIX-style shared library slibclean /usr/bin/ar -X64 -q hdf/src/.libs/libdf.a ../64bit/hdf/src/.libs/shr64.o /usr/bin/ar -X64 -q mfhdf/libsrc/.libs/libmfhdf.a ../64bit/mfhdf/libsrc/.libs/shr64.o %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit make install DESTDIR=${RPM_BUILD_ROOT} ( cd ${RPM_BUILD_ROOT}%{_bindir} for f in * ; do mv -f ${f} ${f}_64 done ) cd ../32bit make install DESTDIR=${RPM_BUILD_ROOT} # Don't conflict with netcdf for file in ncdump ncgen ncdump_64 ncgen_64 ; do mv ${RPM_BUILD_ROOT}%{_bindir}/${file} ${RPM_BUILD_ROOT}%{_bindir}/h${file} # man pages are the same than netcdf ones rm -f ${RPM_BUILD_ROOT}%{_mandir}/man1/${file}.1 done /usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* || : ( cd ${RPM_BUILD_ROOT} for dir in bin include lib do mkdir -p usr/${dir} cd usr/${dir} ln -sf ../..%{_prefix}/${dir}/* . cd - done ) %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/COPYING 32bit/MANIFEST 32bit/README.txt 32bit/release_notes/*.txt %{_bindir}/* %{_libdir}/*.a %{_mandir}/man1/* /usr/bin/* /usr/lib/*.a %files devel %defattr(-,root,system,-) %{_includedir}/%{name} %{_libdir}/*.la %{_libdir}/*.settings /usr/include/%{name} /usr/lib/*.la %changelog * Tue Jan 08 2013 Michael Perzl - 4.2.8-1 - updated to version 4.2.8 * Mon Jul 18 2011 Michael Perzl - 4.2.7patch1-1 - updated to version 4.2.7 patch1 * Mon Jul 18 2011 Michael Perzl - 4.2.6-1 - first version for AIX V5.1 and higher