Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Makes a macOS binary redistributable by searching the dependency tree and copying/patching non-system libraries.

License

NotificationsYou must be signed in to change notification settings

chearon/macpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bundles up all dependencies used by an executable (or library) into a singlefolder, and patches all of the executables to look in that directory so youdon't have to rely on your users having certain libraries installed.

Part of my motivation in making this was to learn Python 3'sasync/await, too. Theprocesses that are used to patch stuff and query dependencies all run inparallel so it should be super fast!

Usage and requirements

You need:

  • Python 3 (brew install python3) because it uses async/await and asyncio
  • Xcode CLI tools (I think)

The easiest way to get going is by installing through pip + PyPi:

pip3 install macpackmacpack <your executable here>

You can also run it out of the project directory by doing:

macpack/patcher.py <your executable here>

It should print the dependency tree like this example:

$ macpack ~/Code/node-canvas/build/Release/canvas.nodePatching /Users/caleb/Code/node-canvas/build/Release/canvas.node16 total non-system dependencies1       libpixman-1.0.dylib -> 12       libcairo.2.dylib -> 2, 1, 16, 9, 33       libpng16.16.dylib -> 34       libpangocairo-1.0.0.dylib -> 4, 5, 2, 14, 6, 13, 7, 8, 15, 16, 95       libpango-1.0.0.dylib -> 5, 6, 13, 7, 86       libgobject-2.0.0.dylib -> 6, 7, 11, 12, 87       libglib-2.0.0.dylib -> 7, 11, 88       libintl.8.dylib -> 89       libfreetype.6.dylib -> 9, 310      libjpeg.8.dylib -> 1011      libpcre.1.dylib -> 1112      libffi.6.dylib -> 1213      libgthread-2.0.0.dylib -> 13, 7, 11, 814      libpangoft2-1.0.0.dylib -> 14, 5, 6, 13, 7, 8, 15, 16, 915      libharfbuzz.0.dylib -> 15, 7, 8, 916      libfontconfig.1.dylib -> 16, 9canvas.node + 16 dependencies successfully patched

Everything that your executable uses should then be copied into the same folderthat your binary is. When your main binary is run next, it will look in the newlocation you specified (default isbinary_dir/libs/<lib>, see-d below).Those dylibs will look in the same directory for dylibs they depend on, too, evenif your main binary does not use them.

You can then distribute the whole folder as one.

Options

-v, --verbose

Pass-v to get output fromotool if it failed to patch or more information onwhich dependencies could not be loaded.

It will also print a more easy to read dependency tree, with the full names ofdependenies under each one

-d, --destination

This is the destination folderrelative to the binary's containing folder tocopy library dependencies to. For example, if you binary is/a/b/program,and you pass-d ../libraries, they will copy to and load from/a/libraries/. The default value is../libs.

If you want the executable and libraries to have absolute paths instead of loadingrelative to the binary, you just need to specify an absolutep path for-d. Inthat case the@executable_path will not be put into the binaries at all.

-n, --dry-run

Just prints the dependency tree and doesn't do any patching. Use-nv to get aslightly more user-friendly tree printed out.

Background

It will parse out the executable's dependencies (usingotool -L) and theirdependencies recursively, filtering out system libraries. When the treeis built, it will copy the libraries to your program's folder and then patcheverything that it is aware of (usinginstall_name_tool). It should be ableto handle different symbolic links and all that correctly

Credits

Inspired bymacdylibbundler, it doesthe same basic thing except with less options (at the moment) and it builds a fulldependency tree

About

Makes a macOS binary redistributable by searching the dependency tree and copying/patching non-system libraries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp