--- /usr/portage/app-arch/unrar/unrar-5.1.2.ebuild 2014-04-11 15:58:50.000000000 -0600 +++ unrar-5.1.2.ebuild 2014-04-17 14:07:18.587218507 -0600 @@ -22,10 +22,17 @@ src_prepare() { epatch "${FILESDIR}"/${PN}-5.0.2-build.patch - sed -i \ - -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" \ - -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" \ - makefile || die + if [[ ${CHOST} == *-darwin* ]] ; then + sed -i \ + -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" \ + -e "s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/lib/libunrar$(get_libname ${PV%.*.*}):" \ + makefile || die + else + sed -i \ + -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" \ + -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" \ + makefile || die + fi } src_compile() {