Skip to content

Commit

Permalink
Extend pkgconfig relocatization to cover exec_prefix too. (#1351)
Browse files Browse the repository at this point in the history
  • Loading branch information
maleadt authored Dec 10, 2024
1 parent e8c44bc commit 91047c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/Auditor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
rm(f; force=true)
end

# Make sure that `prefix` in pkg-config files use a relative prefix
# Make sure that `(exec_)prefix` in pkg-config files use a relative prefix
pc_files = collect_files(prefix, endswith(".pc"))
pc_re = r"^prefix=(/.*)$"
for f in pc_files
for f in pc_files, var in ["prefix", "exec_prefix"]
pc_re = Regex("^$var=(/.*)\$")
# We want to replace every instance of `prefix=...` with
# `prefix=${pcfiledir}/../..`
changed = false
Expand All @@ -226,7 +226,7 @@ function audit(prefix::Prefix, src_name::AbstractString = "";
f_rel = relpath(f, prefix.path)
ndirs = count('/', f_rel)
prefix_rel = join([".." for _ in 1:ndirs], "/")
l = "prefix=\${pcfiledir}/$prefix_rel"
l = "$var=\${pcfiledir}/$prefix_rel"
changed = true
end
println(buf, l)
Expand Down
2 changes: 1 addition & 1 deletion test/build_tests/libfoo/libfoo.pc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
prefix=/workplace/destdir
exec_prefix=${prefix}
exec_prefix=/workplace/destdir
includedir=${prefix}/include
libdir=${exec_prefix}/lib

Expand Down

0 comments on commit 91047c0

Please sign in to comment.