@@ -14,48 +14,6 @@ export OPENSSL_ROOT=openssl-1.0.2u
1414export OPENSSL_HASH=ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16
1515export CURL_VERSION=" 7.75.0"
1616
17- # source h5py-wheels/config.sh
18-
19- # copied from h5py-wheels/config.sh
20-
21- function build_wheel {
22- if [ -z " $IS_OSX " ]; then
23- build_linux_wheel $@
24- else
25- build_osx_wheel $@
26- fi
27- }
28-
29- function build_linux_wheel {
30- source multibuild/library_builders.sh
31- build_libs
32- # Add workaround for auditwheel bug:
33- # https://github.com/pypa/auditwheel/issues/29
34- local bad_lib=" /usr/local/lib/libhdf5.so"
35- if [ -z " $( readelf --dynamic $bad_lib | grep RUNPATH) " ]; then
36- patchelf --set-rpath $( dirname $bad_lib ) $bad_lib
37- fi
38- build_pip_wheel $@
39- }
40-
41- function build_osx_wheel {
42- local repo_dir=${1:- $REPO_DIR }
43- export CC=clang
44- export CXX=clang++
45- install_pkg_config
46- # Build libraries
47- source multibuild/library_builders.sh
48- export ARCH_FLAGS=" -arch x86_64"
49- export CFLAGS=$ARCH_FLAGS
50- export CXXFLAGS=$ARCH_FLAGS
51- export FFLAGS=$ARCH_FLAGS
52- export LDFLAGS=$ARCH_FLAGS
53- build_libs
54- # Build wheel
55- export LDFLAGS=" $ARCH_FLAGS -Wall -undefined dynamic_lookup -bundle"
56- export LDSHARED=" $CC $LDFLAGS "
57- build_pip_wheel " $repo_dir "
58- }
5917
6018function build_curl2 {
6119 if [ -e curl-stamp ]; then return ; fi
@@ -77,6 +35,76 @@ function build_curl2 {
7735 touch curl-stamp
7836}
7937
38+ function build_hdf5 {
39+ if [ -e hdf5-stamp ]; then return ; fi
40+ build_zlib
41+ # libaec is a drop-in replacement for szip
42+ build_libaec
43+ local hdf5_url=https://support.hdfgroup.org/ftp/HDF5/releases
44+ local short=$( echo $HDF5_VERSION | awk -F " ." ' {printf "%d.%d", $1, $2}' )
45+ fetch_unpack $hdf5_url /hdf5-$short /hdf5-$HDF5_VERSION /src/hdf5-$HDF5_VERSION .tar.gz
46+
47+ if [[ ! -z " IS_OSX" && " $PLAT " = " arm64" ]] && [[ " $CROSS_COMPILING " = " 1" ]]; then
48+ cd hdf5-$HDF5_VERSION
49+ # from https://github.com/conda-forge/hdf5-feedstock/commit/2cb83b63965985fa8795b0a13150bf0fd2525ebd
50+ export ac_cv_sizeof_long_double=8
51+ export hdf5_cv_ldouble_to_long_special=no
52+ export hdf5_cv_long_to_ldouble_special=no
53+ export hdf5_cv_ldouble_to_llong_accurate=yes
54+ export hdf5_cv_llong_to_ldouble_correct=yes
55+ export hdf5_cv_disable_some_ldouble_conv=no
56+ export hdf5_cv_system_scope_threads=yes
57+ export hdf5_cv_printf_ll=" l"
58+ export PAC_FC_MAX_REAL_PRECISION=15
59+ export PAC_C_MAX_REAL_PRECISION=17
60+ export PAC_FC_ALL_INTEGER_KINDS=" {1,2,4,8,16}"
61+ export PAC_FC_ALL_REAL_KINDS=" {4,8}"
62+ export H5CONFIG_F_NUM_RKIND=" INTEGER, PARAMETER :: num_rkinds = 2"
63+ export H5CONFIG_F_NUM_IKIND=" INTEGER, PARAMETER :: num_ikinds = 5"
64+ export H5CONFIG_F_RKIND=" INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/4,8/)"
65+ export H5CONFIG_F_IKIND=" INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/1,2,4,8,16/)"
66+ export PAC_FORTRAN_NATIVE_INTEGER_SIZEOF=" 4"
67+ export PAC_FORTRAN_NATIVE_INTEGER_KIND=" 4"
68+ export PAC_FORTRAN_NATIVE_REAL_SIZEOF=" 4"
69+ export PAC_FORTRAN_NATIVE_REAL_KIND=" 4"
70+ export PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF=" 8"
71+ export PAC_FORTRAN_NATIVE_DOUBLE_KIND=" 8"
72+ export PAC_FORTRAN_NUM_INTEGER_KINDS=" 5"
73+ export PAC_FC_ALL_REAL_KINDS_SIZEOF=" {4,8}"
74+ export PAC_FC_ALL_INTEGER_KINDS_SIZEOF=" {1,2,4,8,16}"
75+ curl -sLO https://github.com/conda-forge/hdf5-feedstock/raw/2cb83b63965985fa8795b0a13150bf0fd2525ebd/recipe/patches/osx_cross_configure.patch
76+ curl -sLO https://github.com/conda-forge/hdf5-feedstock/raw/2cb83b63965985fa8795b0a13150bf0fd2525ebd/recipe/patches/osx_cross_fortran_src_makefile.patch
77+ curl -sLO https://github.com/conda-forge/hdf5-feedstock/raw/2cb83b63965985fa8795b0a13150bf0fd2525ebd/recipe/patches/osx_cross_hl_fortran_src_makefile.patch
78+ curl -sLO https://github.com/conda-forge/hdf5-feedstock/raw/2cb83b63965985fa8795b0a13150bf0fd2525ebd/recipe/patches/osx_cross_src_makefile.patch
79+ patch -p0 < osx_cross_configure.patch
80+ patch -p0 < osx_cross_fortran_src_makefile.patch
81+ patch -p0 < osx_cross_hl_fortran_src_makefile.patch
82+ patch -p0 < osx_cross_src_makefile.patch
83+ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :$BUILD_PREFIX /lib
84+ ./configure --without-szlib --prefix=$BUILD_PREFIX --enable-threadsafe --enable-unsupported --with-pthread=yes --enable-build-mode=production --host=aarch64-apple-darwin --enable-tests=no
85+ mkdir -p native-build/bin
86+ cd native-build/bin
87+ pwd
88+ clang ../../src/H5detect.c -I ../../src/ -o H5detect
89+ clang ../../src/H5make_libsettings.c -I ../../src/ -o H5make_libsettings
90+ ls -l
91+ cd ../..
92+ export PATH=$( pwd) /native-build/bin:$PATH
93+ make -j4
94+ make install
95+ cd ..
96+ touch hdf5-stamp
97+ else
98+ (cd hdf5-$HDF5_VERSION \
99+ && export LD_LIBRARY_PATH=$LD_LIBRARY_PATH :$BUILD_PREFIX /lib \
100+ && ./configure --with-szlib=$BUILD_PREFIX --prefix=$BUILD_PREFIX \
101+ --enable-threadsafe --enable-unsupported --with-pthread=yes \
102+ && make -j4 \
103+ && make install)
104+ touch hdf5-stamp
105+ fi
106+ }
107+
80108function build_libs {
81109 build_hdf5
82110 build_curl2
@@ -86,6 +114,12 @@ function build_libs {
86114 build_netcdf
87115}
88116
117+ function pre_build {
118+ # Any stuff that you need to do before you start building the wheels
119+ # Runs in the root directory of this repository.
120+ build_libs
121+ }
122+
89123function run_tests {
90124 # Runs tests on installed distribution from an empty directory
91125 pwd
0 commit comments