file-5.30.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. PYTHON_COMPAT=( python2_7 python3_{4,5,6} 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 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  14. fi
  15. DESCRIPTION="identify a file's format by scanning binary data for patterns"
  16. HOMEPAGE="http://www.darwinsys.com/file/ http://mx.gw.com/pipermail/file/"
  17. LICENSE="BSD-2"
  18. SLOT="0"
  19. IUSE="python static-libs zlib"
  20. DEPEND="
  21. python? (
  22. ${PYTHON_DEPS}
  23. dev-python/setuptools[${PYTHON_USEDEP}]
  24. )
  25. zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
  26. RDEPEND="${DEPEND}
  27. python? ( !dev-python/python-magic )"
  28. src_prepare() {
  29. [[ ${PV} == "9999" ]] && eautoreconf
  30. elibtoolize
  31. # don't let python README kill main README #60043
  32. mv python/README{,.python}
  33. }
  34. multilib_src_configure() {
  35. ECONF_SOURCE=${S} \
  36. econf \
  37. --enable-fsect-man5 \
  38. $(use_enable static-libs static) \
  39. $(use_enable zlib)
  40. }
  41. src_configure() {
  42. # when cross-compiling, we need to build up our own file
  43. # because people often don't keep matching host/target
  44. # file versions #362941
  45. if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
  46. mkdir -p "${WORKDIR}"/build
  47. cd "${WORKDIR}"/build
  48. tc-export_build_env BUILD_C{C,XX}
  49. ECONF_SOURCE=${S} \
  50. ac_cv_header_zlib_h=no \
  51. ac_cv_lib_z_gzopen=no \
  52. CHOST=${CBUILD} \
  53. CFLAGS=${BUILD_CFLAGS} \
  54. CXXFLAGS=${BUILD_CXXFLAGS} \
  55. CPPFLAGS=${BUILD_CPPFLAGS} \
  56. LDFLAGS="${BUILD_LDFLAGS} -static" \
  57. CC=${BUILD_CC} \
  58. CXX=${BUILD_CXX} \
  59. econf --disable-shared
  60. fi
  61. multilib-minimal_src_configure
  62. }
  63. multilib_src_compile() {
  64. if multilib_is_native_abi ; then
  65. emake
  66. else
  67. cd src
  68. emake magic.h #586444
  69. emake libmagic.la
  70. fi
  71. }
  72. src_compile() {
  73. if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
  74. emake -C "${WORKDIR}"/build/src magic.h #586444
  75. emake -C "${WORKDIR}"/build/src file
  76. PATH="${WORKDIR}/build/src:${PATH}"
  77. fi
  78. multilib-minimal_src_compile
  79. use python && cd python && distutils-r1_src_compile
  80. }
  81. multilib_src_install() {
  82. if multilib_is_native_abi ; then
  83. default
  84. else
  85. emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
  86. fi
  87. }
  88. multilib_src_install_all() {
  89. dodoc ChangeLog MAINT README
  90. use python && cd python && distutils-r1_src_install
  91. prune_libtool_files
  92. }