Skip to content

Commit

Permalink
Allow C dependencies to be configured directly in CFLAGS/LDFLAGS
Browse files Browse the repository at this point in the history
  • Loading branch information
elprans committed Jul 17, 2023
1 parent 1906a5c commit 1866b19
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions metapkg/packages/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,13 +1023,34 @@ def configure_dependency(
root = build.get_install_dir(pkg, relative_to="pkgbuild")
path = root / build.get_full_install_prefix().relative_to("/")
rel_path = f'$(pwd)/"{path}"'
configure_flags[f"{var_prefix}_CFLAGS"] = f"!-I{rel_path}/include/"

dep_ldflags = build.sh_get_bundled_shlib_ldflags(
pkg, relative_to="pkgbuild"
)
configure_flags[f"{var_prefix}_LIBS"] = f"!{dep_ldflags}"
pkg, relative_to="pkgbuild")

if var_prefix:
build.sh_append_flags(
configure_flags,
f"{var_prefix}_CFLAGS",
f"-I{rel_path}/include/",
)
build.sh_append_flags(
configure_flags,
f"{var_prefix}_LIBS",
dep_ldflags,
)
else:
build.sh_append_flags(
configure_flags,
"CFLAGS",
f"-I{rel_path}/include/",
)
build.sh_append_flags(
configure_flags,
f"LDFLAGS",
dep_ldflags,
)

ldflags = f"!-L{rel_path}/lib/"
ldflags = f"-L{rel_path}/lib/"

if platform.system() == "Darwin":
# In case ./configure tries to compile and test a program
Expand All @@ -1039,7 +1060,7 @@ def configure_dependency(
else:
ldflags += f'" "-Wl,-rpath-link,{rel_path}/lib'

configure_flags["LDFLAGS"] = ldflags
build.sh_append_flags(configure_flags, f"LDFLAGS", ldflags)

elif build.is_stdlib(pkg):
configure_flags[
Expand Down

0 comments on commit 1866b19

Please sign in to comment.