<commit_before>#!/bin/bash
# vendored from https://github.com/h5py/h5py/blob/master/ci/get_hdf5_if_needed.sh

set -e -x

if [ -z ${HDF5_MPI+x} ]; then
    echo "Building serial"
    EXTRA_MPI_FLAGS=''
else
    echo "Building with MPI"
    EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
export LD_LIBRARY_PATH="$HDF5_DIR/lib:${LD_LIBRARY_PATH}"
export PKG_CONFIG_PATH="$HDF5_DIR/lib/pkgconfig:${PKG_CONFIG_PATH}"

MINOR_V=${HDF5_VERSION#*.}
MINOR_V=${MINOR_V%.*}
MAJOR_V=${HDF5_VERSION/%.*.*}


echo "building HDF5"
if [[ "$OSTYPE" == "darwin"* ]]; then
    brew install automake cmake pkg-config
    export MACOSX_DEPLOYMENT_TARGET="10.9"
    NPROC=$(sysctl -n hw.ncpu)
    pushd /tmp

    # lzo
    curl -sLO https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
    tar xzf lzo-2.10.tar.gz
    pushd lzo-2.10
    CFLAGS= CXXFLAGS= CPPFLAGS= CC="/usr/bin/clang" CXX="/usr/bin/clang" ./configure \
        --prefix="$HDF5_DIR"_arm64 CFLAGS="-arch arm64" CXXFLAGS="-arch arm64" \
        --host="aarch64-apple-darwin"  --target="aarch64-apple-darwin" --enable-shared
    make
    make install
    popd

    rm -rf lzo-2.10
    tar xzf lzo-2.10.tar.gz
    pushd lzo-2.10
    CFLAGS= CXXFLAGS= CPPFLAGS= CC="/usr/bin/clang" CXX="/usr/bin/clang" ./configure \
        --prefix="$HDF5_DIR"_x86 --enable-shared
    make
    make install
    popd

    mkdir -p "$HDF5_DIR"/lib/pkgconfig
    mkdir "$HDF5_DIR"/include
    pushd "$HDF5_DIR"_x86/lib
    for filename in *lzo*.dylib *lzo*.a; do
        if [[ -f "$HDF5_DIR"_arm64/lib/$filename ]]; then
            lipo "$HDF5_DIR"_x86/lib/$filename "$HDF5_DIR"_arm64/lib/$filename -output "$HDF5_DIR"/lib/$filename -create
        fi
    done
    popd
    find "$HDF5_DIR"_x86
    find "$HDF5_DIR"_arm64

    cp -r "$HDF5_DIR"_arm64/include/lzo "$HDF5_DIR"/include/lzo
    cp "$HDF5_DIR"_arm64/lib/pkgconfig/lzo2.pc "$HDF5_DIR"/lib/pkgconfig
    sed -i "" "s/_arm64//g" "$HDF5_DIR"/lib/pkgconfig/lzo2.pc
    cat "$HDF5_DIR"/lib/pkgconfig/lzo2.pc


    # snappy
    git clone https://github.com/google/snappy.git --branch 1.1.9 --depth 1
    pushd snappy
    git submodule update --init
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX="$HDF5_DIR" -DENABLE_SHARED:bool=on -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ../
    make
    make install
    popd<commit_msg>Switch to cmake.<commit_after>#!/bin/bash
# vendored from https://github.com/h5py/h5py/blob/master/ci/get_hdf5_if_needed.sh

set -e -x

if [ -z ${HDF5_MPI+x} ]; then
    echo "Building serial"
    EXTRA_MPI_FLAGS=''
else
    echo "Building with MPI"
    EXTRA_MPI_FLAGS="--enable-parallel --enable-shared"
fi
export LD_LIBRARY_PATH="$HDF5_DIR/lib:${LD_LIBRARY_PATH}"
export PKG_CONFIG_PATH="$HDF5_DIR/lib/pkgconfig:${PKG_CONFIG_PATH}"

MINOR_V=${HDF5_VERSION#*.}
MINOR_V=${MINOR_V%.*}
MAJOR_V=${HDF5_VERSION/%.*.*}


echo "building HDF5"
if [[ "$OSTYPE" == "darwin"* ]]; then
    brew install automake cmake pkg-config
    export MACOSX_DEPLOYMENT_TARGET="10.9"
    NPROC=$(sysctl -n hw.ncpu)
    pushd /tmp

    # lzo
    curl -sLO https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz
    tar xzf lzo-2.10.tar.gz
    pushd lzo-2.10
    cmake -DCMAKE_INSTALL_PREFIX="$HDF5_DIR" -DENABLE_SHARED:bool=on -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
    make
    make install
    popd

    # snappy
    git clone https://github.com/google/snappy.git --branch 1.1.9 --depth 1
    pushd snappy
    git submodule update --init
    mkdir build
    cd build
    cmake -DCMAKE_INSTALL_PREFIX="$HDF5_DIR" -DENABLE_SHARED:bool=on -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ../
    make
    make install
    popd
{'fraction_non_alphanumeric': 0.14827018121911037, 'fraction_numerical': 0.0356946732564525, 'mean_word_length': 3.1586757990867578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4971721', 'n_tokens_mistral': 1598, 'n_tokens_neox': 1494, 'n_words': 258}