summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 367657b6c7212828d940f2d1672d7191fd59c158 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Maintainer: Chocobo1 <chocobo1 AT archlinux DOT net>
# Previous maintainer:  Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Chiu-Hsiang Hsu <wdv4758h@gmail.com>

pkgname=musl-git
pkgver=1.2.5.r75.gc47ad25e
pkgrel=1
pkgdesc="An implementation of the standard library for Linux-based systems"
arch=('i686' 'x86_64')
url="https://musl.libc.org/"
license=('MIT')
makedepends=('git')
provides=("musl=$pkgver")
conflicts=('musl')
options=('staticlibs' '!buildflags')
source=("git+https://git.musl-libc.org/git/musl")
sha256sums=('SKIP')


pkgver() {
  cd "musl"

  _tag=$(git tag -l --sort -v:refname | grep -E '^v?[0-9\.]+$' | head -n1)
  _rev=$(git rev-list --count $_tag..HEAD)
  _hash=$(git rev-parse --short HEAD)
  printf "%s.r%s.g%s" "$_tag" "$_rev" "$_hash" | sed 's/^v//'
}

build() {
  cd "musl"

  ./configure \
    --prefix="/usr/lib/musl" \
    --exec-prefix="/usr" \
    --enable-wrapper=all \
    CFLAGS="-ffat-lto-objects"
  make
}

package() {
  cd "musl"

  make DESTDIR="$pkgdir" install

  # configure syslibdir with /lib for PT_INTERP compat, but install to /usr/lib
  mv "$pkgdir/lib"/ld-musl*.so* "$pkgdir/usr/lib"
  rmdir "$pkgdir/lib"

  install -Dm644 "README" -t "$pkgdir/usr/share/doc/musl"
  install -Dm644 "COPYRIGHT" -t "$pkgdir/usr/share/licenses/musl"
}