unrar-5.4.5.ebuild 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils flag-o-matic multilib toolchain-funcs
  5. MY_PN=${PN}src
  6. DESCRIPTION="Uncompress rar files"
  7. HOMEPAGE="http://www.rarlab.com/rar_add.htm"
  8. SRC_URI="http://www.rarlab.com/rar/${MY_PN}-${PV}.tar.gz"
  9. LICENSE="unRAR"
  10. SLOT="0"
  11. KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x86-solaris"
  12. IUSE=""
  13. RDEPEND="!<=app-arch/unrar-gpl-0.0.1_p20080417"
  14. S=${WORKDIR}/unrar
  15. src_prepare() {
  16. epatch "${FILESDIR}"/${PN}-5.0.2-build.patch
  17. epatch "${FILESDIR}"/${PN}-5.2.2-no-auto-clean.patch #528218
  18. local sed_args=( -e "/libunrar/s:.so:$(get_libname ${PV%.*.*}):" )
  19. if [[ ${CHOST} == *-darwin* ]] ; then
  20. sed_args+=( -e "s:-shared:-dynamiclib -install_name ${EPREFIX}/usr/$(get_libdir)/libunrar$(get_libname ${PV%.*.*}):" )
  21. else
  22. sed_args+=( -e "s:-shared:& -Wl,-soname -Wl,libunrar$(get_libname ${PV%.*.*}):" )
  23. fi
  24. sed -i "${sed_args[@]}" makefile || die
  25. }
  26. src_configure() {
  27. mkdir -p build-{lib,bin}
  28. printf 'VPATH = ..\ninclude ../makefile' > build-lib/Makefile || die
  29. cp build-{lib,bin}/Makefile || die
  30. }
  31. src_compile() {
  32. unrar_make() {
  33. emake CXX="$(tc-getCXX)" CXXFLAGS="${CXXFLAGS}" STRIP=true "$@"
  34. }
  35. unrar_make CXXFLAGS+=" -fPIC" -C build-lib lib
  36. ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname) || die
  37. ln -s libunrar$(get_libname ${PV%.*.*}) build-lib/libunrar$(get_libname ${PV}) || die
  38. unrar_make -C build-bin
  39. }
  40. src_install() {
  41. dobin build-bin/unrar
  42. dodoc readme.txt
  43. dolib.so build-lib/libunrar*
  44. insinto /usr/include/libunrar${PV%.*.*}
  45. doins *.hpp
  46. dosym libunrar${PV%.*.*} /usr/include/libunrar
  47. }