forked from iains/gcc-12-branch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeps.sh
90 lines (80 loc) · 2.08 KB
/
deps.sh
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
#!/bin/sh
set -e
build=apple-darwin20
export MACOSX_DEPLOYMENT_TARGET=11.0
if [ ! -d deps ]; then
mkdir deps
fi
if [ ! -d deps/src ]; then
mkdir deps/src
fi
GMP=gmp-6.2.1
MPFR=mpfr-4.2.0
MPC=mpc-1.3.1
ISL=isl-0.24
modules="$GMP $MPFR $MPC $ISL"
## download and unpack sources
cd deps/src
for module in $modules; do
bm=$(echo $module | sed 's:-.*::')
suff=.xz
if [ $bm == mpc ]; then suff=.gz; fi
if [ $bm == isl ]; then suff=.bz2; fi
if [ ! -e ${module}.tar$suff ]; then
if [ $bm == isl ]; then
curl -LO https://gcc.gnu.org/pub/gcc/infrastructure/${module}.tar$suff
else
curl -LO https://ftp.gnu.org/gnu/${bm}/${module}.tar$suff
fi
fi
if [ ! -e ${module} ]; then
tar fxj ${module}.tar$suff
fi
done
cd ../..
if [ -z "$UPDATE" ]; then
rm -rf deps/build
mkdir deps/build
fi
cd deps
prefix=$(pwd)
relprefix=$(echo $prefix | sed 's:^/*::')
cd build
for module in $modules; do
bm=$(echo $module | sed 's:-.*::')
for arch in arm64 x86_64; do
conf="--prefix=$prefix --disable-shared --enable-static"
if [ $bm == gmp -a $arch == x86_64 ]; then
conf="--build=westmere-$build $conf"
else
carch=$arch
if [ $arch == arm64 ]; then
carch=aarch64
fi
conf="--build=$carch-$build $conf"
fi
if [ -z "$UPDATE" -o ! -e "dst-$arch-$module" ]; then
obj=obj-$arch-$module
rm -rf $obj
mkdir $obj
cd $obj
../../src/$module/configure $conf "CC=clang -arch $arch" "CXX=clang++ -arch $arch" CPPFLAGS=-I$prefix/include LIBS=-L$prefix/lib --disable-shared --enable-static --with-pic
make -j16
rm -rf ../dst-$arch-$module
make install DESTDIR="$(pwd)/../dst-$arch-$module"
if [ $arch == arm64 ]; then
make install
fi
cd ..
fi
if [ $arch == x86_64 ]; then
cd dst-$arch-$module
libs=$(find $relprefix -name \*.a)
cd ..
for lib in $libs; do
echo lipo -create -arch arm64 dst-arm64-$module/$lib -arch x86_64 dst-x86_64-$module/$lib -output /$lib
lipo -create -arch arm64 dst-arm64-$module/$lib -arch x86_64 dst-x86_64-$module/$lib -output /$lib
done
fi
done
done