[aur-general] Packaging LLVM

Tobias Kieslich tobias at justdreams.de
Mon Oct 26 20:04:18 EDT 2009


On Mon, 26 Oct 2009, Ranguvar wrote:

> Sorry, no idea what you're talking about in that first paragraph?
http://aur.archlinux.org/packages.php?ID=20222
latest  comment by neri (i attach my personal latest PKGBUILD to this
mail)
> Where is the PKGBUILD?  And what do you mean by scan-* wrappers?
scan-build and scan-view and the deps are not installed by default, the
PKGBUILD copies them manually. The are used to invoke the static
analyzer.

	-T

> 
> On Mon, Oct 26, 2009 at 7:16 PM, Tobias Kieslich <tobias at justdreams.de>wrote:
> 
> > Thanks,
> >
> > I posted my llvm-clang-svn PKGBUILD in AUR, not all of the things made
> > it into the actual build. I like to have all scan-* wrappers included as
> > they are handy and depend on each other (scan-build -V invokes
> > scan-view automatically after a test build). They PKGBUILD is in the
> > comments of the package.
> >
> > If you look at the llvm binaries provided you'll see the clang package
> > is bigger than the gcc stuff. However, the way they package it makes me
> > think it might be trick to separate clang from llvm but it sure is worth
> > a try.
> >
> >        -T
> >
> > On Mon, 26 Oct 2009, Ranguvar wrote:
> >
> > > Very well, I'll make a prototype PKGBUILD that has sections for each
> > install
> > > and then post it here, good luck :)
> > >
> > > I do think it odd though that Clang would be larger than GCC, I guess
> > we'll
> > > have to see.
> > >
> >
-------------- next part --------------
# Contributor: Roberto Alsina <ralsina at kde.org>
# Contributor: Tomas Lindquist Olsen <tomas at famolsen.dk>
# Contributor: Anders Bergh <anders at archlinuxppc.org>
# Contributor: Tobias Kieslich [tobias funnychar archlinux dot org]
pkgname=llvm-clang-svn
pkgver=85149
pkgrel=1
pkgdesc="Low Level Virtual Machine - Compiler infrastructure"
arch=('i686' 'x86_64')
url="http://llvm.org"
license=(custom:"University of Illinois/NCSA Open Source License")
depends=('libtool' 'libelf' 'gcc-libs')
makedepends=('gcc' 'subversion')
optdepends=('perl:    the scan-build tool for the clang static analyzer' \
            'python:  the helpers for the scan-view tool')
provides=('llvm')
conflicts=('llvm')
source=()
md5sums=()

# this is always the latest svn so debug info can be useful
# but llvm was always very stable for me
#options=('!strip')

_svntrunk=http://llvm.org/svn/llvm-project/llvm/trunk
_svnmod=llvm

build() {
  cd ${srcdir}

  if [ -d ${_svnmod}/.svn ]; then
    (cd ${_svnmod} && svn up -r ${pkgver})
  else
    svn co ${_svntrunk} --config-dir ./ -r ${pkgver} ${_svnmod}
  fi

  msg "SVN checkout done or server timeout"
  msg "Starting make..."

  rm -r ${srcdir}/${_svnmod}-build
  svn export ${_svnmod} ${_svnmod}-build

  # get clang in here
  cd ${srcdir}
  if [ -d clang/.svn ]; then
    (cd clang && svn up)
    cd ${srcdir}
  else
    svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
  fi
  svn export clang ${_svnmod}-build/tools/clang

  cd ${_svnmod}-build

  # prepare the build
  # remove docs from the make targets
  # sed 's:runtime docs:runtime:' -i Makefile || return 1
  # remove examples projects and bindings from the make targets
  sed 's:examples projects bindings::' -i Makefile || return 1
  # remove libHello transformation
  sed 's: Hello::' -i lib/Transforms/Makefile || return 1

  # start the build - FIXME: make that libexec thing working for clang stuff
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/clang \
    --enable-optimized \
    --enable-assertions \
    --enable-pic \
    --enable-targets=host-only \
    --disable-bindings \
    --enable-shared \
    --enable-static \
    --disable-expensive-checks || return 1

  make -j2 || return 1
  make DESTDIR=${pkgdir} install || return 1

  install -Dm644 ${srcdir}/llvm-build/LICENSE.TXT \
    ${pkgdir}/usr/share/licenses/llvm/COPYING
  # install scan-build tool
  cd tools/clang/utils
  install -dm755 "${pkgdir}/usr/lib/clang/libexec"
  install -m755 scan-build    ccc-analyzer "${pkgdir}/usr/lib/clang/"
  install -m644 scanview.css  sorttable.js "${pkgdir}/usr/lib/clang/"
  # make scan-build available from path
  ln -s /usr/lib/clang/scan-build "${pkgdir}/usr/bin/scan-build"
  # make clang-cc available for scan-build (/usr/libexec is not searched but if we move the binary
  # clang-cc doesn't find the header files ... bummer)
  ln -s /usr/libexec/clang-cc "${pkgdir}/usr/lib/clang/libexec/clang-cc"
  cd ../tools/scan-view
  cp -pr Reporter.py Resources ScanView.py scan-view startfile.py "${pkgdir}/usr/lib/clang/"
  ln -s /usr/lib/clang/scan-view "${pkgdir}/usr/bin/scan-view"

  # no docs please -- these are justps and html formatted manpages
  rm -rf ${pkgdir}/usr/docs
}


More information about the aur-general mailing list