mirror of
https://github.com/corda/corda.git
synced 2025-01-19 19:26:27 +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
|
||||
|
||||
libDir = "${buildDir}/lib"
|
||||
lzmaDir = "${libDir}/lzma"
|
||||
|
||||
buildOptions = ['', '-lzma']
|
||||
}
|
||||
|
||||
repositories {
|
||||
@ -110,11 +113,12 @@ model {
|
||||
}
|
||||
|
||||
tasks {
|
||||
buildOptions.each { buildOption ->
|
||||
platforms.each { platform ->
|
||||
if(platform.operatingSystem.name == "windows") {
|
||||
def artifactName = platform.architecture.name == "i386" ? 'win32' : 'win64'
|
||||
|
||||
task "extract${platform.name}"(type: Copy) {
|
||||
task "extract${platform.name}${buildOption}"(type: Copy) {
|
||||
from {
|
||||
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"
|
||||
args "platform=${platform.operatingSystem.name}",
|
||||
"arch=${platform.architecture.name}"
|
||||
|
||||
if(buildOption == "-lzma") {
|
||||
dependsOn 'extractLzma'
|
||||
args "lzma=${lzmaDir}"
|
||||
}
|
||||
|
||||
if(platform.operatingSystem.name == "windows") {
|
||||
dependsOn "extract${platform.name}"
|
||||
dependsOn "extract${platform.name}${buildOption}"
|
||||
args "win32=${libDir}/tools/win32",
|
||||
"win64=${libDir}/tools/win64"
|
||||
}
|
||||
@ -135,7 +145,8 @@ model {
|
||||
}
|
||||
|
||||
assemble {
|
||||
dependsOn "build${platform.name}"
|
||||
dependsOn "build${platform.name}${buildOption}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,6 +186,19 @@ jar {
|
||||
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 {
|
||||
dependsOn assemble, publish
|
||||
}
|
||||
@ -205,26 +229,27 @@ publishing {
|
||||
|
||||
def publishBinSuffix = currentPlatform == "windows" ? "exe" : "bin"
|
||||
def binSuffix = currentPlatform == "windows" ? ".exe" : ""
|
||||
artifact("${buildDir}/${currentPlatform}-${currentArch}/binaryToObject/binaryToObject") {
|
||||
artifact("${buildDir}/${currentPlatform}-${currentArch}/binaryToObject/binaryToObject${binSuffix}") {
|
||||
name "binaryToObject"
|
||||
type publishBinSuffix
|
||||
extension binSuffix
|
||||
extension publishBinSuffix
|
||||
}
|
||||
}
|
||||
|
||||
buildOptions.each { buildOption ->
|
||||
platforms.each { platform ->
|
||||
def binSuffix=""
|
||||
def publishBinSuffix="bin"
|
||||
|
||||
create(platform.name, IvyPublication) {
|
||||
def nativeBuildDir = "${buildDir}/${platform.operatingSystem.name}-${platform.architecture.name}"
|
||||
create("${platform.name}${buildOption}", IvyPublication) {
|
||||
def nativeBuildDir = "${buildDir}/${platform.operatingSystem.name}-${platform.architecture.name}${buildOption}"
|
||||
|
||||
if(platform.operatingSystem.name == "windows") {
|
||||
publishBinSuffix = "exe"
|
||||
binSuffix = ".${publishBinSuffix}"
|
||||
}
|
||||
|
||||
module "runtime-avian-${platform.name}"
|
||||
module "runtime-avian${buildOption}-${platform.name}"
|
||||
|
||||
artifact("${nativeBuildDir}/avian${binSuffix}") {
|
||||
name "avian"
|
||||
@ -237,6 +262,21 @@ publishing {
|
||||
type "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))
|
||||
|
||||
lzma-loader = $(build)/lzma/load.o
|
||||
|
||||
lzma-library = $(build)/libavian-lzma.a
|
||||
endif
|
||||
|
||||
generator-cpp-objects = \
|
||||
@ -1580,11 +1582,11 @@ test-args = $(test-flags) $(input)
|
||||
|
||||
.PHONY: build
|
||||
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) \
|
||||
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
||||
else
|
||||
build: $(static-library) $(dynamic-library) $(lzma-loader) \
|
||||
build: $(static-library) $(dynamic-library) $(lzma-library) \
|
||||
$(lzma-encoder) $(classpath-dep) $(test-dep) \
|
||||
$(test-extra-dep) $(embed) $(build)/classpath.jar
|
||||
endif
|
||||
@ -1914,6 +1916,21 @@ $(lzma-encoder-objects): $(build)/lzma/%.o: $(src)/lzma/%.cpp
|
||||
$(lzma-encoder): $(lzma-encoder-objects) $(lzma-encoder-lzma-objects)
|
||||
$(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
|
||||
$(compile-object)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user