pkgs/musl/PKGBUILD
2023-12-08 21:44:38 -08:00

71 lines
2.3 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"
)
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"
"wrappers.cpp"
)
sha256sums=(
"7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039"
"11b8d09dcf92a0f91c5c82defb5ad9ff4acf5cf073a80c317204baa922d136b4"
"34927e9de1a3e48fa8ccbbe5dbc13b2f4b04c66672f65b2647ab341007c84cf4"
"8c15025c99091ab2b903232359093029e15658d05484aae8254005046d86ff3a"
"cb3e01d5011c48b86f390246a3b710e02fd2e28278743f65098c4242c3cb3241"
"2827fefaf25076d5638d713f4dbd99c44330ca83d28989566cc1c089c66c4613"
"55b485a26ec69a4fdb44169b12e09d239ad2eea922a2de8d56caf76fd8355e12"
)
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
}
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 -Dm0644 README "$pkgdir"/usr/share/doc/musl/README
install -Dm0644 COPYRIGHT "$pkgdir"/usr/share/licenses/musl/COPYRIGHT
}