Hello guys. I'm working on an iOS project and trying to add SPM support to it.
The problem is that one of the dependencies uses OpenSSL, a C static library which consists of libcrypto.a, libssl.a and a bunch of header files respectively.
So what I've been trying to do is put the libcrypto.a, libssl.a and the headers inside the package and bundle them together to use this package as a dependency, so that others can easily integrate the openssl functionality.
There is no way to publish binaries yet, but much thought is going into making it possible:
That means you have three options:
Depend on OpenSSL as source. Its GitHub repository is here. Fork it, add a Package.swift, tag a version, and depend on that. (And maybe submit your Package.swift back to them as a pull request.) Sometimes this strategy requires generating and checking in files the project normally leaves Gitβignored.
Distribute the binary separately, and instruct your clients to install it on the system first. (And your clientsβ clients will have to do the same thing.) Once it is installed on the system, linkedLibrary should just work without needing unsafe flags.
Use unsafeFlags and never release semantic versions, telling your clients to depend on branches instead. Branch dependencies allow unsafe flags, because they are only intended for development. The branches in the dependency tree will in turn prevent clients from release semantic versions too.
All these strategies see quite a lot of use, so which one you choose is up to you. (Iβm partial to option 1.)
I think this solution doesnβt work anymore, I cannot see SourcePackages in between build files.
Is there any working way to include a .a static C library in a Swift Package, without having source code (so @SDGGiesbrecht solution 1 is not an option)?