--- config/freebsd/build.xml.orig	2026-07-13 17:21:04 UTC
+++ config/freebsd/build.xml
@@ -145,6 +145,7 @@
                 <arg value="-I${src.main.rel}/libffi"/>
                 <arg value="-I${src.main.rel}/libffi/aarch64" if:set="build.arch.arm64"/>
                 <arg value="-I${src.main.rel}/libffi/arm" if:set="build.arch.arm32"/>
+                <arg value="-I${src.main.rel}/libffi/ppc64le" if:set="build.arch.ppc64le"/>
                 <arg value="-I${src.main.rel}/libffi/x86" if:set="build.arch.x64|x86"/>
                 <!-- for libffi/x86/ffitarget.h -->
                 <arg value="-DX86_64" if:set="build.arch.x64"/>
@@ -156,16 +157,18 @@
                     <include name="${module.lwjgl}/jawt/src/generated/c/*.c" if:true="${binding.jawt}"/>
                 </fileset>
             </source>
-            <beforeLink>
+            <beforeLink unless:true="${use.libffi.so}">
                 <parallel threadsPerProcessor="2" failonany="true" unless:set="lib-dependencies-uptodate">
                     <update-dependency module="core" artifact="core/libffi.a"/>
                 </parallel>
             </beforeLink>
             <link>
-                <fileset dir="${lib.native}/org/lwjgl">
+                <fileset dir="${lib.native}/org/lwjgl" unless:true="${use.libffi.so}">
                     <include name="libffi.a"/>
                 </fileset>
                 <arg value="-ldl"/>
+                <arg value="-lffi" if:true="${use.libffi.so}"/>
+                <arg value="-L${libffi.path}" if:set="libffi.path"/>
             </link>
         </build>
 
@@ -383,7 +386,7 @@
         </build>
 
         <!-- zstd -->
-        <build module="zstd" simple="true" if:true="${binding.zstd}">
+        <build module="zstd" simple="true" flags="-Wno-deprecated-declarations" if:true="${binding.zstd}">
             <beforeCompile>
                 <compile flags="-DZSTD_MULTITHREAD">
                     <arg value="-I${module.lwjgl.rel}/xxhash/src/main/c"/>
