axiom-200805.ebuild 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Copyright 1999-2012 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=4
  4. inherit eutils multilib flag-o-matic
  5. DESCRIPTION="Axiom is a general purpose Computer Algebra system"
  6. HOMEPAGE="http://axiom.axiom-developer.org/"
  7. SRC_URI="http://www.axiom-developer.org/axiom-website/downloads/${PN}-may2008-src.tgz"
  8. LICENSE="BSD-2"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~x86"
  11. IUSE=""
  12. # NOTE: Do not strip since this seems to remove some crucial
  13. # runtime paths as well, thereby, breaking axiom
  14. RESTRICT="strip"
  15. DEPEND="virtual/latex-base
  16. x11-libs/libXaw
  17. sys-apps/debianutils
  18. sys-process/procps"
  19. RDEPEND=""
  20. S="${WORKDIR}"/${PN}
  21. pkg_setup() {
  22. # for 2.6.25 kernels and higher we need to have
  23. # /proc/sys/kernel/randomize_va_space set to somthing other
  24. # than 2, otherwise gcl fails to compile (see bug #186926).
  25. local current_setting=$(/sbin/sysctl kernel.randomize_va_space 2>/dev/null | cut -d' ' -f3)
  26. if [[ ${current_setting} == 2 ]]; then
  27. echo
  28. eerror "Your kernel has brk randomization enabled. This will"
  29. eerror "cause axiom to fail to compile *and* run (see bug #186926)."
  30. eerror "You can issue:"
  31. eerror
  32. eerror " /sbin/sysctl -w kernel.randomize_va_space=1"
  33. eerror
  34. eerror "as root to turn brk randomization off temporarily."
  35. eerror "However, when not using axiom you may want to turn"
  36. eerror "brk randomization back on via"
  37. eerror
  38. eerror " /sbin/sysctl -w kernel.randomize_va_space=2"
  39. eerror
  40. eerror "since it results in a less secure kernel."
  41. die "Kernel brk randomization detected"
  42. fi
  43. }
  44. src_prepare() {
  45. cp "${FILESDIR}"/noweb-2.9-insecure-tmp-file.patch.input \
  46. "${S}"/zips/noweb-2.9-insecure-tmp-file.patch \
  47. || die "Failed to fix noweb"
  48. cp "${FILESDIR}"/${PN}-200711-gcl-configure.patch \
  49. "${S}"/zips/gcl-2.6.7.configure.in.patch \
  50. || die "Failed to fix gcl-2.6.7 configure"
  51. epatch "${FILESDIR}"/noweb-2.9-insecure-tmp-file.Makefile.patch
  52. # lots of strict-aliasing badness
  53. append-flags -fno-strict-aliasing
  54. }
  55. src_compile() {
  56. # use gcl 2.6.7
  57. sed -e "s:GCLVERSION=gcl-2.6.8pre$:GCLVERSION=gcl-2.6.7:" \
  58. -i Makefile.pamphlet Makefile \
  59. || die "Failed to select proper gcl"
  60. # fix libXpm.a location
  61. sed -e "s:X11R6/lib:$(get_libdir):g" -i Makefile.pamphlet \
  62. || die "Failed to fix libXpm lib paths"
  63. # Let the fun begin...
  64. AXIOM="${S}"/mnt/linux emake -j1
  65. }
  66. src_install() {
  67. emake DESTDIR="${D}"/opt/axiom COMMAND="${D}"/opt/axiom/mnt/linux/bin/axiom install
  68. mv "${D}"/opt/axiom/mnt/linux/* "${D}"/opt/axiom \
  69. || die "Failed to mv axiom into its final destination path."
  70. rm -fr "${D}"/opt/axiom/mnt \
  71. || die "Failed to remove old directory."
  72. dodir /usr/bin
  73. dosym /opt/axiom/bin/axiom /usr/bin/axiom
  74. sed -e "2d;3i AXIOM=/opt/axiom" \
  75. -i "${D}"/opt/axiom/bin/axiom \
  76. || die "Failed to patch axiom runscript!"
  77. dodoc changelog readme faq
  78. }