fpc-3.2.0.ebuild 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Copyright 1999-2020 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=7
  4. inherit prefix toolchain-funcs
  5. HOMEPAGE="https://www.freepascal.org/"
  6. DESCRIPTION="Free Pascal Compiler"
  7. FPCV="3.2.0"
  8. SRC_URI="ftp://ftp.freepascal.org/pub/fpc/dist/3.2.0/source/fpc-${FPCV}.source.tar.gz
  9. ftp://ftp.freepascal.org/pub/fpc/dist/3.2.0/source/fpcbuild-${FPCV}.tar.gz
  10. amd64? ( ftp://ftp.freepascal.org/pub/fpc/dist/3.2.0/x86_64-linux/fpc-${FPCV}-x86_64-linux.tar )
  11. x86? ( ftp://ftp.freepascal.org/pub/fpc/dist/3.2.0/i386-linux/fpc-${FPCV}.i386-linux.tar )
  12. doc? ( mirror://sourceforge/freepascal/Documentation/${FPCV}/doc-html.tar.gz -> ${P}-doc-html.tar.gz )"
  13. SLOT="0"
  14. LICENSE="GPL-2 LGPL-2.1-with-linking-exception"
  15. KEYWORDS="~amd64 ~x86"
  16. IUSE="doc source"
  17. RESTRICT="strip" #269221
  18. S=${WORKDIR}/fpcbuild-${FPCV}/fpcsrc
  19. pkg_pretend() {
  20. if [[ ${MERGE_TYPE} != binary ]]; then
  21. # Bug 475210
  22. if $(tc-getLD) --version | grep -q "GNU gold"; then
  23. eerror "fpc does not function correctly when built with the gold linker."
  24. eerror "Please select the bfd linker with binutils-config."
  25. die "GNU gold detected"
  26. fi
  27. fi
  28. }
  29. src_unpack() {
  30. case ${ARCH} in
  31. amd64) FPC_ARCH="x86_64" PV_BIN="${FPCV}-" ;;
  32. x86) FPC_ARCH="i386" PV_BIN="${FPCV}." ;;
  33. *) die "This ebuild doesn't support ${ARCH}." ;;
  34. esac
  35. unpack ${A}
  36. tar -xf ${PN}-${PV_BIN}${FPC_ARCH}-linux/binary.${FPC_ARCH}-linux.tar || die "Unpacking binary.${FPC_ARCH}-linux.tar failed!"
  37. tar -xzf base.${FPC_ARCH}-linux.tar.gz || die "Unpacking base.${FPC_ARCH}-linux.tar.gz failed!"
  38. }
  39. src_prepare() {
  40. default
  41. PV_BIN="${FPCV}"
  42. find "${WORKDIR}" -name Makefile -exec sed -i -e 's/ -Xs / /g' {} + || die
  43. # let the pkg manager compress man files
  44. sed -i '/find man.* gzip /d' "${WORKDIR}"/fpcbuild-${PV_BIN}/install/man/Makefile || die
  45. # make the compiled binary check for fpc.cfg under the prefixed /etc/ path
  46. hprefixify "${WORKDIR}"/fpcbuild-${PV_BIN}/fpcsrc/compiler/options.pas
  47. }
  48. set_pp() {
  49. case ${ARCH} in
  50. amd64) FPC_ARCH="x64" FPC_PARCH="x86_64" ;;
  51. x86) FPC_ARCH="386" FPC_PARCH="i386" ;;
  52. *) die "This ebuild doesn't support ${ARCH}." ;;
  53. esac
  54. case ${1} in
  55. bootstrap) pp="${WORKDIR}"/lib/fpc/3.2.0/ppc${FPC_ARCH} ;;
  56. new) pp="${S}"/compiler/ppc${FPC_ARCH} ;;
  57. *) die "set_pp: unknown argument: ${1}" ;;
  58. esac
  59. }
  60. src_compile() {
  61. local pp
  62. # Using the bootstrap compiler.
  63. set_pp bootstrap
  64. emake PP="${pp}" compiler_cycle AS="$(tc-getAS)"
  65. # Save new compiler from cleaning...
  66. cp "${S}"/compiler/ppc${FPC_ARCH} "${S}"/ppc${FPC_ARCH}.new || die
  67. # ...rebuild with current version...
  68. emake PP="${S}"/ppc${FPC_ARCH}.new AS="$(tc-getAS)" compiler_cycle
  69. # ..and clean up afterwards
  70. rm "${S}"/ppc${FPC_ARCH}.new || die
  71. # Using the new compiler.
  72. set_pp new
  73. emake PP="${pp}" AS="$(tc-getAS)" rtl_clean
  74. emake PP="${pp}" AS="$(tc-getAS)" rtl packages_all utils
  75. }
  76. src_install() {
  77. local pp
  78. set_pp new
  79. #fpcbuild-3.0.0/utils/fpcm/fpcmake
  80. #${WORKDIR}/${PN}build-${PV}/utils/fpcm/fpcmake"
  81. #fpcbuild-3.0.0/fpcsrc/utils/fpcm/bin/x86_64-linux/fpcmake
  82. set -- PP="${pp}" FPCMAKE="${S}/utils/fpcm/bin/${FPC_PARCH}-linux/fpcmake" \
  83. INSTALL_PREFIX="${ED}"/usr \
  84. INSTALL_DOCDIR="${ED}"/usr/share/doc/${PF} \
  85. INSTALL_MANDIR="${ED}"/usr/share/man \
  86. INSTALL_SOURCEDIR="${ED}"/usr/lib/fpc/${FPCV}/source
  87. emake "$@" compiler_install rtl_install packages_install utils_install
  88. mkdir "${ED}"/usr/lib64
  89. mv "${ED}"/usr/lib/libpas2jslib.so "${ED}"/usr/lib64/libpas2jslib.so
  90. dosym ../lib/fpc/${FPCV}/ppc${FPC_ARCH} /usr/bin/ppc${FPC_ARCH}
  91. cd "${S}"/../install/doc || die
  92. emake "$@" installdoc
  93. cd "${S}"/../install/man || die
  94. emake "$@" installman
  95. if use doc ; then
  96. cd "${S}"/../fpcdocs || die
  97. dodoc -r *
  98. fi
  99. if use source ; then
  100. cd "${S}" || die
  101. shift
  102. emake PP="${ED}"/usr/bin/ppc${FPC_ARCH} "$@" sourceinstall
  103. find "${ED}"/usr/lib/fpc/${FPCV}/source -name '*.o' -exec rm {} \;
  104. fi
  105. "${ED}"/usr/lib/fpc/${FPCV}/samplecfg "${ED}"/usr/lib/fpc/${FPCV} "${ED}"/etc || die
  106. # set correct (prefixed) path for e.g. unit files
  107. sed -i "s:${ED}:${EPREFIX}:g" "${ED}"/etc/fpc.cfg || die
  108. rm -r "${ED}"/usr/lib/fpc/lexyacc || die
  109. }
  110. pkg_postinst() {
  111. if [[ -z ${REPLACING_VERSIONS} ]] && use ide; then
  112. einfo "To read the documentation in the fpc IDE, enable the doc USE flag"
  113. fi
  114. }