summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authordzwdz2021-08-05 19:13:46 +0000
committerdzwdz2021-08-05 19:13:46 +0000
commit0dd98382208f12e36f22ad50791180afe8232ce6 (patch)
tree13741e75653fe672f2a3940130e2384cb5df8d14 /tools
parentaf43187f4ebee3b093b65da8e2eedb6dac1d9d7c (diff)
add a script which builds i686-elf-binutils
Diffstat (limited to 'tools')
-rwxr-xr-xtools/dep_builders/binutils43
-rwxr-xr-xtools/dep_builders/dl9
2 files changed, 52 insertions, 0 deletions
diff --git a/tools/dep_builders/binutils b/tools/dep_builders/binutils
new file mode 100755
index 0000000..a7fc17f
--- /dev/null
+++ b/tools/dep_builders/binutils
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+TOOL="binutils"
+VER="2.37"
+# this is ugly
+{ HASHES=$(cat) ; } <<'HASHES'
+c44968b97cd86499efbc4b4ab7d98471f673e5414c554ef54afa930062dbbfcb toolchain/cache/binutils-2.37.tar.gz
+HASHES
+
+export PREFIX="$(pwd)/toolchain/$TOOL-$VER/"
+export TARGET=i686-elf
+
+
+# ensure that we're in the repo root
+if [ ! -d .git ]; then
+ echo please cd to the repo\'s main directory
+ exit
+fi
+
+mkdir -p $PREFIX/build
+
+
+echo "downloading missing files..."
+tools/dep_builders/dl "https://ftp.gnu.org/gnu/$TOOL/$TOOL-$VER.tar.gz"
+tools/dep_builders/dl "https://ftp.gnu.org/gnu/$TOOL/$TOOL-$VER.tar.gz.sig"
+tools/dep_builders/dl "https://ftp.gnu.org/gnu/gnu-keyring.gpg"
+
+echo "verifying signatures..."
+if ! gpg --verify --keyring toolchain/cache/gnu-keyring.gpg toolchain/cache/$TOOL-$VER.tar.gz.sig
+then
+ echo "THE SIGNATURE COULDN'T BE VERIFIED. something's fishy."
+ exit
+fi
+echo "$HASHES" | sha256sum --check || exit
+
+echo "unpacking the tarball..."
+tar xf toolchain/cache/$TOOL-$VER.tar.gz -C toolchain/cache
+
+echo "building..."
+cd $PREFIX/build
+../../cache/$TOOL-$VER/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
+make
+make install
diff --git a/tools/dep_builders/dl b/tools/dep_builders/dl
new file mode 100755
index 0000000..8cfeebc
--- /dev/null
+++ b/tools/dep_builders/dl
@@ -0,0 +1,9 @@
+#!/bin/sh
+# downloads a file to toolchain/cache unless it's already present there
+
+mkdir -p toolchain/cache
+OUT="toolchain/cache/$(basename $1)"
+
+[ -e "$OUT" ] && exit
+echo "downloading $1..."
+curl "$1" > $OUT