~ubuntu-branches/ubuntu/oneiric/oss4/oneiric-proposed

« back to all changes in this revision

Viewing changes to setup/Linux/build.sh

  • Committer: Bazaar Package Importer
  • Author(s): Stefano Rivera
  • Date: 2011-06-16 20:37:48 UTC
  • mfrom: (5.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110616203748-jbrxik6ql33z54co
Tags: 4.2-build2004-1ubuntu1
* Merge from Debian unstable.
  - Supports our current kernel (LP: #746048)
  Remaining changes:
  - debian/oss4-dkms.dkms.in: s/source/build/ in Kernel headers paths.
* ld-as-needed.patch: Re-order CC arguments to enable building with ld
  --as-needed (LP: #770972)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
. ./.directories
 
4
 
 
5
if gawk '' >/dev/null
 
6
then
 
7
   TXT2MAN=$SRCDIR/setup/txt2man
 
8
else
 
9
   echo "No gawk found. Using lesser replacement" >&2
 
10
   cc -o txt2man origdir/setup/txt2man.c
 
11
   TXT2MAN=/usr/bin/txt2man
 
12
fi
 
13
 
 
14
rm -rf prototype
 
15
 
 
16
mkdir prototype
 
17
mkdir prototype/etc
 
18
echo "OSSLIBDIR=$OSSLIBDIR" > prototype/etc/oss.conf
 
19
mkdir prototype/usr
 
20
mkdir prototype/usr/bin
 
21
mkdir prototype/usr/share
 
22
mkdir prototype/usr/share/man
 
23
mkdir prototype/usr/share/man/man1
 
24
mkdir prototype/usr/share/man/man7
 
25
mkdir prototype/usr/share/man/man8
 
26
mkdir prototype/usr/sbin
 
27
mkdir -p prototype/$OSSLIBDIR
 
28
mkdir prototype/$OSSLIBDIR/etc
 
29
mkdir prototype/$OSSLIBDIR/save
 
30
mkdir prototype/$OSSLIBDIR/conf.tmpl
 
31
mkdir prototype/$OSSLIBDIR/lib
 
32
mkdir prototype/$OSSLIBDIR/modules.regparm
 
33
mkdir prototype/$OSSLIBDIR/modules.noregparm
 
34
mkdir prototype/$OSSLIBDIR/objects.regparm
 
35
mkdir prototype/$OSSLIBDIR/objects.noregparm
 
36
mkdir prototype/$OSSLIBDIR/include
 
37
mkdir prototype/$OSSLIBDIR/include/sys
 
38
mkdir prototype/$OSSLIBDIR/include/internals
 
39
mkdir prototype/$OSSLIBDIR/build
 
40
 
 
41
chmod 700 prototype/$OSSLIBDIR/modules.*
 
42
chmod 700 prototype/$OSSLIBDIR/objects.*
 
43
chmod 700 prototype/$OSSLIBDIR/build
 
44
chmod 700 prototype/$OSSLIBDIR/save
 
45
 
 
46
if test -f regparm && test "`cat regparm` " = "1 "
 
47
then
 
48
  MODULES=modules.regparm
 
49
  OBJECTS=objects.regparm
 
50
else
 
51
  MODULES=modules.noregparm
 
52
  OBJECTS=objects.noregparm
 
53
fi
 
54
 
 
55
cp .version prototype/$OSSLIBDIR/version.dat
 
56
 
 
57
if test "`uname -m` " != "arm "
 
58
then
 
59
        if ! test -f regparm
 
60
        then
 
61
          echo Error: ./regparm is missing
 
62
          exit 1
 
63
        fi
 
64
        cp regparm prototype/$OSSLIBDIR/build
 
65
fi
 
66
 
 
67
# Regenerating the config file templates
 
68
rm -f /tmp/confgen
 
69
if ! cc -o /tmp/confgen ./setup/Linux/confgen.c
 
70
then
 
71
        echo Building confgen failed
 
72
        exit 1
 
73
fi
 
74
 
 
75
if ! /tmp/confgen prototype/$OSSLIBDIR/conf.tmpl $OSSLIBDIR/conf kernel/drv/* kernel/nonfree/drv/*
 
76
then
 
77
        echo Running confgen failed
 
78
        exit 1
 
79
fi
 
80
 
 
81
rm -f /tmp/confgen
 
82
 
 
83
cp $SRCDIR/include/*.h prototype/$OSSLIBDIR/include/sys/
 
84
cp $SRCDIR/kernel/framework/include/midiparser.h prototype/$OSSLIBDIR/include/
 
85
cp -f $SRCDIR/kernel/OS/Linux/wrapper/wrap.h prototype/$OSSLIBDIR/build/
 
86
cp -f $SRCDIR/kernel/framework/include/udi.h prototype/$OSSLIBDIR/build/
 
87
cp -a $SRCDIR/kernel/framework/include/*_core.h kernel/framework/include/local_config.h prototype/$OSSLIBDIR/include/internals
 
88
cp $SRCDIR/kernel/framework/include/ossddk/*.h prototype/$OSSLIBDIR/include/internals
 
89
cp kernel/framework/include/timestamp.h prototype/$OSSLIBDIR/include/internals
 
90
cp kernel/framework/include/ossddk/oss_limits.h prototype/$OSSLIBDIR/include/internals
 
91
 
 
92
cat > prototype/$OSSLIBDIR/include/internals/WARNING.txt << EOF
 
93
Caution: All header files included in this directory are there only because
 
94
         some parts of OSS may need to be re-compiled. It is not safe to use
 
95
         these files for any purposes because they will change between OSS
 
96
         versions/builds.
 
97
EOF
 
98
 
 
99
(cd target/bin; rm -f ossrecord; ln -s ossplay ossrecord)
 
100
cp -f target/build/* prototype/$OSSLIBDIR/build/
 
101
cp -f target/bin/* prototype/usr/bin
 
102
cp -f target/sbin/* prototype/usr/sbin
 
103
 
 
104
cp -a $SRCDIR/setup/Linux/oss/* prototype/$OSSLIBDIR/
 
105
cp -a $SRCDIR/setup/Linux/sbin prototype/usr/
 
106
chmod +x prototype/$OSSLIBDIR/scripts/*
 
107
 
 
108
if ! ld -r -o prototype/$OSSLIBDIR/$OBJECTS/osscore.o target/objects/*.o
 
109
then
 
110
  echo Linking osscore failed!
 
111
fi
 
112
 
 
113
rm -f devlist.txt devices.list
 
114
 
 
115
for n in `find kernel/ -name .devices`
 
116
do
 
117
  cat $n >> devices.list
 
118
done
 
119
 
 
120
for n in target/modules/*.o
 
121
do
 
122
        N=`basename $n .o`
 
123
        ld -r -o prototype/$OSSLIBDIR/$MODULES/$N.o $n
 
124
        echo Check devices for $N
 
125
        grep "^$N[      ]" ./devices.list >> devlist.txt
 
126
 
 
127
        rm -f /tmp/ossman.txt
 
128
 
 
129
        if test -f $SRCDIR/kernel/drv/$N/$N.man
 
130
        then
 
131
          sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/drv/$N/$N.man > /tmp/ossman.txt
 
132
          $TXT2MAN -t "$CMD" -v "OSS Devices" -s 7 /tmp/ossman.txt | gzip -9 > prototype/usr/share/man/man7/$N.7.gz
 
133
        else
 
134
                if test -f $SRCDIR/kernel/nonfree/drv/$N/$N.man
 
135
                then
 
136
                        sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/nonfree/drv/$N/$N.man > /tmp/ossman.txt
 
137
                        $TXT2MAN -t "$CMD" -v "OSS Devices" -s 7 $SRCDIR/kernel/nonfree/drv/$N/$N.man | gzip -9 > prototype/usr/share/man/man7/$N.7.gz
 
138
                fi
 
139
        fi
 
140
done
 
141
 
 
142
sed "s:CONFIGFILEPATH:$OSSLIBDIR/conf:g" < $SRCDIR/kernel/drv/osscore/osscore.man > /tmp/ossman.txt
 
143
$TXT2MAN -t "osscore" -v "OSS Devices" -s 7 /tmp/ossman.txt | gzip -9 > prototype/usr/share/man/man7/osscore.7.gz
 
144
rm -f /tmp/ossman.txt
 
145
 
 
146
# Link the optional NOREGPARM modules
 
147
if test -d noregparm
 
148
then
 
149
   ld -r -o prototype/$OSSLIBDIR/objects.noregparm/osscore.o noregparm/target/objects/*.o
 
150
 
 
151
   for n in noregparm/target/modules/*.o
 
152
   do
 
153
        N=`basename $n .o`
 
154
        ld -r -o prototype/$OSSLIBDIR/modules.noregparm/$N.o $n
 
155
   done
 
156
fi
 
157
 
 
158
for n in $SRCDIR/misc/man7/*.man
 
159
do
 
160
        N=`basename $n .man`
 
161
 
 
162
        $TXT2MAN -t "$CMD" -v "OSS Devices" -s 7 $n | gzip -9 > prototype/usr/share/man/man7/$N.7.gz
 
163
done
 
164
 
 
165
for n in $SRCDIR/misc/man1m/*.man
 
166
do
 
167
        N=`basename $n .man`
 
168
        $TXT2MAN -t "$CMD" -v "OSS System Administration Commands" -s 1 $n | gzip -9 > prototype/usr/share/man/man1/$N.1.gz
 
169
done
 
170
 
 
171
if ! cp lib/libOSSlib/libOSSlib.so lib/libsalsa/.libs/libsalsa.so.2.0.0 prototype/$OSSLIBDIR/lib
 
172
then
 
173
  echo Warning: No libsalsa library compiled
 
174
fi
 
175
 
 
176
cp target/lib/* prototype/$OSSLIBDIR/lib
 
177
 
 
178
cp devlist.txt prototype/$OSSLIBDIR/etc/devices.list
 
179
 
 
180
if test -d kernel/nonfree
 
181
then
 
182
        cp devlist.txt $SRCDIR/devlists/Linux
 
183
fi
 
184
 
 
185
# Generate Man pages for commands
 
186
for i in target/bin/*
 
187
do
 
188
CMD=`basename $i`
 
189
$TXT2MAN -t "$CMD" -v "OSS User Commands" -s 1 cmd/$CMD/$CMD.man | gzip -9 > prototype/usr/share/man/man1/$CMD.1.gz
 
190
echo done $CMD
 
191
done
 
192
 
 
193
for i in target/sbin/*
 
194
do
 
195
  CMD=`basename $i`
 
196
  if test -f cmd/$CMD/$CMD.man
 
197
  then
 
198
        $TXT2MAN -t "$CMD" -v "OSS System Administration Commands" -s 8 cmd/$CMD/$CMD.man | gzip -9 > prototype/usr/share/man/man8/$CMD.8.gz
 
199
        echo done $CMD
 
200
  fi
 
201
done
 
202
 
 
203
$TXT2MAN -t "ossdetect" -v "User Commands" -s 8 os_cmd/Linux/ossdetect/ossdetect.man | gzip -9 > prototype/usr/share/man/man8/ossdetect.8.gz
 
204
echo done ossdetect
 
205
 
 
206
cp -f $SRCDIR/oss/lib/flashsupport.c prototype/$OSSLIBDIR/lib
 
207
 
 
208
# Licensing stuff
 
209
if test -f 4front-private/osslic.c
 
210
then
 
211
        cc -o prototype/usr/sbin/osslic -Isetup -Ikernel/nonfree/include -Ikernel/framework/include -Iinclude -Ikernel/OS/Linux -I$SRCDIR $SRCDIR/4front-private/osslic.c
 
212
        strip prototype/usr/sbin/osslic
 
213
        
 
214
        BITS=3 # Default to 32 bit ELF format
 
215
        if test "`uname -m` " = "x86_64 "
 
216
        then
 
217
           BITS=6 # Use 64 bit ELF format
 
218
        fi
 
219
        prototype/usr/sbin/osslic -q -u -$BITS./prototype/$OSSLIBDIR/objects.regparm/osscore.o
 
220
        prototype/usr/sbin/osslic -q -u -$BITS./prototype/$OSSLIBDIR/objects.noregparm/osscore.o
 
221
        
 
222
fi
 
223
 
 
224
if test -f 4front-private/ossupdate.c
 
225
then
 
226
  #ossupdate
 
227
  cc -I. 4front-private/ossupdate.c -s -o prototype/usr/sbin/ossupdate
 
228
fi
 
229
 
 
230
sh $SRCDIR/setup/build_common.sh $SRCDIR $OSSLIBDIR
 
231
 
 
232
chmod 700 prototype/usr/sbin/*
 
233
chmod 755 prototype/usr/bin/*
 
234
 
 
235
(cd prototype;ls usr/sbin/* usr/bin/* etc/* usr/share/man/man*/*) > prototype/$OSSLIBDIR/sysfiles.list
 
236
 
 
237
exit 0