-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cross compilation toolchain building script (wip)
- Loading branch information
Showing
10 changed files
with
106 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
/target | ||
toolchain/ | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
toolchain/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Cross compilation | ||
|
||
This directory contains utilities to build a toolchain to be used to cross-compile packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# If the target is not specified, set to default | ||
if [ -z $TARGET ]; then | ||
export TARGET=i686-unknown-linux-musl | ||
fi | ||
|
||
# Prepare | ||
mkdir -p toolchain/repo | ||
PATH="$(pwd)/../target/release:$PATH" | ||
export SYSROOT="$(pwd)/toolchain/" | ||
export LOCAL_REPO="$(pwd)/toolchain/repo/" | ||
|
||
# binutils | ||
blimp-builder desc/binutils toolchain/repo/ | ||
yes | blimp install binutils | ||
|
||
# musl | ||
source ./env.sh | ||
HOST="$TARGET" blimp-builder desc/musl toolchain/repo/ | ||
unset CC LD CFLAGS LDFLAGS RUSTFLAGS | ||
yes | blimp install musl | ||
|
||
# TODO clang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
cd * | ||
|
||
mkdir build | ||
cd build | ||
|
||
# Compile | ||
../configure \ | ||
--prefix=/usr \ | ||
--build="$BUILD" \ | ||
--host="$HOST" \ | ||
--target="$TARGET" \ | ||
--disable-werror \ | ||
--enable-64-bit-bfd | ||
make -j${JOBS} | ||
|
||
# Install | ||
make DESTDIR=$SYSROOT install -j1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"sources": [ | ||
{ | ||
"location": "/", | ||
"url": "https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.gz" | ||
} | ||
], | ||
"package": { | ||
"name": "binutils", | ||
"version": "2.42", | ||
|
||
"description": "The GNU Binutils are a collection of binary tools.", | ||
|
||
"build_deps": [], | ||
"run_deps": [] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
cd * | ||
|
||
# Compile | ||
./configure \ | ||
--build="$BUILD" \ | ||
--host="$HOST" \ | ||
--target="$TARGET" \ | ||
--prefix="/usr" \ | ||
--enable-optimize \ | ||
--enable-shared | ||
make -j${JOBS} | ||
|
||
# Install | ||
make DESTDIR=$SYSROOT install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"sources": [ | ||
{ | ||
"location": "/", | ||
"url": "https://musl.libc.org/releases/musl-1.2.5.tar.gz" | ||
} | ||
], | ||
"package": { | ||
"name": "musl", | ||
"version": "1.2.5", | ||
|
||
"description": "musl is an implementation of the C standard library built on top of the Linux system call API, including interfaces defined in the base language standard, POSIX, and widely agreed-upon extensions.", | ||
|
||
"build_deps": [], | ||
"run_deps": [] | ||
} | ||
} |
11 changes: 5 additions & 6 deletions
11
scripts/cross_compile_env.sh → cross/env.sh
100644 → 100755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.