R-macos / recipes

System for building static dependent libraries for CRAN packages
43 stars 15 forks source link

Add libarchive, for the archive package #43

Closed gaborcsardi closed 9 months ago

gaborcsardi commented 1 year ago

Also:

In general, I was trying to match the current config of the archive package with these changes, and the configure arguments.

(If there is a package that links to zstd, they might need to update their PKG_LIBS to add -lxz and -llz4 now. I didn't find such a package, though.)

gaborcsardi commented 1 year ago

I checked that archive uses the static libs now:

❯ otool -L /Users/gaborcsardi/Library/R/arm64/4.3/library/archive/libs/archive.so
/Users/gaborcsardi/Library/R/arm64/4.3/library/archive/libs/archive.so:
    archive.so (compatibility version 0.0.0, current version 0.0.0)
    /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libR.dylib (compatibility version 4.3.0, current version 4.3.1)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1971.0.0)
    /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1500.65.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)
gaborcsardi commented 1 year ago

I added a stub for iconv. With this I can now use pkg-config to look up the libraries.

If you upload the stub .tar.gz to mac.r-project.org, then I can change the download URL.

s-u commented 11 months ago

Gábor, thanks! I have added variants of most, but Sonoma has thrown a spanner into the works with the iconv mess Apple has caused so I have to sort that out for R first and them I'll pull the remaining libarchive recipe.

s-u commented 11 months ago

There is a known bug in libarchive: there is no such thing as iconv.pc so this PR tries to create it, but iconv doesn't actually have one even in the original installation. Most dists solve it by removing $LIBSREQUIRED. This is a bit of a problem, though, since libarchive doesn't include the necessary flags to link iconv in its .pc. To compound the mess, the Sonoma iconv breakage can only be solved by avoiding system iconv, but since it is dynamic it will override any static build unless we use custom flags.