summaryrefslogtreecommitdiff
path: root/community/tuxguitar/PKGBUILD
blob: 58081130740b4c93bd8a8aa461a192720915e85f (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# $Id: PKGBUILD 84141 2013-02-11 15:15:31Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: |AhIoRoS| < ahioros@gmail.com >

pkgname=tuxguitar
pkgver=1.2
pkgrel=6
_jdk=java-7-openjdk
pkgdesc="multitrack guitar tablature editor and player"
arch=('i686' 'x86_64' 'mips64el')
#url="http://www.herac.com.ar/contenidos/tuxguitar.html"
url="http://sourceforge.net/projects/tuxguitar"
license=('LGPL')
depends=('java-runtime' 'swt' 'alsa-lib')
makedepends=('unzip' 'zip' 'apache-ant' 'jack' 'fluidsynth' 'java-environment')
optdepends=('fluidsynth')
install=tuxguitar.install
source=(tuxguitar-src-$pkgver.tar.gz::http://sourceforge.net/projects/tuxguitar/files/TuxGuitar/TuxGuitar-$pkgver/tuxguitar-src-$pkgver.tar.gz/download
	tuxguitar.desktop
	tuxguitar.xml)
md5sums=('f41ed20e77c6c3d8968991a29c71b912'
         '0afa7f3248b9317d73ad8ccdc5e5aaf0'
         '59ce4eb8dcc0d0dde81e6cf2820aa9b0')

build() {
  cd $srcdir/tuxguitar-src-$pkgver

  export CLASSPATH=/usr/share/java/swt.jar:$CLASSPATH

  (cd TuxGuitar/ && ant)
  (cd TuxGuitar-alsa/ && ant)
  (cd TuxGuitar-fluidsynth/ && ant)
  (cd TuxGuitar-jack/ && ant)
  (cd TuxGuitar-oss/ && ant)
  (cd TuxGuitar-compat/ && ant)
  (cd TuxGuitar-gtp/ && ant)
  (cd TuxGuitar-ptb/ && ant)
  (cd TuxGuitar-tef/ && ant)
  (cd TuxGuitar-midi/ && ant)
  (cd TuxGuitar-lilypond/ && ant)
  (cd TuxGuitar-musicxml/ && ant)
  (cd TuxGuitar-ascii/ && ant)
  (cd TuxGuitar-converter/ && ant)
  (cd TuxGuitar-tray/ && ant)
  (cd TuxGuitar-community/ && ant)
  (cd TuxGuitar-gervill/ && ant)
  (cd TuxGuitar-jsa/ && ant)

  # alsa
  pushd TuxGuitar-alsa/jni
  gcc -I/usr/lib/jvm/${_jdk}/include -I/usr/lib/jvm/${_jdk}/include/linux -fPIC \
	-c -o org_herac_tuxguitar_player_impl_midiport_alsa_MidiSystem.o \
	org_herac_tuxguitar_player_impl_midiport_alsa_MidiSystem.c
  gcc  -shared -o libtuxguitar-alsa-jni.so org_herac_tuxguitar_player_impl_midiport_alsa_MidiSystem.o -L/usr/lib -lasound
  popd

  # oss
  pushd TuxGuitar-oss/jni
  gcc -I/usr/lib/jvm/${_jdk}/include -I/usr/lib/jvm/${_jdk}/include/linux -fPIC \
	-c -o org_herac_tuxguitar_player_impl_midiport_oss_MidiSystem.o \
	org_herac_tuxguitar_player_impl_midiport_oss_MidiSystem.c
  gcc  -shared -o libtuxguitar-oss-jni.so org_herac_tuxguitar_player_impl_midiport_oss_MidiSystem.o -L/usr/lib
  popd

  # jack
  pushd TuxGuitar-jack/jni
  gcc -I/usr/lib/jvm/${_jdk}/include -I/usr/lib/jvm/${_jdk}/include/linux -fPIC \
	-c -o org_herac_tuxguitar_jack_JackClient.o \
	org_herac_tuxguitar_jack_JackClient.c
  gcc  -shared -o libtuxguitar-jack-jni.so org_herac_tuxguitar_jack_JackClient.o -L/usr/lib -ljack
  popd

  # fluidsynth
  pushd TuxGuitar-fluidsynth/jni
  gcc -I/usr/lib/jvm/${_jdk}/include -I/usr/lib/jvm/${_jdk}/include/linux -fPIC \
	-c -o org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.o \
	org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.c
  gcc  -shared -o libtuxguitar-fluidsynth-jni.so org_herac_tuxguitar_player_impl_midiport_fluidsynth_MidiSynth.o -L/usr/lib -lfluidsynth
  popd
}

package() {
  cd $srcdir/tuxguitar-src-$pkgver

  mkdir -p $pkgdir/usr/share/tuxguitar
  mkdir -p $pkgdir/usr/bin

  cp -r TuxGuitar/share $pkgdir/usr/share/tuxguitar/
  find -name \*.jar -exec sh -c 'cp {} '$pkgdir'/usr/share/tuxguitar/share/plugins/`basename {}`' \;
  mv $pkgdir/usr/share/tuxguitar/share/plugins/tuxguitar.jar $pkgdir/usr/share/tuxguitar/
  cp TuxGuitar/tuxguitar $pkgdir/usr/share/tuxguitar/

  # alsa
  pushd TuxGuitar-alsa/jni
  install -D -m0755 libtuxguitar-alsa-jni.so $pkgdir/usr/lib/tuxguitar/libtuxguitar-alsa-jni.so
  mkdir -p $pkgdir/usr/share/tuxguitar/lib
  ln -s /usr/lib/tuxguitar/libtuxguitar-alsa-jni.so $pkgdir/usr/share/tuxguitar/lib/libtuxguitar-alsa-jni.so
  popd

  # oss
  pushd TuxGuitar-oss/jni
  install -D -m0755 libtuxguitar-oss-jni.so $pkgdir/usr/lib/tuxguitar/libtuxguitar-oss-jni.so
  mkdir -p $pkgdir/usr/share/tuxguitar/lib
  ln -s /usr/lib/tuxguitar/libtuxguitar-oss-jni.so $pkgdir/usr/share/tuxguitar/lib/libtuxguitar-oss-jni.so
  popd

  # jack
  pushd TuxGuitar-jack/jni
  install -D -m0755 libtuxguitar-jack-jni.so $pkgdir/usr/lib/tuxguitar/libtuxguitar-jack-jni.so
  mkdir -p $pkgdir/usr/share/tuxguitar/lib
  ln -s /usr/lib/tuxguitar/libtuxguitar-jack-jni.so $pkgdir/usr/share/tuxguitar/lib/libtuxguitar-jack-jni.so
  popd

  # fluidsynth
  pushd TuxGuitar-fluidsynth/jni
  install -D -m0755 libtuxguitar-fluidsynth-jni.so $pkgdir/usr/lib/tuxguitar/libtuxguitar-fluidsynth-jni.so
  mkdir -p $pkgdir/usr/share/tuxguitar/lib
  ln -s /usr/lib/tuxguitar/libtuxguitar-fluidsynth-jni.so $pkgdir/usr/share/tuxguitar/lib/libtuxguitar-fluidsynth-jni.so
  popd

  cd $pkgdir/usr/bin
  cat >tuxguitar << EOF
#!/bin/sh
export CLASSPATH=/usr/share/java/swt.jar:$CLASSPATH
export LD_LIBRARY_PATH=lib/:$LD_LIBRARY_PATH
cd /usr/share/$pkgname
exec /usr/share/$pkgname/tuxguitar "\$1" "\$2" "\$3" "\$4" "\$5" "\$6" "\$7" "\$8" "\$9"
EOF

  chmod 755 tuxguitar
  install -D -m0644 $srcdir/tuxguitar.xml $pkgdir/usr/share/mime/packages/tuxguitar.xml
  install -D -m0644 $srcdir/tuxguitar.desktop $pkgdir/usr/share/applications/tuxguitar.desktop
}