-
Notifications
You must be signed in to change notification settings - Fork 0
/
applypatch
117 lines (90 loc) · 1.97 KB
/
applypatch
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
#!/bin/csh -f
#
# applypatch: this script will apply the lame patch against
# the dist10 encoder source.
#
# version 1.0 by ???
# version 2.0 by Conrad Sanderson
#
# example
# -------
#
# first create a directory with: dist10.tar.gz
# lame3.50.patch.gz
#
# run from within that directory: applypatch lame3.50.patch.gz
#
if ($# < 1 ) then
echo "$0 is a script to apply the lame patch against"
echo "the ISO dist10 source. It must be run from a directory"
echo "containing dist10.tar.gz, dist10.tar or dist10.tgz file"
echo "and the lame patch file - eg. lame3.50.patch.gz or lame3.50.patch"
echo " "
echo "usage: $0 lame_patch_file"
exit -1
endif
set patch=$1
#
# see if dist10.tar.gz, dist10.tar or dist10.tgz exist
#
set distsrc="nothing"
if(-e dist10.tar.gz) then
set distsrc=dist10.tar.gz
endif
if(-e dist10.tar) then
set distsrc=dist10.tar
endif
if(-e dist10.tgz) then
set distsrc=dist10.tgz
endif
if( $distsrc == "nothing" ) then
echo "can't find ISO dist10 source (dist10.tar.gz, dist10.tar or dist10.tgz)"
exit -1
endif
#
# see if patch file exists
#
if(! -e $patch) then
echo "$patch doesn't exist"
exit -1
endif
#
# figure out whether dist10 is compressed
#
set dcatcmd=cat
set dext=$distsrc:e
gunzip -t $distsrc
if ($status) then
set dcatcmd=cat
else
set dcatcmd=zcat
endif
#
# figure out whether the patch is compressed
#
gunzip -t $patch
if ($status) then
set pcatcmd=cat
else
set pcatcmd=zcat
endif
#
# real work begins here
#
set dir = $cwd
rm -Rf lame_src encoder
# untar the dist10 source
echo "extracting the ISO dist10 source..."
$dcatcmd $distsrc | tar xf -
cd dist10/lsf
# create a copy of the dist10 encoder directory, without tables subdirectory
tar cf - encoder | ( cd $dir ; tar xf -)
cd $dir
rm -Rf encoder/tables
# apply the patch
$pcatcmd $patch | patch -p0
# rename the directory
mv encoder lame_src
# clean up
rm -Rf dist10
echo "lame MP3 encoder source is in lame_src directory"