Add /src/rebase
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 21 Feb 2008 17:51:06 +0000 (21 17:51 +0000)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 21 Feb 2008 17:58:16 +0000 (21 17:58 +0000)
The tool 'rebase' is needed to avoid memory region clashes between .dll
files.  This commit adds the infrastructure to recompile 'rebase.exe'.

Just call /src/rebase/release.sh and you're fixed.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
src/common/update-lib.sh [new file with mode: 0644]
src/rebase/.gitignore [new file with mode: 0644]
src/rebase/patches/0001-Fix-for-stricter-g.patch [new file with mode: 0644]
src/rebase/release.sh [new file with mode: 0644]

diff --git a/src/common/update-lib.sh b/src/common/update-lib.sh
new file mode 100644 (file)
index 0000000..126e6d1
--- /dev/null
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# Make sure that the working directory is clean and does not have untracked
+# files; otherwise our semi-automatic finding the new files will not work!
+
+die () {
+       echo "$*" >&2
+       exit 1
+}
+
+check_pristine () {
+       (cd / &&
+        git diff-files --quiet &&
+        git diff-index --cached --quiet HEAD &&
+        others="$(git ls-files --exclude-from=.gitignore \
+                       --exclude-per-directory=.gitignore --others)" &&
+        test -z "$others") ||
+               die "State not pristine enough for successful package update"
+}
+
+# Remove old files stored in fileList.txt
+pre_install () {
+       test -z "$FILELIST" && {
+               echo "No file list specified for pre_install"
+               exit 1
+       }
+       test -s "$FILELIST" &&
+               cat "$FILELIST" | (cd / && xargs git --ignore-unmatch rm) ||
+               exit
+}
+
+# update the index 
+post_install () {
+       (cd / && git add .) || exit
+
+       git diff --cached --diff-filter=AM --name-only |
+               sed -e "s/^/\//" > "$FILELIST" ||
+               exit
+               
+       git add "$FILELIST" || exit
+
+       echo "Successfully built and installed $package $version"
+       echo "After checking the result, please commit (possibly with --amend)"
+       echo
+}
+
+download () {
+       test -z "$tar" &&
+               die "Script did not specify an archive"
+       test -f "$tar" || {
+               echo "Downloading $tar ..."
+               curl $url/$tar -o $tar || exit
+       }
+}
+
+extract () {
+       test -z "$d" &&
+               die "Script did not specify a directory"
+       test -d "$d" || {
+               echo "Unpacking $tar ..."
+               case "$tar" in
+               *.tar.gz|*.tgz)
+                       tar -xzf "$tar"
+                       ;;
+               *.tar.bz2|*.tbz)
+                       tar -xjf "$tar"
+                       ;;
+               *.zip)
+                       unzip "$tar"
+                       ;;
+               esac || exit
+       }
+}
+
+setup () {
+       test -z "$d" &&
+               die "Script did not specify a directory"
+       test -f "$d/Makefile" ||
+               (cd "$d" && ./configure $configure_options) || exit
+}
+
+compile () {
+       test -z "$d" &&
+               die "Script did not specify a directory"
+       (cd "$d" && make) || exit
+}
+
+download_extract_setup_and_compile () {
+       download &&
+       extract &&
+       setup &&
+       compile || exit
+}
diff --git a/src/rebase/.gitignore b/src/rebase/.gitignore
new file mode 100644 (file)
index 0000000..488448e
--- /dev/null
@@ -0,0 +1 @@
+/rebase-*
diff --git a/src/rebase/patches/0001-Fix-for-stricter-g.patch b/src/rebase/patches/0001-Fix-for-stricter-g.patch
new file mode 100644 (file)
index 0000000..797abef
--- /dev/null
@@ -0,0 +1,44 @@
+From 599129078e624f0026090b6efc1f3782401b02bf Mon Sep 17 00:00:00 2001
+From: Johannes Schindelin <johannes.schindelin@gmx.de>
+Date: Thu, 21 Feb 2008 17:34:11 +0000
+Subject: [PATCH 1/1] Fix for stricter g++
+
+Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
+---
+ imagehelper/sections.cc |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/imagehelper/sections.cc b/imagehelper/sections.cc
+index 9dee579..d981555 100644
+--- a/imagehelper/sections.cc
++++ b/imagehelper/sections.cc
+@@ -285,7 +285,7 @@ bool Relocations::check(void)
+   if (debug)\r
+     std::cerr << "debug: checking relocations .... " << std::endl;\r
\r
+-  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)\r
++  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; relocp = (PIMAGE_BASE_RELOCATION)(((char *)relocp) + relocp->SizeOfBlock))\r
+     {\r
+       int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);\r
+       int va = relocp->VirtualAddress;\r
+@@ -328,7 +328,7 @@ bool Relocations::fix(void)
+   if (debug)\r
+     std::cerr << "warning: fixing bad relocations .... ";\r
\r
+-  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)\r
++  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; relocp = (PIMAGE_BASE_RELOCATION)(((char *)relocp) + relocp->SizeOfBlock))\r
+     {\r
+       int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);\r
+       int va = relocp->VirtualAddress;\r
+@@ -363,7 +363,7 @@ bool Relocations::relocate(int difference)
+   if (!relocs)\r
+     return false;\r
\r
+-  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; ((char *)relocp) += relocp->SizeOfBlock)\r
++  for (; (char *)&relocp->SizeOfBlock < (char *)relocs + size && relocp->SizeOfBlock != 0; relocp = (PIMAGE_BASE_RELOCATION)(((char *)relocp) + relocp->SizeOfBlock))\r
+     {\r
+       int NumOfRelocs = (relocp->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / sizeof (WORD);\r
+       int va = relocp->VirtualAddress;\r
+-- 
+1.5.3.6.2529.ga176-dirty
+
diff --git a/src/rebase/release.sh b/src/rebase/release.sh
new file mode 100644 (file)
index 0000000..6da4cc4
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+cd "$(dirname "$0")" && . ../common/update-lib.sh
+
+package=rebase
+version=2.4.2-1
+url=http://www.tishler.net/jason/software/rebase
+d=rebase-$version
+tar=$d-src.tar.bz2
+configure_options=--prefix=
+
+download &&
+extract &&
+test $d/.git || {
+       cd $d &&
+       git init &&
+       rm -rf .git/hooks &&
+       git add . &&
+       git commit -m initial &&
+       git am ../patches/*
+} &&
+compile &&
+cp $d/rebase.exe /bin/ &&
+(cd /bin && git add rebase.exe) &&
+echo "You can commit rebase.exe now"