cps-org / cps-config

A drop in replacement for pkg-config/pkgconf using cps files
MIT License
15 stars 7 forks source link

pc files with multiple static libraries #65

Closed tylerjw closed 2 months ago

tylerjw commented 2 months ago

What do we do about something like this:

{
    "name": "NSPR",
    "cps_version": "0.10.0",
    "version": "4.32.0",
    "description": "The Netscape Portable Runtime",
    "default_components": ["nspr4", "plc4", "plds4"],
    "components": {
        "nspr4": {
            "type": "archive",
            "includes": {"c": ["@prefix@/include/nspr"]},
            "location": "@prefix@/lib/x86_64-linux-gnu/libnspr4.a",
        },
        "plc4": {
            "type": "archive",
            "includes": {"c": ["@prefix@/include/nspr"]},
            "location": "@prefix@/lib/x86_64-linux-gnu/libplc4.a",
        },
        "plds4": {
            "type": "archive",
            "includes": {"c": ["@prefix@/include/nspr"]},
            "location": "@prefix@/lib/x86_64-linux-gnu/libplds4.a",
        }
    }
}

Should the behavior be similar to the multiple-dynamic libraries case, or different somehow?

tylerjw commented 2 months ago

For context here is the pc file:

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib/x86_64-linux-gnu
includedir=${prefix}/include/nspr

Name: NSPR
Description: The Netscape Portable Runtime
Version: 4.32.0
Libs: -L/usr/lib/x86_64-linux-gnu -lplds4 -lplc4 -lnspr4
Cflags: -I${prefix}/include/nspr
tylerjw commented 2 months ago

Closing as this seems to work and is the recommended approach:

{
    "name": "NSPR",
    "cps_version": "0.10.0",
    "version": "4.32.0",
    "description": "The Netscape Portable Runtime",
    "default_components": ["nspr4"],
    "components": {
        "nspr4": {
            "type": "archive",
            "includes": {"*": ["@prefix@/include/nspr"]},
            "location": "@prefix@/lib/x86_64-linux-gnu/libnspr4.a",
            "requires": [":plc4", ":plds4"],
        },
        "plc4": {
            "type": "archive",
            "location": "@prefix@/lib/x86_64-linux-gnu/libplc4.a",
        },
        "plds4": {
            "type": "archive",
            "location": "@prefix@/lib/x86_64-linux-gnu/libplds4.a",
        }
    }
}