Skip to content

Commit

Permalink
[modules] Update Liblouis to support Apple Silicon (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
bertfrees committed May 1, 2024
1 parent 0e6e8a9 commit bc89514
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
6 changes: 3 additions & 3 deletions modules/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>braille-common</artifactId>
<version>4.0.1-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand Down Expand Up @@ -85,7 +85,7 @@
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>liblouis-utils</artifactId>
<version>6.1.1-SNAPSHOT</version>
<version>6.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand All @@ -97,7 +97,7 @@
<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>liblouis-utils</artifactId>
<classifier>mac</classifier>
<version>6.0.2</version>
<version>6.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.daisy.pipeline.modules.braille</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/braille/braille-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>braille-common</artifactId>
<version>4.0.1-SNAPSHOT</version>
<version>4.1.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>DP2 Braille Modules :: braille-common</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* - macosx/x86/bar
* - macosx/x86_64/foo.dylib
* - macosx/x86_64/bar
* - macosx/aarch64/foo.dylib
* - macosx/aarch64/bar
* - windows/x86/foo.dll
* - windows/x86/bar.exe
* - windows/x86_64/foo.dll
Expand Down Expand Up @@ -70,7 +72,10 @@ else if ((path = getSharedLibrary(name)) != null) {}
private URI getExecutable(String name) {
String fileName = OS.isWindows() ? name + ".exe" : name;
String os = OS.getFamily().toString().toLowerCase();
String arch = OS.is64Bit() ? "x86_64" : "x86";
String arch = OS.getArch();
if (!OS.is64Bit()) arch = "x86";
else if ("amd64".equals()) arch = "x86_64";
else if ("arm64".equals()) arch = "aarch64";
List<URI> possiblePaths = new ArrayList<URI>();
possiblePaths.add(asURI(arch + "/" + fileName));
possiblePaths.add(asURI(os + "/" + arch + "/" + fileName));
Expand All @@ -87,7 +92,10 @@ private URI getExecutable(String name) {
private URI getSharedLibrary(String name) {
String fileName = name + (OS.isWindows() ? ".dll" : OS.isMacOSX() ? ".dylib" : ".so");
String os = OS.getFamily().toString().toLowerCase();
String arch = OS.is64Bit() ? "x86_64" : "x86";
String arch = OS.getArch();
if (!OS.is64Bit()) arch = "x86";
else if ("amd64".equals()) arch = "x86_64";
else if ("arm64".equals()) arch = "aarch64";
List<URI> possiblePaths = new ArrayList<URI>();
possiblePaths.add(asURI(arch + "/" + fileName));
possiblePaths.add(asURI(os + "/" + arch + "/" + fileName));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,10 @@ public static String getArch() {
}

public static boolean is64Bit() {
return getArch().equals("amd64") || getArch().equals("x86_64");
return getArch().equals("amd64")
|| getArch().equals("x86_64")
|| getArch().equals("aarch64")
|| getArch().equals("arm64");
}
}

Expand Down
13 changes: 8 additions & 5 deletions modules/braille/liblouis-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>org.daisy.pipeline.modules.braille</groupId>
<artifactId>liblouis-utils</artifactId>
<version>6.1.1-SNAPSHOT</version>
<version>6.2.0-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>DP2 Braille Modules :: liblouis-utils</name>
Expand Down Expand Up @@ -186,6 +186,10 @@
<directory>${project.build.directory}/generated-resources/native/liblouis/x86_64-MacOSX-gpp/</directory>
<targetPath>native/macosx/x86_64/</targetPath>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources/native/liblouis/aarch64-MacOSX-gpp/</directory>
<targetPath>native/macosx/aarch64/</targetPath>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources/native/liblouisutdml/i386-MacOSX-gpp/</directory>
<targetPath>native/macosx/x86/liblouisutdml/</targetPath>
Expand Down Expand Up @@ -232,18 +236,16 @@
<classifier>amd64-Linux-gpp-shared</classifier>
<type>nar</type>
</artifactItem>
<!--
<artifactItem>
<groupId>org.liblouis</groupId>
<artifactId>louis</artifactId>
<classifier>i386-MacOSX-gpp-shared</classifier>
<classifier>x86_64-MacOSX-gpp-shared</classifier>
<type>nar</type>
</artifactItem>
-->
<artifactItem>
<groupId>org.liblouis</groupId>
<artifactId>louis</artifactId>
<classifier>x86_64-MacOSX-gpp-shared</classifier>
<classifier>aarch64-MacOSX-gpp-shared</classifier>
<type>nar</type>
</artifactItem>
<artifactItem>
Expand Down Expand Up @@ -537,6 +539,7 @@
META-INF/services/org.daisy.pipeline.braille.common.NativePath;literal
='org.daisy.pipeline.braille.liblouis.impl.mac.LiblouisNativePathForMacOS_SPI',
native/macosx/x86_64=target/generated-resources/native/liblouis/x86_64-MacOSX-gpp,
native/macosx/aarch64=target/generated-resources/native/liblouis/aarch64-MacOSX-gpp,
native/macosx/x86/liblouisutdml=target/generated-resources/native/liblouisutdml/i386-MacOSX-gpp,
native/macosx/x86_64/liblouisutdml=target/generated-resources/native/liblouisutdml/x86_64-MacOSX-gpp
</Include-Resource>
Expand Down

0 comments on commit bc89514

Please sign in to comment.