bouke
1
When building, SwiftPM emits the following message:
'Cdns_sd' (...): warning: system packages are deprecated; use system library targets instead
I'm not aware of what constitutes a system library target and the Documentation regarding system packages (not libraries) still shows how to create a package-per-library.
OTOH there's manifest v4.2, that shows how to create a system library target:
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "ZLib",
products: [
.library(name: "ZLib", targets: ["ZLib"]),
],
targets: [
.systemLibrary(
name: "CZLib")
.target(
name: "ZLib",
dependencies: ["CZLib"]),
]
)
However, that documentation doesn't include any information (if at all possible) on how to specify pkgConfig and providers; e.g.
// swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "Cdns_sd",
pkgConfig: "avahi-compat-libdns_sd",
providers: [
.apt(["libavahi-compat-libdnssd-dev"])
]
)
Finally; there might be shim.h files involved to import the desired headers.
#include <dns_sd.h>
And even module maps:
module Cdns_sd [system] {
header "shim.h"
link "dns_sd"
export *
}
So I'm left wondering, what is this warning about; how does one actually migrate to this new target?
Diggory
(Diggory)
2
There’s a link to some documentation in my question here:
(If you have any ideas how to resolve my issue, I’d be grateful!)
bouke
3
Diving further into the source code for SwiftPM, it seems that all properties can be provided as one might've expected:
.systemLibrary(name: "CLibSodium",
pkgConfig: "libsodium",
providers: [
.brew(["libsodium"]),
.apt(["libsodium-dev"])
]),
A quick smoke test shows that it works, but there appears to be a regression in that using the same library within a dependency tree, it cannot reuse the same name:
error: multiple targets named 'CLibSodium' in: A, B