Index: ports-mgmt/pkg/files/patch-libpkg_pkg__config.c =================================================================== --- ports-mgmt/pkg/files/patch-libpkg_pkg__config.c (nonexistent) +++ ports-mgmt/pkg/files/patch-libpkg_pkg__config.c (working copy) @@ -0,0 +1,15 @@ +--- libpkg/pkg_config.c.orig 2016-01-26 23:32:05 UTC ++++ libpkg/pkg_config.c +@@ -390,6 +390,12 @@ static struct config_entry c[] = { + "VALID_URL_SCHEME", + "pkg+http,pkg+https,https,http,ftp,file,ssh", + }, ++ { ++ PKG_BOOL, ++ "ALLOW_BASE_SHLIBS", ++ "NO", ++ "Enable base libraries analysis", ++ }, + }; + + static bool parsed = false; Index: ports-mgmt/pkg/files/patch-libpkg_pkg__elf.c =================================================================== --- ports-mgmt/pkg/files/patch-libpkg_pkg__elf.c (nonexistent) +++ ports-mgmt/pkg/files/patch-libpkg_pkg__elf.c (working copy) @@ -0,0 +1,40 @@ +--- libpkg/pkg_elf.c.orig 2015-09-21 08:53:23 UTC ++++ libpkg/pkg_elf.c +@@ -85,23 +85,28 @@ static int + filter_system_shlibs(const char *name, char *path, size_t pathlen) + { + const char *shlib_path; ++ bool packaging_base = pkg_object_bool(pkg_config_get("ALLOW_BASE_SHLIBS")); + +- shlib_path = shlib_list_find_by_name(name); +- if (shlib_path == NULL) { +- /* dynamic linker could not resolve */ +- return (EPKG_FATAL); ++ if (!packaging_base) { ++ shlib_path = shlib_list_find_by_name(name); ++ if (shlib_path == NULL) { ++ /* dynamic linker could not resolve */ ++ return (EPKG_FATAL); ++ } + } + +- /* match /lib, /lib32, /usr/lib and /usr/lib32 */ +- if (strncmp(shlib_path, "/lib", 4) == 0 || +- strncmp(shlib_path, "/usr/lib", 8) == 0) +- return (EPKG_END); /* ignore libs from base */ ++ if (!packaging_base) { ++ /* match /lib, /lib32, /usr/lib and /usr/lib32 */ ++ if (strncmp(shlib_path, "/lib", 4) == 0 || ++ strncmp(shlib_path, "/usr/lib", 8) == 0) ++ return (EPKG_END); /* ignore libs from base */ ++ } + + if (path != NULL) + strncpy(path, shlib_path, pathlen); + + return (EPKG_OK); +-} ++} + + /* ARGSUSED */ + static int