openssl: update release script to use version 0.9.8y
[msysgit.git] / src / openssl / release.sh
blobc184ec2c179717cd3a9fb1429529a3932333eba5
1 #!/bin/sh
3 cd "$(dirname "$0")"
5 VERSION=0.9.8y
6 DIR=openssl-$VERSION
7 URL=http://www.openssl.org/source/$DIR.tar.gz
8 FILE=${URL##*/}
10 die () {
11 echo "$*" >&2
12 exit 1
15 replace_symlinks_with_copies () {
16 BRANCH=$1
17 SYMLINKS="$(git ls-tree -r $BRANCH: | sed -n 's/^120000.\{47\}//p')" &&
18 if test -z "$SYMLINKS"
19 then
20 die "No symlinks found? You need to update your /git/."
21 else
22 (export GIT_INDEX_FILE=.git/tmp &&
23 git read-tree $BRANCH &&
24 i=1 &&
25 total=$(echo "$SYMLINKS" | wc -l) &&
26 UPDATES="$(echo "$SYMLINKS" |
27 while read path
29 printf "\rProcessing symlink ($i/$total)" >&2 &&
30 i=$(($i+1)) &&
31 BASEDIR="${path%/*}/" &&
32 TARGET="$(git cat-file blob $BRANCH:$path)" &&
33 while test "$TARGET" != "${TARGET#../}"
35 BASEDIR="$(echo "$BASEDIR" |
36 sed 's|[^/]*/$||')" &&
37 TARGET="${TARGET#../}"
38 done &&
39 git ls-files --stage "$BASEDIR$TARGET" |
40 sed "s| .*$| $path|"
41 done)" &&
42 echo "$UPDATES" | git update-index --index-info &&
43 TREE=$(git write-tree) &&
44 COMMIT=$(echo "Replace symlinks with copies" |
45 git commit-tree $TREE -p $BRANCH) &&
46 git update-ref refs/heads/$BRANCH $COMMIT)
51 apply_patches () {
52 test $(ls ../patches/*.patch | wc -l) = \
53 $(($(git rev-list HEAD | wc -l)-2)) && return
54 git am ../patches/*.patch
57 test -d $DIR || {
58 test -f $FILE ||
59 curl -O $URL ||
60 die "Could not download OpenSSL"
62 mkdir $DIR && (
63 cd $DIR &&
64 git init &&
65 git config core.autocrlf false &&
66 /git/contrib/fast-import/import-tars.perl ../$FILE
68 } || die "Could not check out openssl"
70 test $(cat $DIR/apps/md4.c 2> /dev/null | wc -l) -gt 2 || (
71 cd $DIR &&
72 replace_symlinks_with_copies import-tars &&
73 git checkout import-tars &&
74 test $(wc -l < apps/md4.c) -gt 2
75 ) || die "Could not replace symlinks with copies"
77 test grep INSTALLTOP=/mingw $DIR/Makefile > /dev/null 2>&1 || (
78 cd $DIR &&
79 apply_patches
80 ) || die "Could not apply the patches"
82 test -f $DIR/openssl.dll || (
83 cd $DIR &&
84 cmd /c ms\\mingw32.bat &&
85 cd out &&
86 list=$(echo *.dll openssl.exe) &&
87 cp $list /mingw/bin && (
88 cd /mingw/bin &&
89 git add $list &&
90 git commit -s -m "Install OpenSSL $VERSION"
91 ) &&
92 list=$(echo *.dll.a) &&
93 cp $list /mingw/lib && (
94 cd /mingw/lib &&
95 git add $list &&
96 git commit -s -m "Install OpenSSL $VERSION import libs"
97 ) &&
98 cd ../outinc &&
99 cp -r openssl /mingw/include &&
101 cd /mingw/include &&
102 git add openssl &&
103 git commit -s -m "Install OpenSSL $VERSION header files"
105 ) || die "Could not install $FILE"