summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 17f84799660efd88aeb103be8b7c2149a5b002eb (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
# Maintainer: Martchus <martchus@gmx.net>

# All my PKGBUILDs are managed at https://github.com/Martchus/PKGBUILDs where
# you also find the URL of a binary repository.

_reponame=midifile
pkgname=midifile-git
_name=${pkgname%-git}
pkgver=256.97405c8
pkgrel=1
arch=('i686' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
pkgdesc='C++ classes for reading/writing Standard MIDI Files'
license=('BSD')
depends=()
makedepends=('cmake' 'git')
#provides=("${_name}")
conflicts=("${_name}")
url="http://midifile.sapp.org"
source=("${_reponame}::git://github.com/craigsapp/${_reponame}.git")
sha256sums=('SKIP')

pkgver() {
  cd "$srcdir/$_reponame"
  echo "$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

prepare() {
  cd "$srcdir/$_reponame"
  sed -i "s/ STATIC / SHARED /" CMakeLists.txt
}

build() {
  cd "$srcdir/$_reponame"
  mkdir build && cd build
  cmake \
    -DCMAKE_BUILD_TYPE:STRING='Release' \
    -DCMAKE_INSTALL_PREFIX:PATH='/usr' \
    -DCMAKE_SKIP_BUILD_RPATH:BOOL=ON \
    ..
  make
}

package() {
  cd "$srcdir/$_reponame"

  # install manually (there's no install target)

  mkdir -p "${pkgdir}/usr/"{lib,bin,include/midifile}

  pushd build
  # prevent conflict with sndio
  for conflicting_file in midicat; do
    mv $conflicting_file $conflicting_file-$_name
  done
  find \( -iname '*.so' \)                                      -exec cp --target-directory="${pkgdir}/usr/lib" {} \;
  find \( -maxdepth 1 -executable -type f -not -iname '*.so' \) -exec cp --target-directory="${pkgdir}/usr/bin" {} \;
  popd

  pushd include
  find \( -iname '*.h' -type f \)                               -exec cp --target-directory="${pkgdir}/usr/include/midifile" {} \;
  popd
}