Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/PackageLoading/PkgConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ internal struct PkgConfigParser {
\(pcFile)
""")
}
} else {
} else if !arg.isEmpty {
// Otherwise it is a dependency.
deps.append(arg)
}
Expand Down
14 changes: 14 additions & 0 deletions Tests/PackageLoadingTests/PkgConfigParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@ final class PkgConfigParserTests: XCTestCase {
}
}

func testDummyDependency() throws {
try loadPCFile("dummy_dependency.pc") { parser in
XCTAssertEqual(parser.variables, [
"prefix": "/usr/local/bin",
"exec_prefix": "/usr/local/bin",
"pcfiledir": parser.pcFile.parentDirectory.pathString,
"pc_sysrootdir": AbsolutePath.root.pathString
])
XCTAssertEqual(parser.dependencies, ["pango", "fontconfig"])
XCTAssertEqual(parser.cFlags, [])
XCTAssertEqual(parser.libs, ["-L/usr/local/bin", "-lpangoft2-1.0"])
}
}

/// Test custom search path get higher priority for locating pc files.
func testCustomPcFileSearchPath() throws {
let observability = ObservabilitySystem.makeForTesting()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
prefix=/usr/local/bin
exec_prefix=${prefix}

#some comment

Requires: pango, , fontconfig >= 2.13.0
Libs:-L${prefix} -lpangoft2-1.0