-
Notifications
You must be signed in to change notification settings - Fork 2
/
prepare.sh
executable file
·70 lines (58 loc) · 1.19 KB
/
prepare.sh
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
#!/bin/bash
cd $( dirname $0 )
COMMIT=cafce902a73c1050474a62feff83e428bbbee5f4
FILEURL="https://gitlab.xiph.org/xiph/libao/-/archive/$COMMIT/libao-$COMMIT.tar.gz"
FILEPATH=libao-$COMMIT.tar.gz
DIRPATH=libao-$COMMIT
#
# prepare build directory
#
if [[ ! -d build/ao ]]
then
mkdir -p build/ao
fi
#
# source file downlaod
#
if [[ ! -f build/$FILEPATH ]]
then
curl -s -o build/$FILEPATH $FILEURL
fi
if [[ ! -f build/$FILEPATH ]]
then
echo "Error: cannot download $FILEURL."
exit 1
fi
#
# extract
#
cd build
tar xzvf $FILEPATH
cd ..
if [[ ! -d build/$DIRPATH ]]
then
echo "Error: cannot extract $FILEPATH."
exit 1
fi
#
# copy to required files
#
# .c
cp -f build/$DIRPATH/src/config.c build/
cp -f build/$DIRPATH/src/ao_wmm.c build/
cp -f build/$DIRPATH/src/ao_null.c build/
cp -f build/$DIRPATH/src/audio_out.c build/
cp -f windows/dllmain.cpp build/
# .h
cp -f windows/targetver.h build/
cp -f build/$DIRPATH/include/ao/ao.h build/ao/
cp -f build/$DIRPATH/include/ao/ao_private.h build/ao/
cp -f windows/os_types.h build/ao/
#
# patch
#
cd build
while read line
do
patch -u -p0 < $line
done < <(find ../patch | sort | grep -E '\.patch$')