ziggy/script-plugins/hdf5.gradle

79 lines
2.1 KiB
Groovy

// Download and build HDF5.
ext.hdf5Version = "1.14.5"
task buildHdf5() {
def tmp = file("$outsideDir/tmp/hdf5")
def hdf5 = file("$tmp/hdf5-$hdf5Version")
def lib = file("$outsideDir/lib")
outputs.file "$rootDir/outside/lib/jarhdf5-${hdf5Version}.jar"
doLast() {
tmp.mkdirs()
// Use the SHA256 links at https://www.hdfgroup.org/downloads/hdf5/source-code/ to determine the URL.
providers.exec {
workingDir tmp
commandLine "curl", "--remote-name", "https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_5/downloads/hdf5-1.14.5.tar.gz"
}.result.get()
providers.exec {
workingDir tmp
commandLine "curl", "--remote-name", "https://support.hdfgroup.org/releases/hdf5/v1_14/v1_14_5/downloads/hdf5-1.14.5.sha256sums.txt"
}.result.get()
providers.exec {
workingDir tmp
commandLine "tar", "-xf", "hdf5-${hdf5Version}.tar.gz"
}.result.get()
providers.exec {
workingDir hdf5
commandLine "sh", "-c", "./configure --with-zlib=/usr --prefix=$outsideDir --enable-threadsafe --with-pthread=/usr --enable-unsupported --enable-java --with-java-prefix=$System.env.JAVA_HOME"
}.result.get()
providers.exec {
workingDir hdf5
commandLine "make"
}.result.get()
providers.exec {
workingDir hdf5
commandLine "make", "install"
}.result.get()
copy {
from("$tmp/lib") {
include "*.jar"
}
into "$lib"
}
}
}
task copyHdf5Lib(type: Copy, dependsOn: buildHdf5) {
from(file("$outsideDir/lib")) {
include "libhdf5*"
}
into "$buildDir/lib"
}
assemble.dependsOn copyHdf5Lib
task copyHdf5Libs(type: Copy, dependsOn: buildHdf5) {
from(file("$outsideDir/lib")) {
include "jarhdf5-*.jar"
}
into "$outsideGroupDir"
}
copyOutsideLibs.dependsOn copyHdf5Libs
task copyHdf5Inc(type: Copy, dependsOn: buildHdf5) {
from(file("$outsideDir/include")) {
include "*"
}
into "$buildDir/include"
}