diff --git a/src/loaih/build.py b/src/loaih/build.py index b043f38..acc45f8 100644 --- a/src/loaih/build.py +++ b/src/loaih/build.py @@ -577,11 +577,22 @@ class Build(): r"apt download " + " ".join(debs) ), cwd=downloadpath, check=True) - # then we install them inside the AppDir + # then we install them inside a temporary path + temporary = os.path.abspath(os.path.join(downloadpath, 'temp')) + os.makedirs(temporary) subprocess.run(shlex.split( - r"find " + downloadpath + r" -iname \*.deb -exec dpkg -x {} " + self.appimagedir + r" \;" + r"find " + downloadpath + r" -iname \*.deb -exec dpkg -x {} " + temporary + r" \;" ), cwd=self.builddir, check=True) + # We are finally copying the .so files in the same path as main_executable + subprocess.run(shlex.split( + f"cp -r * {os.path.dirname(main_executable)}" + ), cwd = os.path.abspath(os.path.join(temporary, '/lib/x86_64-linux-gnu')), shell=True, check=True) + subprocess.run(shlex.split( + f"cp -r * {os.path.dirname(main_executable)}" + ), cwd = os.path.abspath(os.path.join(temporary, '/usr/lib/x86_64-linux-gnu')), shell=True, check=True) + + # Find the name of the binary called in the desktop file. binaryname = '' with open( @@ -605,6 +616,11 @@ class Build(): r"-exec ln -sf {} ./%s \;" % binaryname ), cwd=bindir, check=True) + # Cleaning up AppDir + cleanup_dirs = [ 'etc', 'lib', 'lib64', 'usr/lib', 'usr/local' ] + for local in cleanup_dirs: + shutil.rmtree(os.path.abspath(os.path.join(self.appimagedir, local))) + # Download AppRun from github apprunurl = r"https://github.com/AppImage/AppImageKit/releases/" apprunurl += f"download/continuous/AppRun-{self.arch}"