Skip to content

Commit

Permalink
remove -Wl,-rpath from PkgConfigDeps generator
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Dec 17, 2021
1 parent a9f5bd4 commit 5674345
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 49 deletions.
6 changes: 0 additions & 6 deletions conan/tools/gnu/pkgconfigdeps/pc_files_templates.py
Expand Up @@ -18,12 +18,6 @@ def _get_pc_file_template():
{%- for shared_flag in (cpp_info.sharedlinkflags + cpp_info.exelinkflags) -%}
{{ shared_flag + " " }}
{%- endfor -%}
{%- for _ in libdirs -%}
{%- set flag = gnudeps_flags._rpath_flags(["${libdir%s}" % loop.index]) -%}
{%- if flag|length -%}
{{ flag[0] + " " }}
{%- endif -%}
{%- endfor -%}
{%- for framework in (gnudeps_flags.frameworks + gnudeps_flags.framework_paths) -%}
{{ framework + " " }}
{%- endfor -%}
Expand Down
45 changes: 2 additions & 43 deletions conans/test/functional/toolchains/gnu/test_pkgconfigdeps.py
@@ -1,5 +1,4 @@
import os
import platform
import textwrap

from conans.test.assets.genconanfile import GenConanfile
Expand Down Expand Up @@ -44,9 +43,6 @@ def package_info(self):
pc_path = os.path.join(client.current_folder, "MyLib.pc")
assert os.path.exists(pc_path) is True
pc_content = load(pc_path)
expected_rpaths = ""
if platform.system() in ("Linux", "Darwin"):
expected_rpaths = ' -Wl,-rpath,"${libdir1}" -Wl,-rpath,"${libdir2}"'
expected_content = textwrap.dedent("""\
libdir1=/my_absoulte_path/fake/mylib/lib
libdir2=${prefix}/lib2
Expand All @@ -55,8 +51,8 @@ def package_info(self):
Name: MyLib
Description: Conan package: MyLib
Version: 0.1
Libs: -L"${libdir1}" -L"${libdir2}"%s
Cflags: -I"${includedir1}\"""" % expected_rpaths)
Libs: -L"${libdir1}" -L"${libdir2}"
Cflags: -I"${includedir1}\"""")

# Avoiding trailing whitespaces in Jinja template
for line in pc_content.splitlines()[1:]:
Expand Down Expand Up @@ -110,43 +106,6 @@ def package_info(self):
assert "\n".join(pc_content.splitlines()[1:]) == expected


def test_pkg_config_rpaths():
# rpath flags are only generated for gcc and clang
profile = textwrap.dedent("""\
[settings]
os=Linux
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++
""")
conanfile = textwrap.dedent("""
from conans import ConanFile
class PkgConfigConan(ConanFile):
name = "MyLib"
version = "0.1"
settings = "os", "compiler"
exports = "mylib.so"
def package(self):
self.copy("mylib.so", dst="lib")
def package_info(self):
self.cpp_info.libs = ["mylib"]
""")
client = TestClient()
client.save({"conanfile.py": conanfile,
"linux_gcc": profile,
"mylib.so": "fake lib content"})
client.run("create . -pr=linux_gcc")
client.run("install MyLib/0.1@ -g PkgConfigDeps -pr=linux_gcc")

pc_path = os.path.join(client.current_folder, "MyLib.pc")
assert os.path.exists(pc_path) is True
pc_content = load(pc_path)
assert '-Wl,-rpath,"${libdir1}"' in pc_content


def test_system_libs():
conanfile = textwrap.dedent("""
from conans import ConanFile
Expand Down

0 comments on commit 5674345

Please sign in to comment.