Skip to content

Instantly share code, notes, and snippets.

@zman0900 zman0900/PKGBUILD
Last active Aug 29, 2015

Embed
What would you like to do?
lib32-llvm-svn PKGBUILD
# Maintainer: Christian Babeux <christian.babeux@0x80.ca>
# Contributor: Thomas Dziedzic < gostrc at gmail >
# Contributor: Roberto Alsina <ralsina@kde.org>
# Contributor: Tomas Lindquist Olsen <tomas@famolsen.dk>
# Contributor: Anders Bergh <anders@archlinuxppc.org>
# Contributor: Tomas Wilhelmsson <tomas.wilhelmsson@gmail.com>
pkgbase=lib32-llvm-svn
pkgname=lib32-llvm-svn
true && pkgname=('lib32-llvm-svn' 'lib32-llvm-libs-svn')
_pkgname='lib32-llvm'
pkgver=202215
pkgrel=1
pkgdesc='Low Level Virtual Machine - Compiler infrastructure.'
arch=('x86_64')
url="http://llvm.org"
license=('custom:University of Illinois')
makedepends=('subversion' 'lib32-libffi' 'lib32-zlib' 'python2' 'gcc-multilib')
# this is always the latest svn so debug info can be useful
options=('staticlibs' '!strip')
source=("${_pkgname}::svn+http://llvm.org/svn/llvm-project/llvm/trunk"
"compiler-rt::svn+http://llvm.org/svn/llvm-project/compiler-rt/trunk")
sha1sums=('SKIP'
'SKIP')
pkgver()
{
cd "$SRCDEST/${_pkgname}"
svnversion | tr -d [A-z]
}
prepare() {
cd "${srcdir}/${_pkgname}"
rm -rf tools/clang
rm -rf projects/compiler-rt
mv "$srcdir/compiler-rt" projects/compiler-rt
# Fix installation directories, ./configure doesn't seem to set them right
sed -i -e 's:\$(PROJ_prefix)/lib:$(PROJ_prefix)/lib32:' \
-e 's:\$(PROJ_prefix)/docs/llvm:$(PROJ_prefix)/share/doc/llvm:' \
Makefile.config.in
sed -i '/ActiveLibDir = ActivePrefix/s:lib:lib32:' \
tools/llvm-config/llvm-config.cpp
sed -i 's:LLVM_LIBDIR="${prefix}/lib":LLVM_LIBDIR="${prefix}/lib32":' \
autoconf/configure.ac \
configure
# Fix insecure rpath (http://bugs.archlinux.org/task/14017)
sed -i 's:$(RPATH) -Wl,$(\(ToolDir\|LibDir\|ExmplDir\))::g' Makefile.rules
}
build()
{
cd "${srcdir}/${_pkgname}"
export CC="gcc -m32"
export CXX="g++ -m32"
export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
# Apply strip option to configure
_optimized_switch="enable"
[[ $(check_option strip) == n ]] && _optimized_switch="disable"
# Include location of libffi headers in CPPFLAGS
CPPFLAGS+=" $(pkg-config --cflags libffi)"
# We had to force host and target to get
# a proper triplet reported by llvm
./configure \
--prefix=/usr \
--libdir=/usr/lib32 \
--sysconfdir=/etc \
--enable-shared \
--enable-libffi \
--enable-targets=all \
--disable-expensive-checks \
--disable-debug-runtime \
--disable-assertions \
--with-binutils-include=/usr/include \
--with-python=/usr/bin/python2 \
--host=i386-pc-linux-gnu \
--target=i386-pc-linux-gnu \
--$_optimized_switch-optimized
make REQUIRES_RTTI=1
}
package_lib32-llvm-svn() {
pkgdesc="Low Level Virtual Machine (32-bit)"
depends=("lib32-llvm-libs-svn=$pkgver-$pkgrel" 'llvm')
provides=('lib32-llvm')
conflicts=('lib32-llvm')
cd "${srcdir}/${_pkgname}"
# -j1 is due to race conditions during the installation of the OCaml bindings
make -j1 DESTDIR="$pkgdir" install
# The runtime library goes into lib32-llvm-libs
mv $pkgdir/usr/lib32/libLLVM-*.so "$srcdir"
# OCaml bindings exist in the 64-bit package
rm -rf "$pkgdir"/usr/{lib/ocaml,share/doc/llvm/ocamldoc}
# Remove duplicate files installed by the OCaml bindings
rm "$pkgdir"/usr/{lib32/libllvm*,share/doc/llvm/ocamldoc.tar.gz}
# Fix permissions of static libs
chmod -x "$pkgdir"/usr/lib32/*.a
mv "$pkgdir/usr/bin/i386-pc-linux-gnu-llvm-config" "$pkgdir/usr/lib32/llvm-config"
# Get rid of example Hello transformation
rm "$pkgdir"/usr/lib32/*LLVMHello.*
# Symlink LLVMgold.so into /usr/lib/bfd-plugins
# (https://bugs.archlinux.org/task/28479)
install -d "$pkgdir/usr/lib32/bfd-plugins"
ln -s ../LLVMgold.so "$pkgdir/usr/lib32/bfd-plugins/LLVMgold.so"
mv "$pkgdir"/usr/include/llvm/Config/*config.h "$pkgdir/"
rm -rf "$pkgdir"/usr/{bin,include,share/{doc,man}}
install -d "$pkgdir/usr/include/llvm/Config"
mv "$pkgdir/config.h" "$pkgdir/usr/include/llvm/Config/config-32.h"
mv "$pkgdir/llvm-config.h" "$pkgdir/usr/include/llvm/Config/llvm-config-32.h"
mkdir "$pkgdir"/usr/bin
mv "$pkgdir/usr/lib32/llvm-config" "$pkgdir/usr/bin/llvm-config32"
rmdir "$pkgdir/usr/lib"
# This exists in 64-bit llvm package
rm -rf "$pkgdir/usr/share/llvm/cmake"
install -Dm644 LICENSE.TXT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
package_lib32-llvm-libs-svn() {
pkgdesc="Low Level Virtual Machine (runtime library)"
depends=('lib32-libffi' 'lib32-zlib' 'lib32-gcc-libs' 'lib32-ncurses')
provides=('lib32-llvm-libs')
conflicts=('lib32-llvm-libs')
mkdir -p "$pkgdir"/usr/lib32/
install -D "$srcdir"/libLLVM-*.so "$pkgdir/usr/lib32/"
install -Dm644 "${srcdir}/${_pkgname}/LICENSE.TXT" \
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
@mihaly4

This comment has been minimized.

Copy link

mihaly4 commented Mar 11, 2014

I am unable to build latest llvm with this PKGBUILD

==> Starting package_lib32-llvm-libs-svn()...
install: cannot stat '/var/abs/local/yaourtbuild/lib32-llvm-svn/src/libLLVM-3.5svn.so': No such file or directory
==> ERROR: A failure occurred in package_lib32-llvm-libs-svn().
Aborting...
==> ERROR: Makepkg was unable to build lib32-llvm-svn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.