Code Monkey home page Code Monkey logo

Comments (4)

kelson42 avatar kelson42 commented on August 25, 2024

@automactic Can you list here the operations to run? Maybe you have a script?

from kiwix-build.

automactic avatar automactic commented on August 25, 2024
import subprocess
import os


def change_install_name(lib_install_path: str):
    def get_name_map(dir_path: str):
        files = {}
        for file in os.listdir(dir):
            if file.endswith('.dylib') and not os.path.islink(dir_path+'/'+file):
                files[file.split('.')[0]] = file
        return files

    dylibs = get_name_map(lib_install_path)
    for dylib_name, file_name in dylibs.items():
        subprocess.run(['install_name_tool', '-id', '@rpath/{}'.format(file_name), file_name], cwd=lib_install_path)
        process = subprocess.run(['otool', '-L', file_name], cwd=lib_install_path, stdout=subprocess.PIPE)
        dependencies = process.stdout.decode().split('\n')[2:-1]
        dependencies = [d.strip() for d in dependencies]
        for d in dependencies:
            if not d.startswith('/usr/lib/'):
                old_name = d.split(' ')[0]
                dylib_name = old_name.split('/')[-1].split('.')[0]
                new_name = '@rpath/{}'.format(dylibs[dylib_name])
                subprocess.run(['install_name_tool', '-change', old_name, new_name, file_name], cwd=dir)

# dir = '/Volumes/Data/Developer/kiwix-build/BUILD_native_dyn_/INSTALL/lib'
dir = '/Volumes/Data/Developer/Kiwix/Shared/Dependencies/macOS_lib'
change_install_name(dir)

from kiwix-build.

kelson42 avatar kelson42 commented on August 25, 2024

@mgautierfr What is the status on this?

from kiwix-build.

mgautierfr avatar mgautierfr commented on August 25, 2024

This is a duplicate of #113.

from kiwix-build.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.