summaryrefslogtreecommitdiff
path: root/debian/relink
blob: 7cfb24e61f1a274142fa96c0c043fd8a788ba65b (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
67
68
69
70
71
72
73
74
#! /bin/sh
#
# Relink GNAT utilities using the shared library
#

set -e

pwd=`pwd`

# why?
chmod a-w build/gcc/ada/rts/*.ali

rm -rf tmp
ln -s $pwd/build/gcc/ada/rts/libgnat.so.1 tmp/libgnat.so

LD_LIBRARY_PATH=$pwd/tmp
export LD_LIBRARY_PATH

PATH=$pwd/debian:$pwd/tmp:$PATH
export PATH

echo "#! /bin/sh" > tmp/dgcc
echo "$pwd/build/gcc/xgcc -B$pwd/build/gcc/ "'"$@"' >> tmp/dgcc
chmod 755 tmp/dgcc

echo "#! /bin/sh" > tmp/dgnatlink
echo "$pwd/build/gcc/gnatlink --GCC=dgcc "'"$@"' >> tmp/dgnatlink
chmod 755 tmp/dgnatlink

GMCMD="$pwd/build/gcc/gnatmake -I- -Irts -I. -a -m --GNATBIND=$pwd/build/gcc/gnatbind --GNATLINK=dgnatlink --GCC=dgcc"

#cd $pwd/build/gcc/ada
#make CFLAGS="-O2" CC="../xgcc -B../" STAGE_PREFIX=../ a-link.o a-gmem.o
#cd $pwd

[ -f build/gcc/gnatmake.old ] || cp -p build/gcc/gnatmake build/gcc/gnatmake.old
[ -f build/gcc/gnatlink.old ] || cp -p build/gcc/gnatlink build/gcc/gnatlink.old

make -C build/gcc/ada \
	CFLAGS='-gnatp -gnata -O2 ' \
	ADA_INCLUDES="-I." \
	CC="../xgcc -B../" \
	STAGE_PREFIX=../ \
    ../gnatmake ../gnatlink

mv gnatmake bgnatmake
mv gnatlink bgnatlink
exit 0

cd build/gcc/ada
for i in ../gnatchop ../gnatcmd \
    ../gnatkr ../gnatlbr \
    ../gnatls ../gnatmake \
    ../gnatprep ../gnatpsys \
    ../gnatxref ../gnatfind
do
  rm -f $i
  $GMCMD -O2 -gnatp -o $i `basename $i`.adb -largs -L..
done

rm -f ../gnatmem
$GMCMD -O2 -gnatp -o ../gnatmem gnatmem.adb -largs -L.. a-gmem.o
$GMCMD -O2 -gnatp -o ../gnatlink gnatlink -largs -L.. a-link.o
rm -f ../gnatpsta

make CFLAGS="-O2" CC="../xgcc -B../" a-gettty.o a-deftar.o
$GMCMD -O2 -gnatp -o ../gnatpsta gnatpsta -largs -L.. a-gettty.o a-deftar.o
rm -f ../gnatbl

make CFLAGS="-O2" CC="../xgcc -B../" gnatbl.o
../xgcc -B../ -o ../gnatbl gnatbl.o -L.. -lgnat
rm -f ../bgnatmake ../bgnatlink ../debian/dgcc ../debian/dgnatlink

chmod +w rts/*.ali