mirror of
https://github.com/corda/corda.git
synced 2025-02-01 00:45:59 +00:00
Merge pull request #428 from ReadyTalk/sgoings
add support for LZMA-enabled artifacts
This commit is contained in:
commit
b6ed0e9473
58
build.gradle
58
build.gradle
@ -71,6 +71,9 @@ ext {
|
|||||||
java_home = java_home
|
java_home = java_home
|
||||||
|
|
||||||
libDir = "${buildDir}/lib"
|
libDir = "${buildDir}/lib"
|
||||||
|
lzmaDir = "${libDir}/lzma"
|
||||||
|
|
||||||
|
buildOptions = ['', '-lzma']
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -110,11 +113,12 @@ model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
|
buildOptions.each { buildOption ->
|
||||||
platforms.each { platform ->
|
platforms.each { platform ->
|
||||||
if(platform.operatingSystem.name == "windows") {
|
if(platform.operatingSystem.name == "windows") {
|
||||||
def artifactName = platform.architecture.name == "i386" ? 'win32' : 'win64'
|
def artifactName = platform.architecture.name == "i386" ? 'win32' : 'win64'
|
||||||
|
|
||||||
task "extract${platform.name}"(type: Copy) {
|
task "extract${platform.name}${buildOption}"(type: Copy) {
|
||||||
from {
|
from {
|
||||||
tarTree(configurations."${platform.name}".find { it.name =~ artifactName })
|
tarTree(configurations."${platform.name}".find { it.name =~ artifactName })
|
||||||
}
|
}
|
||||||
@ -122,12 +126,18 @@ model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task "build${platform.name}"(type: Exec) {
|
task "build${platform.name}${buildOption}"(type: Exec) {
|
||||||
executable "make"
|
executable "make"
|
||||||
args "platform=${platform.operatingSystem.name}",
|
args "platform=${platform.operatingSystem.name}",
|
||||||
"arch=${platform.architecture.name}"
|
"arch=${platform.architecture.name}"
|
||||||
|
|
||||||
|
if(buildOption == "-lzma") {
|
||||||
|
dependsOn 'extractLzma'
|
||||||
|
args "lzma=${lzmaDir}"
|
||||||
|
}
|
||||||
|
|
||||||
if(platform.operatingSystem.name == "windows") {
|
if(platform.operatingSystem.name == "windows") {
|
||||||
dependsOn "extract${platform.name}"
|
dependsOn "extract${platform.name}${buildOption}"
|
||||||
args "win32=${libDir}/tools/win32",
|
args "win32=${libDir}/tools/win32",
|
||||||
"win64=${libDir}/tools/win64"
|
"win64=${libDir}/tools/win64"
|
||||||
}
|
}
|
||||||
@ -135,7 +145,8 @@ model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assemble {
|
assemble {
|
||||||
dependsOn "build${platform.name}"
|
dependsOn "build${platform.name}${buildOption}"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -175,6 +186,19 @@ jar {
|
|||||||
baseName "classpath-avian"
|
baseName "classpath-avian"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task downloadLzma(type: Exec) {
|
||||||
|
commandLine "curl"
|
||||||
|
args "--create-dirs", "-o", "${lzmaDir}/lzma920.tar.bz2", "-f", "http://oss.readytalk.com/avian-web/lzma920.tar.bz2"
|
||||||
|
}
|
||||||
|
|
||||||
|
task extractLzma(type: Copy) {
|
||||||
|
dependsOn downloadLzma
|
||||||
|
from {
|
||||||
|
tarTree(resources.bzip2("${lzmaDir}/lzma920.tar.bz2"))
|
||||||
|
}
|
||||||
|
into lzmaDir
|
||||||
|
}
|
||||||
|
|
||||||
task install {
|
task install {
|
||||||
dependsOn assemble, publish
|
dependsOn assemble, publish
|
||||||
}
|
}
|
||||||
@ -205,26 +229,27 @@ publishing {
|
|||||||
|
|
||||||
def publishBinSuffix = currentPlatform == "windows" ? "exe" : "bin"
|
def publishBinSuffix = currentPlatform == "windows" ? "exe" : "bin"
|
||||||
def binSuffix = currentPlatform == "windows" ? ".exe" : ""
|
def binSuffix = currentPlatform == "windows" ? ".exe" : ""
|
||||||
artifact("${buildDir}/${currentPlatform}-${currentArch}/binaryToObject/binaryToObject") {
|
artifact("${buildDir}/${currentPlatform}-${currentArch}/binaryToObject/binaryToObject${binSuffix}") {
|
||||||
name "binaryToObject"
|
name "binaryToObject"
|
||||||
type publishBinSuffix
|
type publishBinSuffix
|
||||||
extension binSuffix
|
extension publishBinSuffix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buildOptions.each { buildOption ->
|
||||||
platforms.each { platform ->
|
platforms.each { platform ->
|
||||||
def binSuffix=""
|
def binSuffix=""
|
||||||
def publishBinSuffix="bin"
|
def publishBinSuffix="bin"
|
||||||
|
|
||||||
create(platform.name, IvyPublication) {
|
create("${platform.name}${buildOption}", IvyPublication) {
|
||||||
def nativeBuildDir = "${buildDir}/${platform.operatingSystem.name}-${platform.architecture.name}"
|
def nativeBuildDir = "${buildDir}/${platform.operatingSystem.name}-${platform.architecture.name}${buildOption}"
|
||||||
|
|
||||||
if(platform.operatingSystem.name == "windows") {
|
if(platform.operatingSystem.name == "windows") {
|
||||||
publishBinSuffix = "exe"
|
publishBinSuffix = "exe"
|
||||||
binSuffix = ".${publishBinSuffix}"
|
binSuffix = ".${publishBinSuffix}"
|
||||||
}
|
}
|
||||||
|
|
||||||
module "runtime-avian-${platform.name}"
|
module "runtime-avian${buildOption}-${platform.name}"
|
||||||
|
|
||||||
artifact("${nativeBuildDir}/avian${binSuffix}") {
|
artifact("${nativeBuildDir}/avian${binSuffix}") {
|
||||||
name "avian"
|
name "avian"
|
||||||
@ -237,6 +262,21 @@ publishing {
|
|||||||
type "a"
|
type "a"
|
||||||
extension "a"
|
extension "a"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (buildOption == "-lzma") {
|
||||||
|
artifact("${nativeBuildDir}/libavian-lzma.a") {
|
||||||
|
name "libavian-lzma"
|
||||||
|
type "a"
|
||||||
|
extension "a"
|
||||||
|
}
|
||||||
|
|
||||||
|
artifact("${nativeBuildDir}/lzma/lzma${binSuffix}") {
|
||||||
|
name "lzma"
|
||||||
|
type publishBinSuffix
|
||||||
|
extension publishBinSuffix
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
21
makefile
21
makefile
@ -1403,6 +1403,8 @@ ifneq ($(lzma),)
|
|||||||
$(call generator-c-objects,$(lzma-encoder-lzma-sources),$(lzma)/C,$(build))
|
$(call generator-c-objects,$(lzma-encoder-lzma-sources),$(lzma)/C,$(build))
|
||||||
|
|
||||||
lzma-loader = $(build)/lzma/load.o
|
lzma-loader = $(build)/lzma/load.o
|
||||||
|
|
||||||
|
lzma-library = $(build)/libavian-lzma.a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
generator-cpp-objects = \
|
generator-cpp-objects = \
|
||||||
@ -1580,11 +1582,11 @@ test-args = $(test-flags) $(input)
|
|||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
ifneq ($(supports_avian_executable),false)
|
ifneq ($(supports_avian_executable),false)
|
||||||
build: $(static-library) $(executable) $(dynamic-library) $(lzma-loader) \
|
build: $(static-library) $(executable) $(dynamic-library) $(lzma-library) \
|
||||||
$(lzma-encoder) $(executable-dynamic) $(classpath-dep) $(test-dep) \
|
$(lzma-encoder) $(executable-dynamic) $(classpath-dep) $(test-dep) \
|
||||||
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
||||||
else
|
else
|
||||||
build: $(static-library) $(dynamic-library) $(lzma-loader) \
|
build: $(static-library) $(dynamic-library) $(lzma-library) \
|
||||||
$(lzma-encoder) $(classpath-dep) $(test-dep) \
|
$(lzma-encoder) $(classpath-dep) $(test-dep) \
|
||||||
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
||||||
endif
|
endif
|
||||||
@ -1914,6 +1916,21 @@ $(lzma-encoder-objects): $(build)/lzma/%.o: $(src)/lzma/%.cpp
|
|||||||
$(lzma-encoder): $(lzma-encoder-objects) $(lzma-encoder-lzma-objects)
|
$(lzma-encoder): $(lzma-encoder-objects) $(lzma-encoder-lzma-objects)
|
||||||
$(build-cc) $(^) -g -o $(@)
|
$(build-cc) $(^) -g -o $(@)
|
||||||
|
|
||||||
|
$(lzma-library): $(lzma-loader) $(lzma-decode-objects)
|
||||||
|
@echo "creating $(@)"
|
||||||
|
@rm -rf $(build)/libavian-lzma
|
||||||
|
@mkdir -p $(build)/libavian-lzma
|
||||||
|
rm -rf $(@)
|
||||||
|
for x in $(^); \
|
||||||
|
do cp $${x} $(build)/libavian-lzma/$$(echo $${x} | sed s:/:_:g); \
|
||||||
|
done
|
||||||
|
ifdef ms_cl_compiler
|
||||||
|
$(ar) $(arflags) $(build)/libavian-lzma/*.o -out:$(@)
|
||||||
|
else
|
||||||
|
$(ar) cru $(@) $(build)/libavian-lzma/*.o
|
||||||
|
$(ranlib) $(@)
|
||||||
|
endif
|
||||||
|
|
||||||
$(lzma-loader): $(src)/lzma/load.cpp
|
$(lzma-loader): $(src)/lzma/load.cpp
|
||||||
$(compile-object)
|
$(compile-object)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user