aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/package.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/scripts/package.py b/scripts/package.py
index 61f12c7..ce7eb71 100755
--- a/scripts/package.py
+++ b/scripts/package.py
@@ -22,6 +22,8 @@ $DOWNLOAD_DEPENDENCIES_COMMAND
"$script_dir/$SO_LOADER" --library-path "$script_dir/libs":$HOME/.local/lib/sibs/"$program_full_name":/usr/lib/sibs/"$program_full_name" "$script_dir/$PROGRAM_NAME" "$@"
"""
+blacklisted_libs = [ "libGL\\.so.*", "libGLX.*", "libGLdispatch.*" ]
+
def get_executable_dynamic_libraries(filepath):
libs = []
process = subprocess.Popen(["ldd", filepath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -76,6 +78,18 @@ def fetch_checksums(url):
return checksums
+def remove_blacklisted_libs(libs):
+ new_libs = []
+ for lib in libs:
+ is_blacklisted = False
+ for blacklisted_lib in blacklisted_libs:
+ if re.match(blacklisted_lib, os.path.basename(lib[0])):
+ is_blacklisted = True
+ break
+ if not is_blacklisted:
+ new_libs.append(lib)
+ return new_libs
+
def main():
if len(sys.argv) <= 4:
usage()
@@ -92,6 +106,10 @@ def main():
os.makedirs(destination_path, exist_ok=True)
libs = get_executable_dynamic_libraries(executable_path)
+ # Some libraries can't be distributed because different hardware. Since we are operating on a specific architecture, the types of libraries
+ # that can't be distributed are commonly gpu driver libraries
+ libs = remove_blacklisted_libs(libs)
+
so_loader_pattern = re.compile("ld-linux-x86-64\\.so.*")
so_loader = None
for lib in libs:
@@ -147,19 +165,6 @@ def main():
shutil.copyfile(executable_path, new_executable_path)
make_executable(new_executable_path)
- print("Patching executable")
- process = subprocess.Popen(["patchelf", "--set-interpreter", so_loader, new_executable_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- (stdout, stderr) = process.communicate()
- if process.returncode != 0:
- print("Failed to execute patchelf --set-interpreter on executable %s, error: %s" % (new_executable_path, stderr))
- exit(3)
-
- #process = subprocess.Popen(["patchelf", "--set-rpath", "libs", new_executable_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- #(stdout, stderr) = process.communicate()
- #if process.returncode != 0:
- # print("Failed to execute patchelf --set-rpath on executable %s, error: %s" % (new_executable_path, stderr))
- # exit(4)
-
run_script_path = os.path.join(destination_path, "run.sh")
with open(run_script_path, "wb") as run_script:
run_script.write(run_script_linux.replace("$SO_LOADER", so_loader)\