summaryrefslogtreecommitdiff
path: root/mpeix/relink
blob: 0ba9aebadad7a5bde3279ce090ea673a98f0ca0b (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
#!/bin/sh

# The MPE POSIX libc archive library contains rand(), but this function has
# been omitted from the libc shared library on the mistaken assumption that
# the rand() function in the kernel library /SYS/PUB/XL could be used instead.
# However, rand() in /SYS/PUB/XL is a Fortran function with different semantics
# from the C version that we expect.

# So in order to get the correct rand() function and to make it available to
# the dynamically loaded perl extensions, we will build our own mini rand()
# shared library and add this to the perl NMPRG's XL list.

RAND=/$HPACCOUNT/$HPGROUP/libcrand

echo "Creating $RAND.sl...\n"

TEMP=/tmp/perlmpe.$$

rm -f $TEMP $RAND.a $RAND.sl

/bin/cat - >$TEMP <<EOF
buildrl $RAND.a
copyrl from=/lib/libc.a;to=$RAND.a;module=rand
revealrl rl=$RAND.a;all
buildxl $RAND.sl;limit=1
addxl from=$RAND.a;to=$RAND.sl;share
listxl xl=$RAND.sl
EOF

callci "xeq LINKEDIT.PUB.SYS <$TEMP"

rm -f $TEMP $RAND.a

# MPE/iX as of 5.5 does not yet properly support linking against dynamic
# libraries via gcc or ld.  For now, re-run gcc without the external library
# list, and then run the native linker with the list of dynamic libraries.

echo "Creating the perl executable NMPRG..."

gcc -o perl perlmain.o \
  lib/auto/DynaLoader/DynaLoader.a \
  libperl.a \
  `cat ext.libs` \
  -L/BINDFW/CURRENT/lib -lbind \
  -L/SYSLOG/PUB -lsyslog

echo "Modifying the perl executable NMPRG XL list...\n"

callci "xeq LINKEDIT.PUB.SYS 'altprog ./perl;xl=/usr/lib/libcurses.sl,/lib/libsvipc.sl,/usr/lib/libsocket.sl,/usr/lib/libstr.sl,/lib/libm.sl,$RAND.sl,/lib/libc.sl'"