Add minires include files for msys-minires.dll
[msysgit.git] / src / common / update-lib.sh
blobfe8b94b2a381877939cbe6798159cbfde9e35b34
1 #!/bin/sh
3 # Make sure that the working directory is clean and does not have untracked
4 # files; otherwise our semi-automatic finding the new files will not work!
6 die () {
7 echo "$*" >&2
8 exit 1
11 check_pristine () {
12 (cd / &&
13 git diff-files --ignore-submodules --quiet &&
14 git diff-index --cached --ignore-submodules --quiet HEAD &&
15 others="$(git ls-files --exclude-standard --others)" &&
16 test -z "$others") ||
17 die "State not pristine enough for successful package update"
20 # Remove old files stored in fileList.txt
21 pre_install () {
22 test -z "$FILELIST" && {
23 echo "No file list specified for pre_install"
24 exit 1
26 ! test -s "$FILELIST" ||
27 cat "$FILELIST" | (cd / && xargs git rm --ignore-unmatch) ||
28 exit
31 # update the index
32 post_install () {
33 (cd / && git add -N .) || exit
35 git diff --cached --ignore-submodules --diff-filter=AM --name-only |
36 sed -e "s/^/\//" > "$FILELIST" ||
37 exit
39 git add "$FILELIST" || exit
41 echo "Successfully built and installed $package $version"
42 echo "After checking the result, please commit (possibly with --amend)"
43 echo
46 download () {
47 test -z "$tar" &&
48 die "Script did not specify an archive"
49 test -f "$tar" || {
50 echo "Downloading $tar ..."
51 curl $url/$tar -o $tar || exit
55 extract () {
56 test -z "$d" &&
57 die "Script did not specify a directory"
58 test -d "$d" || {
59 echo "Unpacking $tar ..."
60 case "$tar" in
61 *.tar.gz|*.tgz)
62 tar -xzf "$tar"
64 *.tar.bz2|*.tbz)
65 tar -xjf "$tar"
67 *.zip)
68 unzip "$tar"
70 esac || exit
74 apply_patches () {
75 test -d "$d"/.git && return
76 patchdir="$(pwd)"/patches
77 (cd "$d" &&
78 git init &&
79 git config --local core.autocrlf false &&
80 git add . &&
81 git commit -m initial &&
82 for p in "$patchdir"/*.patch
84 git am "$p" || exit
85 done) ||
86 exit
89 setup () {
90 test -z "$d" &&
91 die "Script did not specify a directory"
92 test -f "$d/Makefile" ||
93 (cd "$d" && ./configure $configure_options) || exit
96 compile () {
97 test -z "$d" &&
98 die "Script did not specify a directory"
99 (cd "$d" && make) || exit
102 download_extract_setup_and_compile () {
103 download &&
104 extract &&
105 setup &&
106 compile || exit