|
332 | 332 | end
|
333 | 333 | end
|
334 | 334 |
|
| 335 | +@testset "Auditor - relocatable pkg-config prefix" begin |
| 336 | + for os in ["linux", "macos", "freebsd", "windows"] |
| 337 | + platform = Platform("x86_64", os) |
| 338 | + mktempdir() do build_path |
| 339 | + build_output_meta = nothing |
| 340 | + @test_logs (:info, r"Relocatize pkg-config file .*/destdir/lib/pkgconfig/libfoo.pc$") match_mode=:any begin |
| 341 | + build_output_meta = autobuild( |
| 342 | + build_path, |
| 343 | + "libfoo", |
| 344 | + v"1.0.0", |
| 345 | + # Copy in the libfoo sources |
| 346 | + [DirectorySource(build_tests_dir)], |
| 347 | + libfoo_autotools_script, |
| 348 | + # Build for our platform |
| 349 | + [platform], |
| 350 | + # The products we expect to be build |
| 351 | + libfoo_products, |
| 352 | + # No dependencies |
| 353 | + Dependency[]; |
| 354 | + verbose = true, |
| 355 | + ) |
| 356 | + end |
| 357 | + |
| 358 | + # Extract our platform's build |
| 359 | + @test haskey(build_output_meta, platform) |
| 360 | + tarball_path, tarball_hash = build_output_meta[platform][1:2] |
| 361 | + @test isfile(tarball_path) |
| 362 | + |
| 363 | + # Unpack it somewhere else |
| 364 | + @test verify(tarball_path, tarball_hash) |
| 365 | + testdir = joinpath(build_path, "testdir") |
| 366 | + mkdir(testdir) |
| 367 | + unpack(tarball_path, testdir) |
| 368 | + prefix = Prefix(testdir) |
| 369 | + |
| 370 | + # Test that `libfoo.pc` exists and contains a relative prefix |
| 371 | + # TODO: actually use pkg-config with PKG_CONFIG_PATH |
| 372 | + contents = list_tarball_files(tarball_path) |
| 373 | + @test "lib/pkgconfig/libfoo.pc" in contents |
| 374 | + libfoo_pc = read(joinpath(testdir, "lib/pkgconfig/libfoo.pc"), String) |
| 375 | + @test contains(libfoo_pc, "prefix=\${pcfiledir}") |
| 376 | + @test !contains(libfoo_pc, "/workplace/destdir") |
| 377 | + end |
| 378 | + end |
| 379 | +end |
| 380 | + |
335 | 381 | @testset "Auditor - .dll moving" begin
|
336 | 382 | for platform in [Platform("x86_64", "windows")]
|
337 | 383 | mktempdir() do build_path
|
|
0 commit comments