1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
|
Description: bwa headers are got through a component tarball, not by
downloading anything.
Also loading the JNI from the canonical path.
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2022-03-30
--- a/src/main/java/org/broadinstitute/hellbender/utils/bwa/BwaMemIndex.java
+++ b/src/main/java/org/broadinstitute/hellbender/utils/bwa/BwaMemIndex.java
@@ -435,41 +435,7 @@
if ( !nativeLibLoaded ) {
synchronized(BwaMemIndex.class) {
if ( !nativeLibLoaded ) {
- final String libNameOverride = System.getProperty("LIBBWA_PATH");
- if ( libNameOverride != null ) {
- System.load(libNameOverride);
- }
- else {
- final String osName = System.getProperty("os.name", "unknown").toUpperCase();
- final String osArch = System.getProperty("os.arch");
- final String libName;
- if ( !"x86_64".equals(osArch) && !"amd64".equals(osArch) ) {
- throw new IllegalStateException(
- "We have pre-built fermi-lite binaries only for x86_64 and amd64. "+
- "Your os.arch is "+osArch+"."+
- "Set property LIBBWA_PATH to point to a native library for your architecture.");
- }
- if ( osName.startsWith("MAC") ) libName = "/libbwa.Darwin.dylib";
- else if ( osName.startsWith("LINUX") ) libName = "/libbwa.Linux.so";
- else {
- throw new IllegalStateException(
- "We have pre-built fermi-lite binaries only for Linux and Mac. "+
- "Your os.name is "+osName+"."+
- "Set property LIBBWA_PATH to point to a native library for your operating system.");
- }
- try ( final InputStream is = BwaMemIndex.class.getResourceAsStream(libName) ) {
- if ( is == null ) {
- throw new IllegalStateException("Can't find resource "+libName);
- }
- final File tmpFile = File.createTempFile("libbwa.",".jnilib");
- tmpFile.deleteOnExit();
- Files.copy(is, tmpFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
- System.load(tmpFile.getPath());
- }
- catch (IOException ioe ) {
- throw new IllegalStateException("Misconfiguration: Unable to load fermi-lite native library "+libName, ioe);
- }
- }
+ System.loadLibrary("bwa");
nativeLibLoaded = true;
}
}
--- a/src/main/c/org_broadinstitute_hellbender_utils_bwa_BwaMemIndex.c
+++ b/src/main/c/org_broadinstitute_hellbender_utils_bwa_BwaMemIndex.c
@@ -2,7 +2,6 @@
#include <fcntl.h>
#include <stdlib.h>
#include "jnibwa.h"
-#include "bwa/bwa_commit.h"
char * jstring_to_chars(JNIEnv* env, jstring in) {
--- a/src/main/c/Makefile
+++ b/src/main/c/Makefile
@@ -7,33 +7,26 @@
CC=gcc
#OS-dependent extension lookup
-UNAME := $(shell uname)
-ifeq ($(UNAME),Darwin)
-LIB_EXT=Darwin.dylib
-else
-LIB_EXT=Linux.so
-endif
+LIB_EXT=so
-BWA_MEM_COMMIT=cb950614ce7217788780b9a8d445c64cd4d8f62e
JNI_BASE_NAME=org_broadinstitute_hellbender_utils_bwa_BwaMemIndex
all: libbwa.$(LIB_EXT)
-libbwa.$(LIB_EXT): $(JNI_BASE_NAME).o jnibwa.o bwa/libbwa.a
+libbwa.$(LIB_EXT): $(JNI_BASE_NAME).o jnibwa.o bwaComponent/libbwa.a
$(CC) -ggdb -dynamiclib -shared -o $@ $^ -lm -lz -lpthread
-bwa:
- git clone https://github.com/lh3/bwa && cd bwa && git checkout $(BWA_MEM_COMMIT) && echo '#define BWA_COMMIT "'$(BWA_MEM_COMMIT)'"' > bwa_commit.h
- sed -i.bak -e's/\(LOBJS=.*\)/\1 bwtindex.o rle.o rope.o bwt.o is.o/g' bwa/Makefile
+bwaComponent:
+ sed -i.bak -e's/\(LOBJS=.*\)/\1 bwtindex.o rle.o rope.o bwt.o is.o/g' bwaComponent/Makefile
-bwa/libbwa.a: bwa
- $(MAKE) CFLAGS="$(CFLAGS)" -C bwa libbwa.a
+bwaComponent/libbwa.a: bwaComponent
+ $(MAKE) CFLAGS="$(CFLAGS)" -C bwaComponent libbwa.a
-$(JNI_BASE_NAME).o: $(JNI_BASE_NAME).c jnibwa.h bwa
+$(JNI_BASE_NAME).o: $(JNI_BASE_NAME).c jnibwa.h bwaComponent
-jnibwa.o: jnibwa.c jnibwa.h bwa
+jnibwa.o: jnibwa.c jnibwa.h bwaComponent
clean:
- rm -rf bwa *.o *.$(LIB_EXT)
+ rm -rf bwaComponent *.o *.$(LIB_EXT)
.PHONY: all clean
--- a/src/main/c/jnibwa.c
+++ b/src/main/c/jnibwa.c
@@ -15,12 +15,12 @@
#include <errno.h>
#include "jnibwa.h"
-#include "bwa/kstring.h"
-#include "bwa/bntseq.h"
-#include "bwa/bwt.h"
-#include "bwa/utils.h"
-#include "bwa/rle.h"
-#include "bwa/rope.h"
+#include "bwaComponent/kstring.h"
+#include "bwaComponent/bntseq.h"
+#include "bwaComponent/bwt.h"
+#include "bwaComponent/utils.h"
+#include "bwaComponent/rle.h"
+#include "bwaComponent/rope.h"
static inline void kput32( int32_t val, kstring_t* str ) {
--- a/src/main/c/jnibwa.h
+++ b/src/main/c/jnibwa.h
@@ -5,7 +5,7 @@
#ifndef JNIBWA_H_
#define JNIBWA_H_
-#include "bwa/bwamem.h"
+#include "bwaComponent/bwamem.h"
int jnibwa_createReferenceIndex( char const* refFileName, char const* indexPrefix, char const* algoName);
|