ggnfs-0.77.1-r2.ebuild 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils
  5. DESCRIPTION="A suite of algorithms to help factoring large integers"
  6. # inactive old homepage exists, this is a fork
  7. HOMEPAGE="https://github.com/radii/ggnfs"
  8. # snapshot because github makes people stupid
  9. SRC_URI="
  10. http://dev.gentooexperimental.org/~dreeevil/${P}.zip
  11. http://stuff.mit.edu/afs/sipb/project/pari-gp/ggnfs/Linux/src/def-par.txt
  12. http://stuff.mit.edu/afs/sipb/project/pari-gp/ggnfs/Linux/src/def-nm-params.txt
  13. http://gentooexperimental.org/~patrick/ggnfs-doc.pdf"
  14. SLOT="0"
  15. LICENSE="GPL-2"
  16. KEYWORDS="~amd64 ~x86"
  17. IUSE=""
  18. DEPEND=">=dev-libs/gmp-4.3:0
  19. app-arch/unzip"
  20. RDEPEND="${DEPEND}
  21. !sci-mathematics/cado-nfs" # file collisions, fixable
  22. S=${WORKDIR}/${PN}-master
  23. src_prepare() {
  24. epatch "${FILESDIR}"/${P}-gentoo.patch
  25. echo "#define GGNFS_VERSION \"0.77.1-$ARCH\"" > include/version.h || die
  26. # fix directory symlink, add missing targets, rewrite variable used by portage internally
  27. cd src/lasieve4 && rm -f -r asm && ln -s ppc32 asm || die
  28. sed -i -e 's/all: liblasieve.a/all: liblasieve.a liblasieveI11.a liblasieveI15.a liblasieveI16.a/' asm/Makefile || die
  29. cd "${S}"
  30. sed -i -e 's/ARCH/MARCH/g' Makefile src/Makefile || die
  31. sed -i -e 's/$(LSBINS) strip/$(LSBINS)/' src/Makefile || die #No stripping!
  32. sed -i -e 's/SVN \$Revision\$/0.77.1 snapshot/' src/experimental/lasieve4_64/gnfs-lasieve4e.c src/lasieve4/gnfs-lasieve4e.c || die
  33. tc-export CC
  34. }
  35. src_configure() { :; }
  36. src_compile() {
  37. # setting MARCH like this is fugly, but it uses -march=$ARCH - better fix welcome
  38. # it also assumes a recent-ish compiler
  39. cd src
  40. HOST="generic" MARCH="${ARCH}" emake -j1
  41. }
  42. src_install() {
  43. mkdir -p "${D}/usr/bin/"
  44. for i in gnfs-lasieve4I11e gnfs-lasieve4I12e gnfs-lasieve4I13e gnfs-lasieve4I14e \
  45. gnfs-lasieve4I15e gnfs-lasieve4I16e makefb matbuild matprune matsolve pol51m0b pol51m0n \
  46. pol51opt polyselect procrels sieve sqrt; do
  47. cp "${S}/bin/${i}" "${D}/usr/bin/" || die
  48. done
  49. mkdir -p "${D}/usr/share/doc/${PN}"
  50. cp "${DISTDIR}/def-par.txt" "${D}/usr/share/doc/${PN}" || die
  51. cp "${DISTDIR}/def-nm-params.txt" "${D}/usr/share/doc/${PN}" || die
  52. docompress -x "/usr/share/doc/${PN}/def-par.txt"
  53. docompress -x "/usr/share/doc/${PN}/def-nm-params.txt"
  54. # TODO: docs? File collisions?
  55. cp ${DISTDIR}/ggnfs-doc.pdf "${D}/usr/share/doc/${PN}" || die
  56. }