-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstallForRsync
executable file
·103 lines (82 loc) · 2.59 KB
/
InstallForRsync
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
#!/bin/bash
hostname
date
# check archive
ARCHIVE=`ls -f gap*.tar.gz |head -1`
if [ $ARCHIVE'X' != X ]; then
echo "Using archive "$ARCHIVE
else
echo "No archive found. Please, download from "
echo " https://www.gap-system.org/Releases/"
exit 1
fi
tar xzvf $ARCHIVE --one-top-level=build
# compile GAP and packages
cd build
mv gap* gap-rsync
cd gap-rsync
# repair some permissions
chmod -R -c g-w,o-r,g+r,o+r .
chmod 755 pkg
./configure
make -j 8
# compiling packages
cd pkg
../bin/BuildPackages.sh
cd ..
# find all executable files which use shared libraries
# (this list is empty for the content of the original archive)
find -type f -executable -exec sh -c "file -i '{}' | \
grep -q '\(x-sharedlib\|x-pie-executable\|x-executable\); charset=binary'" \; -print > executables
# find the dynamic libraries needed by the executables
for a in `cat executables `
do
ldd $a;
done | grep '=>' | sed -e 's|.* => ||' | \
sed -e 's| (.*||' | sort |uniq > neededlibs
# make copies of needed library files and set rpath in copies
mkdir -p locallibs
for a in `cat neededlibs`
do
cp -aL $a locallibs/
patchelf --set-rpath '$ORIGIN' locallibs/`basename $a`
done
# not most basic libs
rm -f locallibs/libc.* locallibs/libm.* locallibs/libdl.* \
locallibs/librt.* locallibs/libpthread* locallibs/libresolve.*
# set the rpath's in all executables
for a in `cat executables `
do
rp='$ORIGIN/'`dirname \`dirname $a\` | sed -e 's|[^/]*|..|g'`"/locallibs/"
patchelf --set-rpath $rp $a
done
# correction for ./gap
patchelf --set-rpath '$ORIGIN/locallibs/' gap
rm -rf executables neededlibs
# change absolute paths to allow 'make test...' in GAP root
sed -e 's|'`pwd`'|.|' GNUmakefile > xxx
mv xxx GNUmakefile
# adjust sysinfo.gap and gac
sed -e 's|"/cache/build/gap-rsync/|$GAPROOTPATH"|' < sysinfo.gap > xxx
mv xxx sysinfo.gap
sed -e 's|/cache/build/gap-rsync|$GAPROOTPATH|' < sysinfo.gap > xxx
mv xxx sysinfo.gap
echo 'GAPROOTPATH=`pwd`/' > xxx
cat sysinfo.gap >> xxx
mv xxx sysinfo.gap
sed -e 's|"/cache/build/gap-rsync/|`pwd`"/|' gac > xxx
mv xxx gac
chmod 755 gac
# save versions of GAP and all loadable packages
./gap << ENDOFINPUT
LoadAllPackages();
pl := GAPInfo.PackagesLoaded;;
l := SortedList(List(RecNames(pl), a-> pl.(a){[3,2]}),
{n1,n2}-> LowercaseString(n1[1]) < LowercaseString(n2[1]));
PrintTo("VERSIONS", "GAPVersion := \"",GAPInfo.Version,"\";\n",
"PackageVersions := ", l, ";\n\n");
QUIT;
ENDOFINPUT
cp -a ../../gapsync .
# check if last step worked, maybe gapsync dir is in another position
if test -f gapsync ; then echo DONE; else echo "ERROR: copy gapsync dir to "`pwd` ; fi