aboutsummaryrefslogtreecommitdiffstats
path: root/mklibs/mkslib.linux
blob: 95141435ffa86d09231a67d2db8551ded0035218 (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
#!/bin/sh

# Make a Linux ELF shared library
# Improved by Sven Goethel <s_goethel@bielefeld.netsurf.de>
# 	goal: same tool for any machines ...
# 	

# First argument is name of output library
# 	without dirname and suffix
# second and third are the major and minor number
# Rest of arguments are object files

LIBDIR=$1
shift 1

LIBRARY=$1
shift 1

LIBMAJOR=$1
shift 1

LIBMINOR=$1
shift 1

LIBBUGFIX=$1
shift 1


OBJECTS=$*

# the following provided by Thomas Hiller (Hiller@tu-harburg.d400.de)

VERSION="${LIBMAJOR}.${LIBMINOR}.${LIBBUGFIX}"

LIBNAME=${LIBRARY}.so

# Remove any old files from previous make
rm -f ${LIBDIR}/${LIBNAME}*

gcc -shared -Wl,-soname,${LIBNAME}.${LIBMAJOR} \
    -o ${LIBDIR}/${LIBNAME}.${VERSION} \
    ${OBJECTS}

( cd ${LIBDIR} ; 
  ln -s ${LIBNAME}.${VERSION} ${LIBNAME}.${LIBMAJOR}.${LIBMINOR} 
)

( cd ${LIBDIR} ; 
  ln -s ${LIBNAME}.${LIBMAJOR}.${LIBMINOR} ${LIBNAME}.${LIBMAJOR} 
)

( cd ${LIBDIR} ; 
  ln -s ${LIBNAME}.${LIBMAJOR} ${LIBNAME} 
)

# Print a reminder about shared libs:
echo
echo "******Be sure to add" ${LIBDIR}" to your LD_LIBRARY_PATH variable"
echo
sleep 2



#### NOTES:
# One Mesa user reports having to run the "ldconfig -v" command to make
# Linux aware of the shared libs.