summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a29d485b1e5dc09a7d4c718a2ae487ac3ba870fc (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
52
53
54
55
56
57
58
59
60
61
62
# AUR maintainer: Swyter <swyterzone+aur@gmail.com>
# 64-bit Maintainer: Ivy Foster <code@escondida.tk>
# Reference: PKGBUILD(5)

pkgname=lib32-sndio
pkgver=1.10.0
pkgrel=1
pkgdesc='A small audio and MIDI framework part of the OpenBSD project (32 bit)'
arch=('x86_64')
url='http://www.sndio.org'
license=('ISC')

# sndio can be built without libbsd, but there are a bunch of individual
# ISC-licensed files by different authors to extract the licenses from
# if done that way. Licenses are complicated.
depends=(lib32-alsa-lib lib32-libbsd)

source=("http://www.sndio.org/sndio-$pkgver.tar.gz")
sha256sums=('bebd3bfd01c50c9376cf3e7814b9379bed9e17d0393b5113b7eb7a3d0d038c54')
backup=(etc/default/sndiod)

build() {
  # Modify environment to generate 32-bit ELF. Respects flags defined in makepkg.conf
  export CFLAGS="-m32 ${CFLAGS}"
  export CXXFLAGS="-m32 ${CXXFLAGS}"
  export LDFLAGS="-m32 ${LDFLAGS}"
  export PKG_CONFIG_PATH='/usr/lib32/pkgconfig'
  export PKG_CONFIG_LIBDIR='/usr/lib32/pkgconfig'

  cd "sndio-${pkgver}"

  ./configure \
    --enable-alsa \
    --with-libbsd \
    --prefix=/usr \
    --libdir=/usr/lib32 \
    --pkgconfdir=/usr/lib32/pkgconfig

  make
}

package() {
  # as noted by @MarsSeed: Reason: sndio is not actually needed during
  # the build, but it is needed if it is installed. (Because only the
  # x86_64 packages carry the include headers needed if someone wants
  # to run a lib32 build using lib32-sndio.)
  depends+=('sndio')

  cd "sndio-${pkgver}"
  make DESTDIR="$pkgdir/" install

  ln -s "libsndio.so.7.0" "$pkgdir"/usr/lib32/libsndio.so.6.1

  # swy: get rid of the duplicated man files, binaries and headers
  #      install the normal 64-bit sndio package for them
  rm -rf "${pkgdir}/usr"/{share,include}

  # swy: rename the 32-bit utilities to avoid clashes with the
  #      64-bit version counterparts: https://stackoverflow.com/a/208220/674685
  for filename in ${pkgdir}/usr/bin/*; do mv "$filename"{,32}; done;
}