init.sh
1.51 KB
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
#!/bin/bash
# initialize source codes of all supported libraries
# ------------------------------------------------------------------------------
# newlib
# ------------------------------------------------------------------------------
# newlib dir
NEWLIB_DIR=newlib
# git repository:
NELIB_REPO=git://sourceware.org/git/newlib-cygwin.git
# git commit:
NEWLIB_COMMIT=6238b1877d3c83b8b9ed589494d0705386b7f4f7
# git patches:
NEWLIB_PATCHES=../patches/newlib-*
# get newlib repository
if [ -d ${NEWLIB_DIR} ] && [ ! -d ${NEWLIB_DIR}/.github ]; then
echo "* Folder NEWLIB exists without git -> remove"
rm -r ${NEWLIB_DIR}
fi
if [ -d ${NEWLIB_DIR}/.github ]; then
echo "Git is already cloned"
else
echo "* - clone NEWLIB"
if [ ! -f .gitmodules ]; then
echo "get newlib from a remote repository"
git clone ${NELIB_REPO} ${NEWLIB_DIR}
else
# git submodule init
# git submodule update
git clone git://sourceware.org/git/newlib-cygwin.git newlib
fi
fi
# check the current commit
cd ${NEWLIB_DIR}
CURCOM=$(git rev-parse HEAD)
echo "CURCOM = ${CURCOM}"
if [ "${CURCOM}" == "${NEWLIB_COMMIT}" ]; then
echo "* right commit"
else
echo "* - reset to commit"
git reset --hard ${NEWLIB_COMMIT}
fi
# check if patched
for p in `ls -1 ${NEWLIB_PATCHES}`; do
echo "* patch ${p}"
if ! patch -R -p1 -s -f --dry-run <${p}; then
echo " * - use"
patch -p1 <${p}
else
echo " * already used"
fi
done
# ------------------------------------------------------------------------------
echo "*** done"