Skip to content

Commit

Permalink
Introduce linux-arm64 to presets for libpostal
Browse files Browse the repository at this point in the history
  • Loading branch information
MasseGuillaume committed Jul 26, 2022
1 parent f61b397 commit 60aba1e
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 5 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/libpostal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
container: centos:7
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-centos@actions
linux-arm64:
runs-on: ubuntu-18.04
container: ubuntu:bionic
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
macosx-x86_64:
runs-on: macos-10.15
steps:
Expand All @@ -29,7 +34,7 @@ jobs:
steps:
- uses: bytedeco/javacpp-presets/.github/actions/deploy-windows@actions
redeploy:
needs: [linux-x86_64, macosx-x86_64, windows-x86_64]
needs: [linux-x86_64, linux-arm64, macosx-x86_64, windows-x86_64]
runs-on: ubuntu-18.04
steps:
- uses: bytedeco/javacpp-presets/.github/actions/redeploy@actions
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ jobs:
env: PROJ=fftw,gsl OS=android-arm64
install: true
script: ./ci/install-travis.sh
- os: linux
env: PROJ=libpostal OS=linux-arm64
install: true
script: ./ci/install-arm.sh
- os: linux
env: PROJ=leptonica,tesseract OS=android-arm64
install: true
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Introduce `linux-arm64` to presets for libpostal
* Map missing factory functions in `torch::` namespace using `torch_` as prefix in presets for PyTorch ([issue #1197](https://github.com/bytedeco/javacpp-presets/issues/1197))
* Add presets for the nvJPEG module of CUDA ([issue #1193](https://github.com/bytedeco/javacpp-presets/issues/1193))
* Introduce Android builds for TensorFlow Lite ([discussion #1180](https://github.com/bytedeco/javacpp-presets/discussions/1180))
Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,25 @@ With the above in working order, the scripts get launched automatically as part
```bash
$ ANDROID_NDK=/path/to/android-ndk/ bash cppbuild.sh [-platform <name>] [-extension <name>] <install | clean> [projects]
```
where possible platform names are: `android-arm`, `android-x86`, `linux-x86`, `linux-x86_64`, `linux-armhf`, `linux-ppc64le`, `linux-mips64el`, `macosx-x86_64`, `windows-x86`, `windows-x86_64`, etc. The `-gpu` extension as supported by some builds also require CUDA to be installed. (The `ANDROID_NDK` variable is required only for Android builds.) Please note that the scripts download source archives from appropriate sites as necessary.
where possible platform names are:

* `android-arm`
* `android-arm64`
* `android-x86`
* `android-x86_64`
* `ios-arm64`
* `ios-x86_64`
* `linux-arm64`
* `linux-armhf`
* `linux-ppc64le`
* `linux-x86`
* `linux-x86_64`
* `macosx-arm64`
* `macosx-x86_64`
* `windows-x86`
* `windows-x86_64`

The `-gpu` extension as supported by some builds also require CUDA to be installed. (The `ANDROID_NDK` variable is required only for Android builds.) Please note that the scripts download source archives from appropriate sites as necessary.

To compile binaries for an Android device with no FPU, first make sure this is what you want. Without FPU, the performance of either OpenCV or FFmpeg is bound to be unacceptable. If you still wish to continue down that road, then replace "armeabi-v7a" by "armeabi" and "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16" with "-march=armv5te -mtune=xscale -msoft-float", inside various files.

Expand Down
9 changes: 8 additions & 1 deletion libpostal/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ -z "$PLATFORM" ]]; then
fi

LIBPOSTAL_VERSION=1.1
download https://github.com/openvenues/libpostal/archive/v$LIBPOSTAL_VERSION.tar.gz libpostal-$LIBPOSTAL_VERSION.tar.gz
download https://github.com/openvenues/libpostal/archive/refs/tags/v$LIBPOSTAL_VERSION.tar.gz libpostal-$LIBPOSTAL_VERSION.tar.gz

mkdir -p $PLATFORM
cd $PLATFORM
Expand All @@ -33,6 +33,13 @@ case $PLATFORM in
make -j $MAKEJ V=0
make install
;;
linux-arm64)
./bootstrap.sh
./configure --prefix=$INSTALL_PATH --disable-data-download --disable-sse2 --host=aarch64-linux-gnu
#./configure --prefix=$INSTALL_PATH --datadir=[...some dir with a few GB of space...]
make -j $MAKEJ V=0
make install
;;
macosx-*)
./bootstrap.sh
sed -i="" 's/-install_name \\$rpath/-install_name @rpath/g' configure
Expand Down
9 changes: 8 additions & 1 deletion libpostal/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-x86_64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
<version>${project.version}</version>
<classifier>${javacpp.platform.linux-arm64}</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand All @@ -60,7 +66,7 @@
<configuration>
<archive>
<manifestEntries>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-macosx-x86_64.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path>
</manifestEntries>
</archive>
</configuration>
Expand Down Expand Up @@ -105,6 +111,7 @@
<file>${project.build.directory}/${project.artifactId}.jar</file>
<moduleInfoSource>
module org.bytedeco.${javacpp.moduleId}.platform {
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64;
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.macosx.x86_64;
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
inherit = javacpp.class,
value = {
@Platform(
value = {"linux-x86_64", "macosx-x86_64", "windows-x86_64"},
value = {"linux-x86_64", "linux-arm64", "macosx-x86_64", "windows-x86_64"},
cinclude = "libpostal/libpostal.h",
link = "postal@.1",
preload = "libpostal-1"
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@
<module>llvm</module>
<module>libffi</module>
<module>leptonica</module>
<module>libpostal</module>
<module>tesseract</module>
<module>cuda</module>
<module>nvcodec</module>
Expand Down

0 comments on commit 60aba1e

Please sign in to comment.