--- /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-25 09:20:11.393722984 -0600 @@ -22,10 +22,13 @@ 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 + local sed_args=( -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" ) + if [[ ${CHOST} == *-darwin* ]] ; then + sed_args+=( -e "s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/libunrar$(get_libname ${PV%.*.*}):" ) + else + sed_args+=( -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" ) + fi + sed -i "${sed_args[@]}" makefile } src_compile() {