Jelajahi Sumber

fix(cli,bundler): prefer AppImage libraries with ABI version (#4505)

Robin van Boven 3 tahun lalu
induk
melakukan
bf45ca1df6

+ 7 - 0
.changes/bundler-libnames.md

@@ -0,0 +1,7 @@
+---
+"cli.rs": patch
+"cli.js": patch
+"tauri-bundler": patch
+---
+
+AppImage bundling will now prefer bundling correctly named appincidator library (including `.1` version suffix). With a symlink for compatibility with the old naming.

+ 9 - 0
tooling/bundler/src/bundle/linux/templates/appimage

@@ -37,6 +37,15 @@ fi
 if [[ "$TRAY_LIBRARY_PATH" != "0" ]]; then
   echo "Copying appindicator library ${TRAY_LIBRARY_PATH}"
   cp ${TRAY_LIBRARY_PATH} usr/lib
+  # It looks like we're practicing good hygiene by adding the ABI version.
+  # But for compatibility we'll symlink this file to what we did before.
+  # Specifically this prevents breaking libappindicator-sys v0.7.1 and v0.7.2.
+  if [[ "$TRAY_LIBRARY_PATH" == *.so.1 ]]; then
+    readonly soname=$(basename "$TRAY_LIBRARY_PATH")
+    readonly old_name=$(basename "$TRAY_LIBRARY_PATH" .1)
+    echo "Adding compatibility symlink ${old_name} -> ${soname}"
+    ln -s ${soname} usr/lib/${old_name}
+  fi
 fi
 
 # Copy WebKit files.

+ 4 - 4
tooling/cli/src/build.rs

@@ -229,13 +229,13 @@ pub fn command(mut options: Options) -> Result<()> {
             "TRAY_LIBRARY_PATH",
             if tray == "ayatana" {
               format!(
-                "{}/libayatana-appindicator3.so",
+                "{}/libayatana-appindicator3.so.1",
                 pkgconfig_utils::get_library_path("ayatana-appindicator3-0.1")
                   .expect("failed to get ayatana-appindicator library path using pkg-config.")
               )
             } else {
               format!(
-                "{}/libappindicator3.so",
+                "{}/libappindicator3.so.1",
                 pkgconfig_utils::get_library_path("appindicator3-0.1")
                   .expect("failed to get libappindicator-gtk library path using pkg-config.")
               )
@@ -301,9 +301,9 @@ mod pkgconfig_utils {
 
   pub fn get_appindicator_library_path() -> PathBuf {
     match get_library_path("ayatana-appindicator3-0.1") {
-      Some(p) => format!("{}/libayatana-appindicator3.so", p).into(),
+      Some(p) => format!("{}/libayatana-appindicator3.so.1", p).into(),
       None => match get_library_path("appindicator3-0.1") {
-        Some(p) => format!("{}/libappindicator3.so", p).into(),
+        Some(p) => format!("{}/libappindicator3.so.1", p).into(),
         None => panic!("Can't detect any appindicator library"),
       },
     }