openssl: install EXE, DLLs and header files
[msysgit.git] / src / openssl / release.sh
blob39df4bc4ddc091d293c6ad2c233d26b533f5353d
1 #!/bin/sh
3 VERSION=0.9.8k
4 DIR=openssl-$VERSION
5 URL=http://www.openssl.org/source/$DIR.tar.gz
6 FILE=${URL##*/}
8 die () {
9 echo "$*" >&2
10 exit 1
13 replace_symlinks_with_copies () {
14 BRANCH=$1
15 SYMLINKS="$(git ls-tree -r $BRANCH: | sed -n 's/^120000.\{47\}//p')" &&
16 if test -z "$SYMLINKS"
17 then
18 die "No symlinks found? You need to update your /git/."
19 else
20 (export GIT_INDEX_FILE=.git/tmp &&
21 git read-tree $BRANCH &&
22 i=1 &&
23 total=$(echo "$SYMLINKS" | wc -l) &&
24 UPDATES="$(echo "$SYMLINKS" |
25 while read path
27 printf "\rProcessing symlink ($i/$total)" >&2 &&
28 i=$(($i+1)) &&
29 BASEDIR="${path%/*}/" &&
30 TARGET="$(git cat-file blob $BRANCH:$path)" &&
31 while test "$TARGET" != "${TARGET#../}"
33 BASEDIR="$(echo "$BASEDIR" |
34 sed 's|[^/]*/$||')" &&
35 TARGET="${TARGET#../}"
36 done &&
37 git ls-files --stage "$BASEDIR$TARGET" |
38 sed "s| .*$| $path|"
39 done)" &&
40 echo "$UPDATES" | git update-index --index-info &&
41 TREE=$(git write-tree) &&
42 COMMIT=$(echo "Replace symlinks with copies" |
43 git commit-tree $TREE -p $BRANCH) &&
44 git update-ref refs/heads/$BRANCH $COMMIT)
49 apply_patches () {
50 test $(ls ../patches/*.patch | wc -l) = \
51 $(($(git rev-list HEAD | wc -l)-2)) && return
52 git am ../patches/*.patch
55 test -d $DIR || {
56 test -f $FILE ||
57 curl -O $URL ||
58 die "Could not download OpenSSL"
60 mkdir $DIR && (
61 cd $DIR &&
62 git init &&
63 /git/contrib/fast-import/import-tars.perl ../$FILE
65 } || die "Could not check out openssl"
67 test $(cat $DIR/apps/md4.c 2> /dev/null | wc -l) -gt 2 || (
68 cd $DIR &&
69 replace_symlinks_with_copies import-tars &&
70 git checkout import-tars &&
71 test $(wc -l < apps/md4.c) -gt 2
72 ) || die "Could not replace symlinks with copies"
74 test grep INSTALLTOP=/mingw $DIR/Makefile > /dev/null 2>&1 || (
75 cd $DIR &&
76 apply_patches
77 ) || die "Could not apply the patches"
79 test -f $DIR/openssl.dll || (
80 cd $DIR &&
81 cmd /c ms\\mingw32.bat &&
82 cd out &&
83 list=$(echo *.dll openssl.exe) &&
84 cp $list /mingw/bin && (
85 cd /mingw/bin &&
86 git add $list &&
87 git commit -s -m "Install OpenSSL $VERSION"
88 ) &&
89 cd ../outinc &&
90 cp -r openssl /mingw/include &&
92 cd /mingw/include &&
93 git add openssl &&
94 git commit -s -m "Install OpenSSL $VERSION header files"
96 ) || die "Could not install $FILE"