summaryrefslogtreecommitdiffstats
path: root/abs/extra-testing/oss/PKGBUILD
blob: c2ac70e09d05a33f3b38740ea48315d276057cc7 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# $Id: PKGBUILD,v 1.8 2009/02/11 17:22:38 thotypous Exp $
# Maintainer: Paulo Matias <matiasΘarchlinux-br·org>

pkgname="oss"
pkgver="4.1_1051"
pkgrel=6
pkgdesc="Open Sound System UNIX audio architecture"
arch=('i686' 'x86_64')
url="http://developer.opensound.com/"
license=('GPL2')
depends=('gcc' 'make' 'kernel-headers' 'module-init-tools' 'libtool' 'sed')
makedepends=('pkgconfig' 'gawk' 'gtk2')
conflicts=('oss-linux' 'oss-linux-free' 'oss-testing')
install='oss.install'
source=("http://www.4front-tech.com/developer/sources/stable/gpl/oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl.tar.bz2"
        'oss.rm-init-scripts.patch' 'oss.rc' 'oss.install' 'hg-latest-fixes.diff')


optdepends=('gtk2: for graphical mixer (ossxmix)'
            'hal: for automatic USB audio configuration'
            'libflashsupport-oss: for Flash plugin support')

build() {
    _dir="oss-v${pkgver/_*}-build${pkgver/*_}-src-gpl"

    cd "$srcdir/$_dir"

    # Apply patchs from hg.
    msg "Applying latest fixes from hg."
    patch -p1 < "$srcdir/hg-latest-fixes.diff" || return 1

    cd "$srcdir"

    # Avoid these flags conflicting with OSS build system.
    unset CFLAGS
    unset OSFLAGS
    unset LIBRARIES

    # Remove libflashsupport, as it belongs to a separate package.
    rm -f "$srcdir/$_dir/oss/lib/flashsupport.c" &> /dev/null

    msg "Preparing the build environment."

    if [ ! -d build ]; then
        # Create build directory and configure
        mkdir build && cd build
        "$srcdir/$_dir/configure" --enable-libsalsa=NO || return 1
    else
        # Change to existing build directory
        cd build
    fi

    msg "Building OSS."
    make build || return 1

    msg "Patching init scripts."
    cd "$srcdir/build/prototype"
    rm usr/lib/oss/etc/S89oss
    patch -b -p0 < "$srcdir/oss.rm-init-scripts.patch" || return 1

    msg "Copying files."
    cp -R * "$pkgdir"
    install -D -m755 "$srcdir/oss.rc" "$pkgdir/etc/rc.d/oss"
################################
PREFIX=$startdir/pkg
OSSLIBDIR=$PREFIX/usr/lib/oss
UNAME=2.6.28-LinHES
KERNELDIR=/lib/modules/$UNAME/build
mkdir -p ${PREFIX}/lib/modules/$UNAME/kernel/oss

cd $OSSLIBDIR/build
rm -f $OSSLIBDIR/.cuckoo_installed
   REGPARM=REGPARM
   rm -rf $OSSLIBDIR/objects
   ln -s $OSSLIBDIR/objects.regparm $OSSLIBDIR/objects
   rm -rf $OSSLIBDIR/modules
   ln -s $OSSLIBDIR/modules.regparm $OSSLIBDIR/modules

echo OSS build environment set up for $REGPARM kernels

if ! test -f $OSSLIBDIR/objects/osscore.o
then
    echo Error: OSS core module for $REGPARM kernel is not available in $OSSLIBDIR/objects
    exit 1
fi
OK=1

if ! test -d /lib/modules/$UNAME
then
    echo Error: Kernel directory /lib/modules/$UNAME does not exist
    exit 1
fi

cp -f ../objects/osscore.o osscore_mainline.o

ln -sf ../include/sys/*.h ../include/sys/ossddk .

rm -f Makefile
ln -s Makefile.osscore Makefile

echo Building module osscore

if ! make KERNELDIR=$KERNELDIR> build.list 2>&1
then
    echo Failed to compile OSS
    cat build.list
    exit 2
fi

if ! test -d /lib/modules/$UNAME/kernel/oss
then
  mkdir /lib/modules/$UNAME/kernel/oss
fi

if ! test -d /lib/modules/$UNAME/kernel/oss
then
    echo OSS module directory /lib/modules/$UNAME/kernel/oss does not exist.
    exit 3
fi

if ! ld -r osscore.ko osscore_mainline.o -o /lib/modules/$UNAME/kernel/oss/osscore.ko
then
    echo Linking the osscore module failed
    exit 5
fi

if test -f Module.symvers
then
    #Take generated symbol information and add it to module.inc
    rm -f osscore_symbols.inc
    echo "static const struct modversion_info ____versions[]" >> osscore_symbols.inc
    echo " __attribute__((used))" >> osscore_symbols.inc
    echo "__attribute__((section(\"__versions\"))) = {" >> osscore_symbols.inc
    sed -e "s:^:{:" -e "s:\t:, \":" -e "s:\t\(.\)*:\"},:" < Module.symvers >> osscore_symbols.inc
    echo "};" >> osscore_symbols.inc
else
    echo > osscore_symbols.inc
fi

#depmod -a

for n in ../modules/*.o
do
    N=`basename $n .o`
    echo Building module $N

    rm -f $N_mainline.o Makefile

    sed "s/MODNAME/$N/" < Makefile.tmpl > Makefile
    ln -s $n $N_mainline.o

    if ! make KERNELDIR=$KERNELDIR > build.list 2>&1
    then
        echo Compiling module $N failed
        cat build.list
        exit 4
    fi

    if ! ld -r $N.ko $N_mainline.o -o /lib/modules/$UNAME/kernel/oss/$N.ko
    then
        echo Linking $N module failed
        exit 6
    fi

    rm -f $N_mainline.o
    make clean

done
rm -f Makefile

cp -rp /lib/modules/$UNAME/kernel/oss/*  ${PREFIX}/lib/modules/$UNAME/kernel/oss/




















































}