Last active
February 21, 2019 14:12
-
-
Save nanpuyue/7b314ad1da77d3798a23cbfed397fbf7 to your computer and use it in GitHub Desktop.
build rust toolchain for mips-unknown-linux-musl
This file contains hidden or 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
| #!/bin/bash | |
| # file: build_mips-unknown-linux-musl.sh | |
| # date: 2018-12-24 | |
| # license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt | |
| # author: nanpuyue <[email protected]> https://blog.nanpuyue.com | |
| export LC_ALL=C | |
| export STAGING_DIR="/build/openwrt-sdk-18.06.1/staging_dir" | |
| export TOOLCHAIN="toolchain-mips_24kc_gcc-7.3.0_musl" | |
| export PATH="$STAGING_DIR/$TOOLCHAIN/bin/:$PATH" | |
| export AR_mips_unknown_linux_musl="mips-openwrt-linux-musl-ar" | |
| export CC_mips_unknown_linux_musl="mips-openwrt-linux-musl-gcc" | |
| export CXX_mips_unknown_linux_musl="mips-openwrt-linux-musl-g++" | |
| export CFLAGS_mips_unknown_linux_musl="-I$STAGING_DIR/$TOOLCHAIN/inculde \ | |
| -I$STAGING_DIR/target-mips_24kc_musl/usr/inculde \ | |
| -L$STAGING_DIR/$TOOLCHAIN/lib \ | |
| -L$STAGING_DIR/target-mips_24kc_musl/usr/lib" | |
| export MIPS_UNKNOWN_LINUX_MUSL_OPENSSL_STATIC=1 | |
| export MIPS_UNKNOWN_LINUX_MUSL_OPENSSL_DIR="$STAGING_DIR/target-mips_24kc_musl/usr" | |
| export PKG_CONFIG_ALLOW_CROSS=1 | |
| export > env | |
| ./configure --release-channel=stable \ | |
| --musl-root-mips="$STAGING_DIR/$TOOLCHAIN" \ | |
| --set target.mips-unknown-linux-musl.linker="$CC_mips_unknown_linux_musl" \ | |
| --set target.mips-unknown-linux-musl.ar="$AR_mips_unknown_linux_musl" | |
| ./x.py dist --host mips-unknown-linux-musl --target mips-unknown-linux-musl -i -j4 | |
| TARGET_CC="mips-openwrt-linux-musl-gcc" ./x.py dist cargo \ | |
| --host mips-unknown-linux-musl --target mips-unknown-linux-musl \ | |
| --keep-stage 0 --keep-stage 1 --stage 2 -i -j4 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
before building:
download and extract openwrt sdk
update and install feeds
build libcurl with openssl & http2
build libunwind and get libunwind.a
patch
feeds/base/package/libs/libunwind/Makefilewith:build xz
do something else