Skip to content

Commit

Permalink
Merge pull request #1302 from stephan57160/master
Browse files Browse the repository at this point in the history
Problem: Compilation fails on CentOS, due to duplicate lib entry.
  • Loading branch information
bluca authored Sep 19, 2022
2 parents 4d393c8 + 807dd84 commit 7f7944e
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions zproject_java.gsl
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,7 @@ dependencies {
// Build section

task copyLibs(type: Copy) {
def libraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList()
libraryPaths.add('/usr/local/lib')
if (osdetector.os == 'windows') {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build/Release")
} else {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build")
}
def libraryPaths = []
if (project.hasProperty('buildPrefix')) {
if (osdetector.os == 'windows') {
// DLLs are installed to the bin directory by cmake
Expand All @@ -447,6 +441,18 @@ task copyLibs(type: Copy) {
libraryPaths.add("${project.buildPrefix}/lib")
}

def javaLibraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList()
libraryPaths.addAll (javaLibraryPaths)

libraryPaths.add('/usr/local/lib')
if (osdetector.os == 'windows') {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build/Release")
} else {
libraryPaths.add("${rootDir}/$(project.prefix:c)-jni/build")
}

def oldStrategy = duplicatesStrategy
duplicatesStrategy = DuplicatesStrategy.WARN
libraryPaths.each { path ->
from path
include '$(project.libname)jni.so'
Expand All @@ -462,6 +468,7 @@ task copyLibs(type: Copy) {
. endfor
into 'build/natives'
}
duplicatesStrategy = oldStrategy
}

jar.baseName = "$(project.prefix:c)-jni-${osdetector.classifier}"
Expand Down

0 comments on commit 7f7944e

Please sign in to comment.