You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-9Lines changed: 80 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,56 @@ jpostal
5
5
6
6
These are the Java/JNI bindings to [libpostal](https://github.com/openvenues/libpostal), a fast, multilingual NLP library (written in C) for parsing/normalizing physical addresses around the world.
7
7
8
+
## Automatic Platform Detection
9
+
10
+
This library automatically detects your platform and loads the correct native libraries at runtime. Simply add the dependency - no platform specification required!
AddressExpander e =AddressExpander.getInstanceDataDir("/some/path");
43
86
AddressParser p =AddressParser.getInstanceDataDir("/some/path");
44
87
```
45
88
46
-
Building libpostal
47
-
------------------
89
+
Building Platform-Specific JARs
90
+
--------------------------------
91
+
92
+
This project uses a matrix build system to create platform-specific JARs. Each JAR contains:
93
+
94
+
1.**Pre-built libpostal native libraries** for the target platform (from `libs/libpostal/`)
95
+
2.**JNI bindings** built by Gradle for the target platform
96
+
97
+
### Local Development
98
+
99
+
For local development on your current platform:
100
+
```bash
101
+
./gradlew clean build
102
+
```
103
+
104
+
### Cross-Platform Building
105
+
106
+
To build for a specific platform (useful in CI):
107
+
```bash
108
+
TARGET_OS=linux TARGET_ARCH=x86_64 ./gradlew clean jar -x test
109
+
TARGET_OS=linux TARGET_ARCH=aarch64 ./gradlew clean jar -x test
110
+
TARGET_OS=macos TARGET_ARCH=aarch64 ./gradlew clean jar -x test
111
+
```
112
+
113
+
### GitHub Actions Matrix Build
114
+
115
+
The project includes a GitHub Actions workflow that automatically builds JARs for all supported platforms when you create a release tag.
116
+
117
+
Building libpostal (Development)
118
+
-------------------------------
48
119
49
-
Before building the Java bindings, you must install the libpostal C library. Make sure you have the following prerequisites:
120
+
For development purposes, you may want to build libpostal from source. Make sure you have the following prerequisites:
50
121
51
122
**On Ubuntu/Debian**
52
123
```
@@ -95,15 +166,15 @@ This will leverage gradle's NativeLibrarySpec support to build for the JNI/C por
95
166
Usage in a Java project
96
167
-----------------------
97
168
98
-
The JNI portion of jpostal builds shared object files (.so on Linux, .jniLib on Mac) that need to be on java.library.path.
169
+
The JNI portion of jpostal builds shared object files (.so on Linux, .jniLib on Mac) that need to be on java.library.path.
99
170
After running ```gradle assemble``` the .so/.jniLib files can be found under ```./libs/jpostal/shared``` in the build dir. For running the tests, we set java.library.path explicitly [here](https://github.com/Qualytics/jpostal/blob/master/build.gradle#L63).
100
171
101
172
102
173
Compatibility
103
174
-------------
104
175
105
176
- Building jpostal is known to work on Linux and Mac OSX (including Mac silicon).
106
-
- Requires JDK 16 or later. Make sure JAVA_HOME points to JDK 16+.
177
+
- Requires JDK 16 or later. Make sure JAVA_HOME points to JDK 16+.
0 commit comments