Date: Monday, September 24, 2018 @ 18:29:38
  Author: archange
Revision: 384675

Work around autotools vs CMake differences

Modified:
  hdf5-openmpi/trunk/PKGBUILD

----------+
 PKGBUILD |   63 ++++++++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 48 insertions(+), 15 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2018-09-24 17:03:28 UTC (rev 384674)
+++ PKGBUILD    2018-09-24 18:29:38 UTC (rev 384675)
@@ -10,7 +10,7 @@
 _mpi=openmpi
 pkgname=${_pkgname}-${_mpi}
 pkgver=1.10.3
-pkgrel=1
+pkgrel=2
 pkgdesc="General purpose library and file format for storing scientific data 
(${_mpi} version)"
 arch=('x86_64')
 url="https://www.hdfgroup.org/hdf5";
@@ -29,8 +29,6 @@
             '603006358175b7a8b35fa44c484cddf45c0381cf50db4fb7c50ea5969d361eca')
 
 prepare() {
-    mkdir -p build
-
     cd ${_pkgname}-${pkgver/_/-}
     # FS#33343
     patch -p1 -i ../mpi.patch
@@ -37,7 +35,8 @@
 }
 
 build() {
-    cd build
+    # Crazy workaround: run CMake to generate pkg-config file
+    mkdir -p build && cd build
     CXX="mpicxx" \
     CC="mpicc" \
     FC="mpif90" \
@@ -56,24 +55,58 @@
         -DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
         -DHDF5_ENABLE_SZIP_SUPPORT=ON \
         -DHDF5_ENABLE_SZIP_ENCODING=ON
-    cmake --build . --config Release
+    # But don’t build with it, it’s quite broken
+    cd ../${_pkgname}-${pkgver/_/-}
+    ./configure \
+        CXX="mpicxx" \
+        CC="mpicc" \
+        FC="mpif90" \
+        F9X="mpif90" \
+        RUNPARALLEL="mpirun" \
+        OMPI_MCA_disable_memory_allocator=1 \
+        --prefix=/usr \
+        --docdir=/usr/share/doc/hdf5/ \
+        --enable-static \
+        --disable-sharedlib-rpath \
+        --enable-build-mode=production \
+        --enable-hl \
+        --enable-cxx \
+        --enable-fortran \
+        --enable-parallel \
+        --enable-unsupported \
+        --with-pic \
+        --with-zlib \
+        --with-szlib
+    make
 }
 
 check() {
-    cd build
-    # Three expected test failures 
(https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.3/src/hdf5-1.10.3-RELEASE.txt,
 Known Problems):
-    #   142 - TEST_PAR_testphdf5 (Failed)
-    #   146 - TEST_PAR_t_cache_image (Timeout)
-    #   153 - TEST_PAR_t_shapesame (Failed)
-    ctest . -C Release || warning "Tests failed"
+    cd ${_pkgname}-${pkgver/_/-}
+    # Without this, checks are failing with messages like “error while loading 
shared libraries: libhdf5.so.101: cannot open shared object file: No such file 
or directory”
+    export LD_LIBRARY_PATH="${srcdir}"/${pkgname}-${pkgver/_/-}/src/.libs/
+    export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/c++/src/.libs/
+    export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/fortran/src/.libs/
+    export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/src/.libs/
+    export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/c++/src/.libs/
+    export 
LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"${srcdir}"/${pkgname}-${pkgver/_/-}/hl/fortran/src/.libs/
+    # This is a parallel build, they are always OpenMPI bugs
+    make check || warning "Tests failed"
 }
 
 package() {
-    cd build
+    cd ${_pkgname}-${pkgver/_/-}
 
     make DESTDIR="${pkgdir}" install
 
-    install -d "${pkgdir}"/usr/share/licenses/${pkgname}
-    mv "${pkgdir}"/usr/share/COPYING "${pkgdir}"/usr/share/licenses/${pkgname}/
-    rm "${pkgdir}"/usr/share/{RELEASE,USING_HDF5_CMake}.txt
+    # Remove leftover test files
+    rm "${pkgdir}"/usr/include/tst{ds,image,lite,table}{,_tests}.mod
+
+    # Move examples to a proper place
+    install -dm755 "${pkgdir}"/usr/share/doc/${_pkgname}
+    mv "${pkgdir}"/usr/share/{hdf5_examples,doc/${_pkgname}/examples}
+
+    install -Dm644 COPYING -t "${pkgdir}"/usr/share/licenses/${_pkgname}
+
+    # Install pkg-config files from CMake tree
+    install -Dm644 ../build/CMakeFiles/hdf5{,_hl}{,_cpp}-${pkgver}.pc -t 
"${pkgdir}"/usr/lib/pkgconfig/
 }

Reply via email to