-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdripkg.sh
More file actions
executable file
·558 lines (465 loc) · 13.4 KB
/
dripkg.sh
File metadata and controls
executable file
·558 lines (465 loc) · 13.4 KB
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
#!/bin/bash
#######################################################################
# This is the DRI packaging script. It takes a compiled tree and
# packages up the correct files for the kernel, DRI and libGL modules.
#
# Frank Worsley <franco@nettaxi.com>
# Alan Hourihane <alanh@fairlite.demon.co.uk>
#
#######################################################################
# Usage:
#
# dripkg.sh <cvsdir> <driver> <arch> <format>
#
# <driver> is one of the following... R128, RADEON, MGA, TDFX, I810
# <format> is one of the following... TAR, RPM, DEB, TGZ, RH7
# <arch> can be anything really, usually i386, ppc, alpha, etc.....
#######################################################################
# This script automatically packages the DRI 2D/3D drivers and
# kernel modules. Simply run the script and give it arguments
# and it will create a package of the modules.
#######################################################################
###########################################################
# GENERAL VARIABLES
###########################################################
# CVS Variables
CVS_DIR=$1
CVS_DRV_DIR="$CVS_DIR/xc/programs/Xserver/hw/xfree86/drivers"
CVS_DRM_DIR="$CVS_DIR/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel"
CVS_SHARED_DRM_DIR="$CVS_DIR/xc/programs/Xserver/hw/xfree86/os-support/shared/drm/kernel"
CVS_DRI_DIR="$CVS_DIR/xc/lib/GL/mesa/src/drv"
CVS_LIB_DIR="$CVS_DIR/xc/lib"
CVS_CORE_DIR="$CVS_DIR/xc/programs/Xserver"
OS_NAME=`uname -s`
# Automatic build flags
# Package Directory
# Other package variables are defined in the create functions.
PKG_DIR="dripkg"
# Package Formats / Distributions
declare -a FORMATS=("TAR" "RPM" "DEB" "TGZ" "RH7")
TAR_DESC="Generic Tarball"
TAR_FUNC="create_tar"
RPM_DESC="Generic RPM"
RPM_FUNC="create_rpm"
DEB_DESC="Debian DEB"
DEB_FUNC="create_deb"
TGZ_DESC="Slackware TGZ"
TGZ_FUNC="create_tgz"
RH7_DESC="RedHat 7 RPM"
RH7_FUNC="create_rh7rpm"
###########################################################
# DRIVER VARIABLES
###########################################################
# Available Driver Names
# If you add a driver here make sure it has corresponging
# variables defined below.
declare -a DRIVERS=("R128" "RADEON" "MGA" "TDFX" "I810")
# Variables for selected driver
# These will later be filled in with the values of whatever driver the user selects.
DRV_CVS_DIR="" # driver CVS source dir
DRV_CVS_DRI="" # mesa driver CVS source dir
DRV_ID="" # driver internal script ID
DRV_NAME="" # driver name
DRV_DESC="" # driver description
DRV_COMMAND="" # driver specific commands
DRV_MODULES="" # driver kernel modules
# if there is a space between some of these leave it set (needed by create_tar) !
DRV_VERSION=" " # driver version
DRV_ARCH="" # driver target architecture
DRV_PKG_TYPE="" # driver package type (RPM, TAR, etc)
DRV_PKG_DESC="" # driver package description
DRV_PKG_NAME="" # driver package file name
DRV_BUILD_DESC=" " # special build description
DRV_BUILD_TAG="" # special build tag (for filename)
# TDFX Driver Variables
TDFX_ID=1
TDFX_NAME="tdfx"
TDFX_DESC="3Dfx Banshee & Voodoo 3/4/5 Driver"
TDFX_CVS_DIR="$CVS_DRV_DIR/tdfx"
TDFX_CVS_DRI="$CVS_DRI_DIR/tdfx"
TDFX_MODULES="tdfx"
TDFX_COMMAND=""
# ATI Rage128 Driver Variables
R128_ID=2
R128_NAME="rage128"
R128_DESC="ATI Rage 128 (Pro) Driver"
R128_CVS_DIR="$CVS_DRV_DIR/ati"
R128_CVS_DRI="$CVS_DRI_DIR/r128"
R128_MODULES="r128"
R128_COMMAND=""
# ATI Radeon Driver Variables
RADEON_ID=3
RADEON_NAME="radeon"
RADEON_DESC="ATI Radeon Driver"
RADEON_CVS_DIR="$CVS_DRV_DIR/ati"
RADEON_CVS_DRI="$CVS_DRI_DIR/radeon"
RADEON_MODULES="radeon"
RADEON_COMMAND=""
# MGA Driver Variables
MGA_ID=4
MGA_NAME="mga"
MGA_DESC="Matrox G200/400/450 Driver"
MGA_CVS_DIR="$CVS_DRV_DIR/mga"
MGA_CVS_DRI="$CVS_DRI_DIR/mga"
MGA_MODULES="mga"
MGA_COMMAND=""
# I810 Driver Variables
I810_ID=5
I810_NAME="i810"
I810_DESC="Intel i810/i815 Driver"
I810_CVS_DIR="$CVS_DRV_DIR/i810"
I810_CVS_DRI="$CVS_DRI_DIR/i810"
I810_MODULES="i810"
I810_COMMAND=""
# I830/I845 Driver Variables
I810_ID=6
I810_NAME="i810"
I810_DESC="Intel i830/i845 Driver"
I810_CVS_DIR="$CVS_DRV_DIR/i810"
I810_CVS_DRI="$CVS_DRI_DIR/i830"
I810_MODULES="i830"
I810_COMMAND=""
###########################################################
# GENERAL FUNCTIONS
###########################################################
print_logo() {
################################################################
# This function prints a DRI logo and a general text header.
################################################################
clear
echo ""
echo "DIRECT RENDERING OPEN SOURCE PROJECT - DRIVER PACKAGING SCRIPT"
echo ""
echo "[ http://dri.sourceforge.net ]"
echo ""
echo "=========================================================================="
echo ""
}
###########################################################
# PACKAGE CREATE FUNCTIONS
###########################################################
create_tar() {
#####################################################################
# Creates a generic tarball.
#####################################################################
local PKG_DRV_DIR="$PKG_DIR/$DRV_NAME"
local PKG_DRM_DIR="$PKG_DIR/drm"
local PKG_GL_DIR="$PKG_DIR/GL"
local PKG_CORE_DIR="$PKG_DIR/core"
# Check automatic build
if [ $2 ]; then
print_logo
echo "The following files will be included in the tarball if found"
echo "in the current directory:"
echo ""
echo " install.sh (this should definitely be included)"
echo " README"
echo " INSTALL"
echo " RELNOTES"
echo ""
echo "Press ENTER to continue or CTRL-C to abort."
read KEY
fi
print_logo
# Copy driver sources
if [ ! -e "$DRV_CVS_DIR" ]; then
echo "Error: 2D/3D driver directory does not exist."
exit 127;
fi
echo -n "Creating $DRV_NAME package..."
echo -n "Copying 2D/3D driver modules..."
mkdir -p $PKG_DRV_DIR
cp -r -f $DRV_CVS_DIR/*drv.o $PKG_DRV_DIR
cp -r -f $DRV_CVS_DRI/*dri.so $PKG_DRV_DIR
echo "done"
# Copy DRM sources
if [ ! -e "$CVS_DRM_DIR" ]; then
echo "Error: DRM kernel module source directory does no exist."
exit 127;
fi
echo -n "Copying DRM kernel module sources..."
cp -L -r -f $CVS_DRM_DIR $PKG_DRM_DIR
echo "done"
# Copy GL library
#if [ ! -e "$CVS_LIB_DIR" ]; then
# echo "Error: lib source directory does not exist."
# exit 127;
#fi
#echo -n "Copying GL library..."
#mkdir -p $PKG_GL_DIR
#cp -f $CVS_LIB_DIR/GL/GL/libGL.so.1.2 $PKG_GL_DIR
#cp -f $CVS_LIB_DIR/GLU/libGLU.so.1.3 $PKG_GL_DIR
#echo "done"
# Copy GLX, GLcore library
#if [ ! -e "$CVS_CORE_DIR" ]; then
# echo "Error: core source directory does not exist."
# exit 127;
#fi
#echo -n "Copying GLX, GLcore, DRI, DRM libraries..."
#mkdir -p $PKG_CORE_DIR
#cp -f $CVS_CORE_DIR/GL/libglx.a $PKG_CORE_DIR
#cp -f $CVS_CORE_DIR/GL/dri/libdri.a $PKG_CORE_DIR
#cp -f $CVS_CORE_DIR/GL/mesa/src/libGLcore.a $PKG_CORE_DIR
#cp -f $CVS_CORE_DIR/hw/xfree86/os-support/linux/drm/libdrm.a $PKG_CORE_DIR
#echo "done"
# Execute Driver Specific Commands
echo -n "Running driver specific commands..."
`$DRV_COMMAND`
echo "done"
# Create package ...
echo -n "Copying optional files..."
# include installation script
if [ -e "install.sh" ]; then
cp install.sh $PKG_DIR;
fi
# include README file
if [ -e "README" ]; then
cp README $PKG_DIR;
fi
# include INSTALL file
if [ -e "INSTALL" ]; then
cp INSTALL $PKG_DIR;
fi
# include RELNOTES file
if [ -e "RELNOTES" ]; then
cp RELNOTES $PKG_DIR;
fi
echo "done"
# create package info file
# The install.sh script expects it as follows right now:
# DRV_NAME
# DRV_DESC
# DRV_ARCH
# Date Packaged
# DRV_MODULES
# DRV_VERSION
# DRV_BUILD_DESC
echo "$DRV_NAME" >> "$PKG_DIR/pkginfo"
echo "$DRV_DESC" >> "$PKG_DIR/pkginfo"
echo "$DRV_ARCH" >> "$PKG_DIR/pkginfo"
date +%Y%m%d >> "$PKG_DIR/pkginfo"
echo "$DRV_MODULES" >> "$PKG_DIR/pkginfo"
echo "$DRV_VERSION" >> "$PKG_DIR/pkginfo"
echo "$DRV_BUILD_DESC" >> "$PKG_DIR/pkginfo"
# create tarball
echo -n "Creating tarball..."
ARCHIVE="$DRV_PKG_NAME.tar"
tar -cf $ARCHIVE $PKG_DIR
gzip $ARCHIVE
# Check automatic build
if [ $2 ]; then
echo "done"
echo ""
echo "Package has been created. Press ENTER to continue."
read KEY
fi
}
create_rpm() {
#####################################################################
# Creates a generic RPM package.
#####################################################################
echo ""
echo "RPM creation not yet implemented."
echo ""
exit 127;
}
create_deb() {
#####################################################################
# Creates a Debian DEB package.
#####################################################################
echo ""
echo "DEB creation not yet implemented."
echo ""
exit 127;
}
create_tgz() {
#####################################################################
# Creates a Slackware TGZ.
#####################################################################
echo ""
echo "TGZ creation not yet implemented."
echo ""
exit 127;
}
create_rh7rpm() {
#####################################################################
# Creates a RedHat 7 specific RPM package.
#####################################################################
echo ""
echo "RedHat 7 RPM creation not yet implemented."
echo ""
exit 127;
}
###########################################################
# MAIN SCRIPT STARTS HERE
###########################################################
# Check parameters
if [ ! -e "$CVS_DIR" ]; then
echo "Syntax: dripkg [CVS directory]"
echo "You have to specify a valid DRI CVS directory."
exit 127;
fi
# Check automatic build
if [ ! $2 ]; then
# Print some info
print_logo
echo "This script will package up the DRI 2D/3D modules and the DRM kernel sources."
echo "You have the choice of different package formats."
echo ""
echo "You should have pointed this script to a DRI CVS directory with a tree that"
echo "has already been compiled. Notice that you should have NOT compiled the DRM"
echo "kernel modules."
echo ""
echo "Press ENTER to continue or CTRL-C to abort."
read KEY
fi
# Check automatic build
if [ ! $2 ]; then
# Create working directory
print_logo
echo "The script will now create a 'dripkg' subdirectory."
echo "If this directory already exists it will be deleted."
echo ""
echo "Press ENTER to continue or CTRL-C to abort."
read KEY
fi
rm -f -r $PKG_DIR
mkdir -p $PKG_DIR
# List available drivers and let user select a driver
if [ $2 ]; then
DRV=$2;
else
unset KEY
unset I
until [ $KEY -ge 0 ] && [ $KEY -le $I ];
do
print_logo
echo "Select the driver you want to package:"
echo ""
I=1
for DRV in ${DRIVERS[*]}
do
eval "echo \" $I. $DRV - \$${DRV}_DESC\""
let I=I+1
done
let I=I-2 # number of array elements
echo ""
echo -n "Selection: "
read KEY
let KEY=KEY-1 # zero based array index
done
# Determine driver info
DRV=${DRIVERS[$KEY]}
fi
eval "DRV_ID=\"\$${DRV}_ID\""
eval "DRV_NAME=\"\$${DRV}_NAME\""
eval "DRV_DESC=\"\$${DRV}_DESC\""
eval "DRV_CVS_DIR=\"\$${DRV}_CVS_DIR\""
eval "DRV_CVS_DRI=\"\$${DRV}_CVS_DRI\""
eval "DRV_MODULES=\"\$${DRV}_MODULES\""
eval "DRV_COMMAND=\"\$${DRV}_COMMAND\""
# Check automatic build
if [ ! $2 ]; then
# Allow user to enter a build description and tag
print_logo
echo "Here you can enter a specific driver version and build information."
echo ""
echo "This information is optional."
echo ""
echo -n "Driver Version : "
read DRV_VERSION
echo -n "Build Description : "
read DRV_BUILD_DESC
echo -n "Build Tag : "
read DRV_BUILD_TAG
fi
# Select driver architecture
if [ $3 ]; then
DRV_ARCH=$3;
else
unset KEY
until [ "$KEY" == "1" ] || [ "$KEY" == "2" ] || [ "$KEY" == "3" ];
do
print_logo
echo "Please select the driver target architecture:"
echo ""
echo " 1. Intel x86"
echo " 2. PowerPC"
echo " 3. Alpha"
echo ""
echo -n "Selection: "
read KEY;
done
if [ "$KEY" == "1" ]; then
DRV_ARCH="i386";
elif [ "$KEY" == "2" ]; then
DRV_ARCH="ppc";
elif [ "$KEY" == "3" ]; then
DRV_ARCH="alpha";
fi
fi
# Let user select package format
if [ $4 ]; then
FMT=$4;
else
unset KEY
unset I
until [ $KEY -ge 0 ] && [ $KEY -le $I ];
do
print_logo
echo "Select the desired package format:"
echo ""
I=1
for FMT in ${FORMATS[*]}
do
eval "echo \" $I. $FMT - \$${FMT}_DESC\""
let I=I+1
done
let I=I-2 # number of array elements
echo ""
echo -n "Selection: "
read KEY
let KEY=KEY-1 # zero based array index
done
# Determine format info
FMT=${FORMATS[$KEY]}
fi
eval "DRV_PKG_TYPE=\"${FMT}\""
eval "DRV_PKG_FUNC=\"\$${FMT}_FUNC\""
eval "DRV_PKG_DESC=\"\$${FMT}_DESC\""
# Get package name
if [ -n "$DRV_BUILD_TAG" ]; then
DRV_PKG_NAME=$DRV_NAME"-"$DRV_BUILD_TAG"-"`date +%Y%m%d`"-"$DRV_ARCH"-"$OS_NAME;
else
DRV_PKG_NAME=$DRV_NAME"-"`date +%Y%m%d`"-"$DRV_ARCH"-"$OS_NAME;
fi
# Check automatic build
if [ ! $2 ]; then
# Print info screen
print_logo
echo "You have entered the following: "
echo ""
echo "Driver : $DRV_NAME"
echo "Description : $DRV_DESC"
echo "Architecture : $DRV_ARCH"
echo ""
echo "Version : $DRV_VERSION"
echo "Build Description : $DRV_BUILD_DESC"
echo "Build Tag : $DRV_BUILD_TAG"
echo ""
echo "Package Type : $DRV_PKG_TYPE ($DRV_PKG_DESC)"
echo "Package Name : $DRV_PKG_NAME"
echo ""
echo "Press ENTER to create package or CTRL-C to abort."
read KEY
fi
# Run package specific create function
$DRV_PKG_FUNC
# Print a goodbye message
print_logo
echo "Your package has been created."
echo ""
echo "Thank you for using the DRI Packaging Script."
echo ""
# NOTE:
# Add some FTP uploading code here or in create function later.