bash: enable multibyte support (Unicode line editing)
[msysgit.git] / src / rt / release.sh
blob5bd2297f24c7bbd93c6db2a9a26d5e45a0350345
1 #!/bin/sh
3 die () {
4 echo "$*" >&2
5 exit 1
8 cd "$(dirname "$0")"
10 target=
11 debug=
13 # see what to build
14 case "$1" in
15 msys|bash)
16 target=$1
19 die "$0 (msys|bash) [options]"
21 esac
23 shift
25 test "a$1" = "a--debug" && debug=t
26 debug_clean=
27 test "$debug" = "$(cat debug.txt 2>/dev/null)" || debug_clean=t
28 echo "$debug" > debug.txt
30 test -d ../msys/msys/rt ||
32 cd ../.. &&
33 git submodule update --init src/msys
34 ) ||
35 die "Could not check out msys.git"
37 cd ../msys || {
38 echo "Huh? ../msys does not exist."
39 exit 1
42 current=$(git rev-list --no-merges origin/master.. | wc -l) &&
43 total=$(ls ../rt/patches/*.patch | wc -l) &&
44 i=1 &&
45 while test $i -le $total
47 test $i -le $current ||
48 git am ../rt/patches/$(printf "%04d" $i)*.patch ||
49 die "Error: Applying patches failed."
50 i=$(($i+1))
51 done
54 cd msys &&
55 release=MSYS-g$(git show -s --pretty=%h HEAD) ||
56 die "Could not detect MSYS release"
58 test -f /bin/cc.exe || ln gcc.exe /bin/cc.exe ||
59 die "Could not make sure that MSys cc is found instead of MinGW one"
61 # build msys.dll
62 release_msys() {
63 (export MSYSTEM=MSYS &&
64 export PATH=/bin:$PATH &&
65 cd rt &&
66 (test -d bld || mkdir bld) &&
67 cd bld &&
68 DLL=i686-pc-msys/winsup/cygwin/new-msys-1.0.dll &&
69 (test -f Makefile && test -z "$debug_clean" ||
70 ../src/configure --prefix=/usr --enable-newlib-mb) &&
71 (test -z "$debug" || perl -i.bak -pe 's/-O2//g' $(find -name Makefile)) &&
72 (test -z "$debug_clean" || make clean) &&
73 (make || test -f $DLL) &&
74 (test ! -z "$debug" || strip $DLL) &&
75 rebase -b 0x68000000 $DLL &&
76 mv $DLL /bin/) &&
77 cd / &&
78 hash=$(git hash-object -w bin/new-msys-1.0.dll) &&
79 git update-index --cacheinfo 100755 $hash bin/msys-1.0.dll &&
80 git commit -s -m "Updated msys-1.0.dll to $release" &&
81 /share/msysGit/post-checkout-hook HEAD^ HEAD 1
84 # build bash.exe
85 release_bash() {
86 (export MSYSTEM=MSYS &&
87 export PATH=/bin:$PATH &&
88 cd packages/bash &&
89 case "$(git config --get --bool core.autocrlf)" in
90 true)
91 git config core.autocrlf false &&
92 git read-tree HEAD &&
93 git stash
95 esac &&
96 (test -d bld || mkdir bld) &&
97 cd bld &&
98 BASH=bash.exe &&
99 (test -f Makefile && test -z "$debug_clean" ||
100 ../3.1/configure \
101 --prefix=/usr \
102 --sysconfdir=/etc \
103 --localstatedir=/var \
104 --enable-multibyte \
105 --disable-rpath \
106 --without-curses) &&
107 (test -z "$debug" || perl -i.bak -pe 's/-O2//g' $(find -name Makefile)) &&
108 (test -z "$debug_clean" || make clean) &&
109 make &&
110 test -f $BASH &&
111 (test ! -z "$debug" || strip $BASH) &&
112 cp $BASH /bin/new-bash.exe) &&
113 cd / &&
114 hash=$(git hash-object -w bin/new-bash.exe) &&
115 git update-index --cacheinfo 100755 $hash bin/bash.exe &&
116 git update-index --cacheinfo 100755 $hash bin/sh.exe &&
117 git commit -s -m "Updated bash.exe to $release" &&
118 /share/msysGit/post-checkout-hook HEAD^ HEAD 1
121 release_$target