pkgs/musl/PKGBUILD

82 lines
2.9 KiB
Bash

# Maintainer: Daryl Ronningen <relms@relms.dev>
_llvmver=17.0.6
pkgname=musl
pkgver=1.2.4
pkgrel=1
pkgdesc="Lightweight implementation of C standard library"
arch=("x86_64")
url="https://musl.libc.org/"
license=("MIT")
optdepends=(
"argp-standalone: Port of argp from Glibc"
"musl-fts: adds fts(3) functions"
"musl-obstack: add obstack from Glibc"
)
backup=("etc/ld-musl-$CARCH.path")
source=(
"https://musl.libc.org/releases/musl-$pkgver.tar.gz"
"https://github.com/llvm/llvm-project/releases/download/llvmorg-$_llvmver/compiler-rt-$_llvmver.src.tar.xz"
"0001-elf.h-add-typedefs-for-Elf64_Relr-and-Elf32_Relr.patch"
"0002-scudo-add-necessary-plumbing.patch"
"0003-scudo-clean-up-lingering-weak-symbols-we-don-t-want.patch"
"0004-do-not-rely-on-system-headers-for-cpu-info.patch"
"0005-Revert-remove-LFS64-symbol-aliases-replace-with-dyna.patch"
"0006-Revert-remove-LFS64-programming-interfaces-macro-onl.patch"
"wrappers.cpp"
"ld-musl.path"
)
sha256sums=(
"7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039"
"11b8d09dcf92a0f91c5c82defb5ad9ff4acf5cf073a80c317204baa922d136b4"
"1eed14011716974fcc7d9ff6cbfd46e3bf247e43152c69fd4d0e68a26129277f"
"416dac6bdbd19e65e6c8717e573a424e0efb61e26b28ed5a161a0a2420df8f3b"
"5c84f0cea68f9cc04356b75193d16d31852e468d06182163783997f8eced6574"
"9b119297d5d1550d57d98ad0c3a6f87e654c852430db44e1df53afacae1fc141"
"017751764328d3c4fc3bd5873b0cee446df470432c6464e0cb663ba12dae808d"
"0c6c89c7b0c4e3918de323d0015f28ec6e8f7d27301f56a95bb55e1bb31e5d54"
"55b485a26ec69a4fdb44169b12e09d239ad2eea922a2de8d56caf76fd8355e12"
"de2f97888ddbaca502e0e7417c6ab7be1123c8d1d33a18aa7df7fa95887be11b"
)
prepare() {
cd $pkgname-$pkgver
# Add scudo
mkdir -p src/malloc/scudo/scudo/
cp -r $srcdir/compiler-rt-$_llvmver.src/lib/scudo/standalone/*.{cpp,h,inc} src/malloc/scudo/
cp -r $srcdir/compiler-rt-$_llvmver.src/lib/scudo/standalone/include/scudo/*.h src/malloc/scudo/scudo/
# Add wrappers from chimera linux
rm src/malloc/scudo/wrappers*
cp -r $srcdir/wrappers.cpp src/malloc/scudo/
patch -p1 <$srcdir/0001-elf.h-add-typedefs-for-Elf64_Relr-and-Elf32_Relr.patch
patch -p1 <$srcdir/0002-scudo-add-necessary-plumbing.patch
patch -p1 <$srcdir/0003-scudo-clean-up-lingering-weak-symbols-we-don-t-want.patch
patch -p1 <$srcdir/0004-do-not-rely-on-system-headers-for-cpu-info.patch
patch -p1 <$srcdir/0005-Revert-remove-LFS64-symbol-aliases-replace-with-dyna.patch
patch -p1 <$srcdir/0006-Revert-remove-LFS64-programming-interfaces-macro-onl.patch
}
build() {
cd $pkgname-$pkgver
./configure --prefix=/usr --with-malloc=scudo
make
}
package() {
cd $pkgname-$pkgver
make DESTDIR="$pkgdir" install
mv $pkgdir/lib/* $pkgdir/usr/lib/
rm -rf $pkgdir/lib
mkdir $pkgdir/usr/bin
ln -s ../lib/ld-musl-$CARCH.so.1 $pkgdir/usr/bin/ldd
install -Dm644 $srcdir/ld-musl.path $pkgdir/etc/ld-musl-$CARCH.path
install -Dm0644 README "$pkgdir"/usr/share/doc/musl/README
install -Dm0644 COPYRIGHT "$pkgdir"/usr/share/licenses/musl/COPYRIGHT
}