Index: Mk/Scripts/qa.sh =================================================================== --- Mk/Scripts/qa.sh +++ Mk/Scripts/qa.sh @@ -822,10 +826,67 @@ return $rc } +badlibmix() { + local file dep_file rc + local base_ssl_libs port_ssl_libs + local base_gcc_libs port_gcc_libs + rc=0 + + # Check all dynamicaly linked ELF files + # Some .so are not executable, but we want to check them too. + while read file; do + # No results presents a blank line from heredoc. + [ -z "${file}" ] && continue + + base_ssl_libs="" + port_ssl_libs="" + base_gcc_libs="" + port_gcc_libs="" + + while read dep_file; do + # openssl + if echo ${dep_file} | grep -qE "^(/usr/lib/libssl|/lib/libcrypto)\.so"; then + base_ssl_libs="${base_ssl_libs} ${dep_file}" + fi + if echo ${dep_file} | grep -qE "^(${PREFIX}|${LOCALBASE})/lib/lib(ssl|crypto)\.so"; then + port_ssl_libs="${port_ssl_libs} ${dep_file}" + fi + # libgcc_s + if echo ${dep_file} | grep -qE "^/usr/lib/libgcc_s\.so"; then + base_gcc_libs="${base_gcc_libs} ${dep_file}" + fi + if echo ${dep_file} | grep -qE "^/usr/local/lib/.*/libgcc_s\.so"; then + port_gcc_libs="${port_gcc_libs} ${dep_file}" + fi + done <<-EOT + $(LD_LIBRARY_PATH=${STAGEDIR}${PREFIX}/lib ldd "${STAGEDIR}${file}" | \ + grep '=>' | \ + awk '{print $3}') + EOT + + if [ -n "${base_ssl_libs}" -a -n "${port_ssl_libs}" ]; then + err "${file} is linked to both base and port SSL libraries: `echo ${base_ssl_libs}` and `echo ${port_ssl_libs}`" + rc=1 + fi + if [ -n "${base_gcc_libs}" -a -n "${port_gcc_libs}" ]; then + err "${file} is linked to both base and port gcc_s libraries: `echo ${base_gcc_libs}` and `echo ${port_gcc_libs}`" + rc=1 + fi + done <<-EOT + $(list_stagedir_elfs | \ + file -F $'\1' -f - | \ + grep -a 'ELF.*FreeBSD.*dynamically linked' | \ + cut -f 1 -d $'\1'| \ + sed -e 's/^\.//') + EOT + + return ${rc} +} + checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" -checks="$checks proxydeps sonames perlcore no_arch" +checks="$checks proxydeps sonames perlcore no_arch badlibmix" ret=0 cd ${STAGEDIR}