Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dev-lang/fpc-2.4.2 ebuild
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message

Joined: 24 Feb 2008
Posts: 194
Location: Polska

PostPosted: Fri Apr 15, 2011 9:54 am    Post subject: dev-lang/fpc-2.4.2 ebuild Reply with quote

It seems no-one takes care of the dev-lang/fpc ebuilds any longer. The last one found in portage is for version 2.4.0, which is about year-and-a-half old. The most useful, current version (2.4.2) is already half year old, but unavailable for gentoo users. This makes using dev-lang/lazarus hard because of the outdated compiler (most problems on lazarus forums are discussed with reference to version 2.4.2 of Free Pascal Compiler).

So I decided to give it a try and created an ebuild that works for me (based on the one for version 2.4.0). This is rather crude, but it works for me. Please test!

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $


inherit eutils

RESTRICT="strip" #269221


DESCRIPTION="Free Pascal Compiler"
   amd64? ( mirror://sourceforge/${MY_PN}/Linux/${PV}/${P}.x86_64-linux.tar )
   x86? ( mirror://sourceforge/${MY_PN}/Linux/${PV}/${P}.i386-linux.tar )
   source? ( mirror://sourceforge/${MY_PN}/Source/${PV}/${P}.source.tar.gz )"

IUSE="doc source"

#   >=sys-devel/binutils-2.19.1-r1"

src_unpack() {
   case ${ARCH} in
      x86)   FPC_ARCH="386" ;;
      ppc)   FPC_ARCH="ppc" ;;
      amd64)   FPC_ARCH="x86_64" ;;
      sparc)   FPC_ARCH="sparc" ;;
      *)   die "This ebuild doesn't support ${ARCH}." ;;

   unpack ${A} || die "Unpacking ${A} failed!"

   #cd "${WORKDIR}"
   #for comp in *.deb; do
   #   ebegin "  Unpacking $comp"
   #   ar x "$comp"
   #   tar jxf data.tar.bz2
   #   eend $?

   #tar -xf binary.${FPC_ARCH}-linux.tar || die "Unpacking binary.${FPC_ARCH}-linux.tar failed!"
   unpack ./binary.${FPC_ARCH}-linux.tar || die "Unpacking binary.${FPC_ARCH}-linux.tar failed!"
   unpack ./base.${FPC_ARCH}-linux.tar.gz || die "Unpacking base.${FPC_ARCH}-linux.tar.gz failed!"
   #tar -xzf base.${FPC_ARCH}-linux.tar.gz || die "Unpacking base.${FPC_ARCH}-linux.tar.gz failed!"

   cd "${S}"
   sed -i -e 's/ -Xs / /g' $(find . -name Makefile) || die "sed failed"

set_pp() {
   case ${1} in
   bootstrap)   pp="${WORKDIR}"/lib/fpc/${PV_BIN}/ppc${FPC_ARCH} ;;
   new)    pp="${S}"/compiler/ppc${FPC_ARCH} ;;
   *)   die "set_pp: unknown argument: ${1}" ;;

src_compile() {
   case ${ARCH} in
      x86)   FPC_ARCH="386" ;;
      ppc)   FPC_ARCH="ppc" ;;
      amd64)   FPC_ARCH="x64" ;;
      sparc)   FPC_ARCH="sparc" ;;
      *)   die "This ebuild doesn't support ${ARCH}." ;;
   local pp

   # Using the bootstrap compiler.
   set_pp bootstrap

   emake -j1 PP="${pp}" compiler_cycle || die "make compiler_cycle failed!"

   # Save new compiler from cleaning...
   cp "${S}"/compiler/ppc${FPC_ARCH} "${S}"/ppc${FPC_ARCH}.new

   # ...rebuild with current version...
   emake -j1 PP="${S}"/ppc${FPC_ARCH}.new compiler_cycle || die "make compiler_cycle failed!"

   # ..and clean up afterwards
   rm "${S}"/ppc${FPC_ARCH}.new

   # Using the new compiler.
   set_pp new

   emake -j1 PP="${pp}" rtl_clean || die "make rtl_clean failed"

   emake -j1 PP="${pp}" rtl packages_all utils || die "make failed"

src_install() {
   local pp
   set_pp new

   set -- PP="${pp}" FPCMAKE="${S}/utils/fpcm/fpcmake" \
      INSTALL_PREFIX="${D}"usr \
      INSTALL_DOCDIR="${D}"usr/share/doc/${P} \
      INSTALL_MANDIR="${D}"usr/share/man \

   emake -j1 "$@" compiler_install rtl_install packages_install \
      utils_install || die "make install failed!"

   dosym ../lib/fpc/${PV}/ppc${FPC_ARCH} /usr/bin/ppc${FPC_ARCH}

   #cd "${S}"/../install/doc
   #emake -j1 "$@" installdoc || die "make installdoc failed!"

   cd "${S}"/../man
   doman man1/*.1 man5/*.5
   #emake -j1 "$@" installman || die "make installman failed!"

   if use doc ; then
      cd "${S}"/../share/doc || die
      insinto /usr/share/doc/${P}
      doins -r * || die "doins fpdocs failed"
      newins "${WORKDIR}"/fpc-${PV}-fpctoc.htx fpctoc.htx || die "newins fpctoc.htx failed"

   if use source ; then
      cd "${S}"
      emake -j1 PP="${D}"usr/bin/ppc${FPC_ARCH} "$@" sourceinstall || die "make sourceinstall failed!"
      find "${D}"usr/lib/fpc/${PV}/source -name '*.o' -exec rm {} \;

   "${D}"usr/lib/fpc/${PV}/samplecfg "${D}"usr/lib/fpc/${PV} "${D}"etc || die "samplecfg failed"
   sed -i -e "s:${D}:/:g" "${D}"etc/fpc.cfg || die "sed fpc.cfg failed"

   rm -rf "${D}"usr/lib/fpc/lexyacc

I'm sure it needs some cleanup - please help!

EDIT: posted at the bugzilla as well: 363677
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum