From b64b7f1c7b2bec363661b75de55ab518744495ea Mon Sep 17 00:00:00 2001
From: kasperk81 <83082615+kasperk81@users.noreply.github.com>
Date: Thu, 12 Sep 2024 20:54:57 +0300
Subject: [PATCH] add support for riscv64

---
 gen_lib_nuspecs/Program.cs                          | 13 ++++++++-----
 .../SQLitePCLRaw.lib.e_sqlcipher.nuspec             |  3 +++
 .../net461/SQLitePCLRaw.lib.e_sqlcipher.targets     |  5 +++++
 .../SQLitePCLRaw.lib.e_sqlite3.nuspec               |  3 +++
 .../net461/SQLitePCLRaw.lib.e_sqlite3.targets       |  5 +++++
 5 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/gen_lib_nuspecs/Program.cs b/gen_lib_nuspecs/Program.cs
index aabbeb24..84588b76 100644
--- a/gen_lib_nuspecs/Program.cs
+++ b/gen_lib_nuspecs/Program.cs
@@ -411,15 +411,16 @@ XmlWriter f
         write_nuspec_file_entry_native_linux(lib, "armhf", "linux-arm", f);
         write_nuspec_file_entry_native_linux(lib, "armsf", "linux-armel", f);
         write_nuspec_file_entry_native_linux(lib, "arm64", "linux-arm64", f);
+        write_nuspec_file_entry_native_linux(lib, "s390x", "linux-s390x", f);
+        write_nuspec_file_entry_native_linux(lib, "riscv64", "linux-riscv64", f);
+        write_nuspec_file_entry_native_linux(lib, "mips64", "linux-mips64", f);
+        write_nuspec_file_entry_native_linux(lib, "ppc64le", "linux-ppc64le", f);
 
         write_nuspec_file_entry_native_linux(lib, "musl-x64", "linux-musl-x64", f);
         write_nuspec_file_entry_native_linux(lib, "musl-armhf", "linux-musl-arm", f);
         write_nuspec_file_entry_native_linux(lib, "musl-arm64", "linux-musl-arm64", f);
         write_nuspec_file_entry_native_linux(lib, "musl-s390x", "linux-musl-s390x", f);
-
-        write_nuspec_file_entry_native_linux(lib, "mips64", "linux-mips64", f);
-        write_nuspec_file_entry_native_linux(lib, "s390x", "linux-s390x", f);
-        write_nuspec_file_entry_native_linux(lib, "ppc64le", "linux-ppc64le", f);
+        write_nuspec_file_entry_native_linux(lib, "musl-riscv64", "linux-musl-riscv64", f);
 
         write_nuspec_file_entry_native_wasm(lib, TFM.NET60, f);
         write_nuspec_file_entry_native_wasm(lib, TFM.NET70, f);
@@ -757,7 +758,8 @@ private static void gen_nuget_props(string dest, WhichLib lib)
             write_nuget_prop_item("linux-x64", lib, f);
             write_nuget_prop_item("linux-mips64", lib, f);
             write_nuget_prop_item("linux-s390x", lib, f);
-	    write_nuget_prop_item("linux-ppc64le", lib, f);
+            write_nuget_prop_item("linux-ppc64le", lib, f);
+            write_nuget_prop_item("linux-riscv64", lib, f);
             f.WriteEndElement(); // PropertyGroup
 
             f.WriteEndElement(); // Project
@@ -806,6 +808,7 @@ private static void gen_nuget_targets(string dest, WhichLib lib)
             write_nuget_target_item("linux-x64", lib, f);
             write_nuget_target_item("linux-mips64", lib, f);
             write_nuget_target_item("linux-s390x", lib, f);
+            write_nuget_target_item("linux-riscv64", lib, f);
             f.WriteEndElement(); // ItemGroup
 
             f.WriteEndElement(); // Project
diff --git a/src/SQLitePCLRaw.lib.e_sqlcipher/SQLitePCLRaw.lib.e_sqlcipher.nuspec b/src/SQLitePCLRaw.lib.e_sqlcipher/SQLitePCLRaw.lib.e_sqlcipher.nuspec
index fb0cd834..7cffc26e 100644
--- a/src/SQLitePCLRaw.lib.e_sqlcipher/SQLitePCLRaw.lib.e_sqlcipher.nuspec
+++ b/src/SQLitePCLRaw.lib.e_sqlcipher/SQLitePCLRaw.lib.e_sqlcipher.nuspec
@@ -35,9 +35,12 @@
     <file src="$cb_bin_path$\e_sqlcipher\linux\musl-x64\libe_sqlcipher.so" target="runtimes\linux-musl-x64\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\linux\musl-armhf\libe_sqlcipher.so" target="runtimes\linux-musl-arm\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\linux\musl-arm64\libe_sqlcipher.so" target="runtimes\linux-musl-arm64\native\libe_sqlcipher.so" />
+    <file src="$cb_bin_path$\e_sqlcipher\linux\musl-s390x\libe_sqlcipher.so" target="runtimes\linux-musl-s390x\native\libe_sqlcipher.so" />
+    <file src="$cb_bin_path$\e_sqlcipher\linux\musl-riscv64\libe_sqlcipher.so" target="runtimes\linux-musl-riscv64\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\linux\mips64\libe_sqlcipher.so" target="runtimes\linux-mips64\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\linux\s390x\libe_sqlcipher.so" target="runtimes\linux-s390x\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\linux\ppc64le\libe_sqlcipher.so" target="runtimes\linux-ppc64le\native\libe_sqlcipher.so" />
+    <file src="$cb_bin_path$\e_sqlcipher\linux\riscv64\libe_sqlcipher.so" target="runtimes\linux-riscv64\native\libe_sqlcipher.so" />
     <file src="$cb_bin_path$\e_sqlcipher\wasm\net6.0\e_sqlcipher.a" target="runtimes\browser-wasm\nativeassets\net6.0\e_sqlcipher.a" />
     <file src="$cb_bin_path$\e_sqlcipher\wasm\net7.0\e_sqlcipher.a" target="runtimes\browser-wasm\nativeassets\net7.0\e_sqlcipher.a" />
     <file src="$cb_bin_path$\e_sqlcipher\wasm\net8.0\e_sqlcipher.a" target="runtimes\browser-wasm\nativeassets\net8.0\e_sqlcipher.a" />
diff --git a/src/SQLitePCLRaw.lib.e_sqlcipher/net461/SQLitePCLRaw.lib.e_sqlcipher.targets b/src/SQLitePCLRaw.lib.e_sqlcipher/net461/SQLitePCLRaw.lib.e_sqlcipher.targets
index 9dccc243..54a495af 100644
--- a/src/SQLitePCLRaw.lib.e_sqlcipher/net461/SQLitePCLRaw.lib.e_sqlcipher.targets
+++ b/src/SQLitePCLRaw.lib.e_sqlcipher/net461/SQLitePCLRaw.lib.e_sqlcipher.targets
@@ -66,5 +66,10 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <Pack>false</Pack>
     </Content>
+    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libe_sqlcipher.so">
+      <Link>runtimes\linux-riscv64\native\libe_sqlcipher.so</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      <Pack>false</Pack>
+    </Content>
   </ItemGroup>
 </Project>
\ No newline at end of file
diff --git a/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec b/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec
index 9c75ebdd..dff1bef4 100644
--- a/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec
+++ b/src/SQLitePCLRaw.lib.e_sqlite3/SQLitePCLRaw.lib.e_sqlite3.nuspec
@@ -35,8 +35,11 @@
     <file src="$cb_bin_path$\e_sqlite3\linux\musl-x64\libe_sqlite3.so" target="runtimes\linux-musl-x64\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\linux\musl-armhf\libe_sqlite3.so" target="runtimes\linux-musl-arm\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\linux\musl-arm64\libe_sqlite3.so" target="runtimes\linux-musl-arm64\native\libe_sqlite3.so" />
+    <file src="$cb_bin_path$\e_sqlite3\linux\musl-s390x\libe_sqlite3.so" target="runtimes\linux-musl-s390x\native\libe_sqlite3.so" />
+    <file src="$cb_bin_path$\e_sqlite3\linux\musl-riscv64\libe_sqlite3.so" target="runtimes\linux-musl-riscv64\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\linux\mips64\libe_sqlite3.so" target="runtimes\linux-mips64\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\linux\s390x\libe_sqlite3.so" target="runtimes\linux-s390x\native\libe_sqlite3.so" />
+    <file src="$cb_bin_path$\e_sqlite3\linux\riscv64\libe_sqlite3.so" target="runtimes\linux-riscv64\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\linux\ppc64le\libe_sqlite3.so" target="runtimes\linux-ppc64le\native\libe_sqlite3.so" />
     <file src="$cb_bin_path$\e_sqlite3\wasm\net6.0\e_sqlite3.a" target="runtimes\browser-wasm\nativeassets\net6.0\e_sqlite3.a" />
     <file src="$cb_bin_path$\e_sqlite3\wasm\net7.0\e_sqlite3.a" target="runtimes\browser-wasm\nativeassets\net7.0\e_sqlite3.a" />
diff --git a/src/SQLitePCLRaw.lib.e_sqlite3/net461/SQLitePCLRaw.lib.e_sqlite3.targets b/src/SQLitePCLRaw.lib.e_sqlite3/net461/SQLitePCLRaw.lib.e_sqlite3.targets
index fdfd7647..121de36d 100644
--- a/src/SQLitePCLRaw.lib.e_sqlite3/net461/SQLitePCLRaw.lib.e_sqlite3.targets
+++ b/src/SQLitePCLRaw.lib.e_sqlite3/net461/SQLitePCLRaw.lib.e_sqlite3.targets
@@ -66,5 +66,10 @@
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <Pack>false</Pack>
     </Content>
+    <Content Include="$(MSBuildThisFileDirectory)..\..\runtimes\linux-riscv64\native\libe_sqlite3.so">
+      <Link>runtimes\linux-riscv64\native\libe_sqlite3.so</Link>
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+      <Pack>false</Pack>
+    </Content>
   </ItemGroup>
 </Project>
\ No newline at end of file