Reputation: 1973
On my OSX machine, deep within a jungle of lib directories, I was able to see this
-r-xr-xr-x 1 user users 45700 Feb 01 1:47 LibXSLT.bundle*
1) What are these .bundle files ?
2) Who creates them ? CPAN modules ?
3) If so, then can we control its generation via some Makefile artifact ?
Upvotes: 3
Views: 252
Reputation: 9832
- What are these
.bundle
files ?
The *.bundle
files, in this case, are Mach-O universal binary files.
file
can be used to check the file type including architectures.
file …/Perl/…/XML/LibXSLT/LibXSLT.bundle
# /LibXSLT.bundle: Mach-O universal binary with 2 architectures:
# [x86_64:Mach-O 64-bit bundle x86_64]
# [arm64e:Mach-O 64-bit bundle arm64e]
- Who creates them ? CPAN modules ?
lipo
is the tool used for combining one or more architecture specific executables into a Mach-O universal binary. (In general, although Perl may need the extension, the .bundle
file extension is optional.)
which -a lipo
# /usr/bin/lipo
man lipo
# NAME
# lipo - create or operate on universal files
- If so, then can we control its generation via some
Makefile
artifact ?
The Apple article "Building a Universal macOS Binary" mentions how to use a (C/C++/Swift) makefile
to create a universal binary by merging the resulting executable files together with the lipo
tool.
The following example shows a makefile that compiles a single-source file twice—once for each architecture. It then creates a universal binary by merging the resulting executable files together with the
lipo
tool.
x86_app: main.c
$(CC) main.c -o x86_app -target x86_64-apple-macos10.12
arm_app: main.c
$(CC) main.c -o arm_app -target arm64-apple-macos11
universal_app: x86_app arm_app
lipo -create -output universal_app x86_app arm_app
Conceptually, the above approach could be used with a ExtUtils::MakeMaker
Makefile.PL
.
Upvotes: 1