file-5.25.ebuild 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python{2_7,3_4} pypy )
  5. DISTUTILS_OPTIONAL=1
  6. inherit eutils distutils-r1 libtool toolchain-funcs multilib-minimal
  7. if [[ ${PV} == "9999" ]] ; then
  8. EGIT_REPO_URI="git://github.com/glensc/file.git"
  9. inherit autotools git-r3
  10. else
  11. SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz
  12. ftp://ftp.gw.com/mirrors/pub/unix/file/${P}.tar.gz"
  13. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
  14. fi
  15. DESCRIPTION="identify a file's format by scanning binary data for patterns"
  16. HOMEPAGE="http://www.darwinsys.com/file/"
  17. LICENSE="BSD-2"
  18. SLOT="0"
  19. IUSE="python static-libs zlib"
  20. DEPEND="python? ( ${PYTHON_DEPS} )
  21. zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
  22. RDEPEND="${DEPEND}
  23. python? ( !dev-python/python-magic )"
  24. src_prepare() {
  25. [[ ${PV} == "9999" ]] && eautoreconf
  26. elibtoolize
  27. # don't let python README kill main README #60043
  28. mv python/README{,.python}
  29. }
  30. multilib_src_configure() {
  31. ECONF_SOURCE=${S} \
  32. ac_cv_header_zlib_h=$(usex zlib) \
  33. ac_cv_lib_z_gzopen=$(usex zlib)
  34. econf \
  35. $(use_enable static-libs static)
  36. }
  37. src_configure() {
  38. # when cross-compiling, we need to build up our own file
  39. # because people often don't keep matching host/target
  40. # file versions #362941
  41. if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
  42. mkdir -p "${WORKDIR}"/build
  43. cd "${WORKDIR}"/build
  44. tc-export_build_env BUILD_C{C,XX}
  45. ECONF_SOURCE=${S} \
  46. ac_cv_header_zlib_h=no \
  47. ac_cv_lib_z_gzopen=no \
  48. CHOST=${CBUILD} \
  49. CFLAGS=${BUILD_CFLAGS} \
  50. CXXFLAGS=${BUILD_CXXFLAGS} \
  51. CPPFLAGS=${BUILD_CPPFLAGS} \
  52. LDFLAGS="${BUILD_LDFLAGS} -static" \
  53. CC=${BUILD_CC} \
  54. CXX=${BUILD_CXX} \
  55. econf --disable-shared
  56. fi
  57. multilib-minimal_src_configure
  58. }
  59. multilib_src_compile() {
  60. if multilib_is_native_abi ; then
  61. emake
  62. else
  63. emake -C src libmagic.la
  64. fi
  65. }
  66. src_compile() {
  67. if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
  68. emake -C "${WORKDIR}"/build/src file
  69. PATH="${WORKDIR}/build/src:${PATH}"
  70. fi
  71. multilib-minimal_src_compile
  72. use python && cd python && distutils-r1_src_compile
  73. }
  74. multilib_src_install() {
  75. if multilib_is_native_abi ; then
  76. default
  77. else
  78. emake -C src install-{includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
  79. fi
  80. }
  81. multilib_src_install_all() {
  82. dodoc ChangeLog MAINT README
  83. use python && cd python && distutils-r1_src_install
  84. prune_libtool_files
  85. }