forked from msysgit/msysgit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
105 lines (94 loc) · 2.45 KB
/
release.sh
File metadata and controls
105 lines (94 loc) · 2.45 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
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
103
104
105
#!/bin/sh
cd "$(dirname "$0")"
VERSION=0.9.8x
DIR=openssl-$VERSION
URL=http://www.openssl.org/source/$DIR.tar.gz
FILE=${URL##*/}
die () {
echo "$*" >&2
exit 1
}
replace_symlinks_with_copies () {
BRANCH=$1
SYMLINKS="$(git ls-tree -r $BRANCH: | sed -n 's/^120000.\{47\}//p')" &&
if test -z "$SYMLINKS"
then
die "No symlinks found? You need to update your /git/."
else
(export GIT_INDEX_FILE=.git/tmp &&
git read-tree $BRANCH &&
i=1 &&
total=$(echo "$SYMLINKS" | wc -l) &&
UPDATES="$(echo "$SYMLINKS" |
while read path
do
printf "\rProcessing symlink ($i/$total)" >&2 &&
i=$(($i+1)) &&
BASEDIR="${path%/*}/" &&
TARGET="$(git cat-file blob $BRANCH:$path)" &&
while test "$TARGET" != "${TARGET#../}"
do
BASEDIR="$(echo "$BASEDIR" |
sed 's|[^/]*/$||')" &&
TARGET="${TARGET#../}"
done &&
git ls-files --stage "$BASEDIR$TARGET" |
sed "s| .*$| $path|"
done)" &&
echo "$UPDATES" | git update-index --index-info &&
TREE=$(git write-tree) &&
COMMIT=$(echo "Replace symlinks with copies" |
git commit-tree $TREE -p $BRANCH) &&
git update-ref refs/heads/$BRANCH $COMMIT)
fi
}
apply_patches () {
test $(ls ../patches/*.patch | wc -l) = \
$(($(git rev-list HEAD | wc -l)-2)) && return
git am ../patches/*.patch
}
test -d $DIR || {
test -f $FILE ||
curl -O $URL ||
die "Could not download OpenSSL"
mkdir $DIR && (
cd $DIR &&
git init &&
git config core.autocrlf false &&
/git/contrib/fast-import/import-tars.perl ../$FILE
)
} || die "Could not check out openssl"
test $(cat $DIR/apps/md4.c 2> /dev/null | wc -l) -gt 2 || (
cd $DIR &&
replace_symlinks_with_copies import-tars &&
git checkout import-tars &&
test $(wc -l < apps/md4.c) -gt 2
) || die "Could not replace symlinks with copies"
test grep INSTALLTOP=/mingw $DIR/Makefile > /dev/null 2>&1 || (
cd $DIR &&
apply_patches
) || die "Could not apply the patches"
test -f $DIR/openssl.dll || (
cd $DIR &&
cmd /c ms\\mingw32.bat &&
cd out &&
list=$(echo *.dll openssl.exe) &&
cp $list /mingw/bin && (
cd /mingw/bin &&
git add $list &&
git commit -s -m "Install OpenSSL $VERSION"
) &&
list=$(echo *.dll.a) &&
cp $list /mingw/lib && (
cd /mingw/lib &&
git add $list &&
git commit -s -m "Install OpenSSL $VERSION import libs"
) &&
cd ../outinc &&
cp -r openssl /mingw/include &&
(
cd /mingw/include &&
git add openssl &&
git commit -s -m "Install OpenSSL $VERSION header files"
)
) || die "Could not install $FILE"