-
Notifications
You must be signed in to change notification settings - Fork 14
/
clang-setup
executable file
·72 lines (61 loc) · 1.95 KB
/
clang-setup
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
#!/bin/sh
# shellcheck disable=SC2016
CLANG=${1:-clang}
CLANGPP=${2:-clang++}
linker=${3:-ld.gold}
LD=$(which "${linker}")
export LDFLAGS="-fuse-ld=$LD"
SUDO='sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH'
CPUS="1"
ARCH=$(uname -m)
cd /tmp
# pre-create some directories
${SUDO} mkdir -p /usr/GNUstep/Local/Library/Libraries
${SUDO} mkdir -p /usr/GNUstep/Local/Library/Headers
# cleanup
${SUDO} rm -rf /tmp/libdispatch
${SUDO} rm -rf /tmp/libobjc2
# pull
git clone --recursive https://github.com/gnustep/libobjc2.git
# set vars
export CC="${CLANG}"
export CXX="${CLANGPP}"
# build and install
echo "======== Installing libobjc2..."
cd /tmp/libobjc2
mkdir build
cd build
cmake -DGNUSTEP_INSTALL_TYPE=SYSTEM ../ \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_ASM_COMPILER="${CC}" \
-DCMAKE_LINKER="${LD}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}"
make -j${CPUS}
${SUDO} -E make install && ${SUDO} ldconfig
if [ $ARCH != arm7l ]; then
cd /tmp
git clone https://github.com/apple/swift-corelibs-libdispatch.git libdispatch
echo "======== Installing libdispatch..."
cd /tmp/libdispatch
rm -rf build
mkdir build
cd build
cmake ../ \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DCMAKE_ASM_COMPILER="${CC}" \
-DCMAKE_LINKER="${LD}" \
-DCMAKE_MODULE_LINKER_FLAGS="${LDFLAGS}" \
-DCMAKE_INSTALL_BINDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_TOOLS)" \
-DCMAKE_INSTALL_LIBDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES)" \
-DCMAKE_INSTALL_INCLUDEDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS)" \
-DCMAKE_INSTALL_MANDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_DOC_MAN)" \
-DCMAKE_INSTALL_INFODIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_DOC_INFO)" \
-DCMAKE_INSTALL_DOCDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_DOC)" \
-DCMAKE_INSTALL_DATAROOTDIR="$(gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARY)" \
-DTESTS=OFF
make -j${CPUS}
${SUDO} -E make install && ${SUDO} ldconfig
fi
echo "Done."