-
-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Valerian Saliou <[email protected]>
- Loading branch information
1 parent
29ddf5a
commit 961bab9
Showing
4 changed files
with
94 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[build.env] | ||
passthrough = [ | ||
"RUSTFLAGS" | ||
] | ||
|
||
[target.x86_64-unknown-linux-musl] | ||
image = "valeriansaliou/sonic:cross-x86_64-unknown-linux-musl" | ||
|
||
[target.armv7-unknown-linux-musleabihf] | ||
image = "valeriansaliou/sonic:cross-armv7-unknown-linux-musleabihf" |
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,76 @@ | ||
#!/bin/bash | ||
|
||
## | ||
# Sonic | ||
# | ||
# Fast, lightweight and schema-less search backend | ||
# Copyright: 2020, Valerian Saliou <[email protected]> | ||
# License: Mozilla Public License v2.0 (MPL v2.0) | ||
## | ||
|
||
# Read arguments | ||
while [ "$1" != "" ]; do | ||
argument_key=`echo $1 | awk -F= '{print $1}'` | ||
argument_value=`echo $1 | awk -F= '{print $2}'` | ||
|
||
case $argument_key in | ||
-v | --version) | ||
SONIC_VERSION="$argument_value" | ||
;; | ||
*) | ||
echo "Unknown argument received: '$argument_key'" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
shift | ||
done | ||
|
||
# Ensure release version is provided | ||
if [ -z "$SONIC_VERSION" ]; then | ||
echo "No Sonic release version was provided, please provide it using '--version'" | ||
|
||
exit 1 | ||
fi | ||
|
||
# Define release pipeline | ||
function release_for_architecture { | ||
final_tar="v$SONIC_VERSION-$1.tar.gz" | ||
|
||
rm -rf ./sonic/ && \ | ||
RUSTFLAGS="-C target-feature=-crt-static -C link-arg=-s" cross build --target "$2" --release && \ | ||
mkdir ./sonic && \ | ||
cp -p "target/$2/release/sonic" ./sonic/ && \ | ||
cp -r ./config.cfg sonic/ && \ | ||
tar -czvf "$final_tar" ./sonic && \ | ||
rm -r ./sonic/ | ||
release_result=$? | ||
|
||
if [ $release_result -eq 0 ]; then | ||
echo "Result: Packed architecture: $1 to file: $final_tar" | ||
fi | ||
|
||
return $release_result | ||
} | ||
|
||
# Run release tasks | ||
ABSPATH=$(cd "$(dirname "$0")"; pwd) | ||
BASE_DIR="$ABSPATH/../" | ||
|
||
rc=0 | ||
|
||
pushd "$BASE_DIR" > /dev/null | ||
echo "Executing release steps for Sonic v$SONIC_VERSION..." | ||
|
||
release_for_architecture "x86_64" "x86_64-unknown-linux-musl" && \ | ||
release_for_architecture "armv7" "armv7-unknown-linux-musleabihf" | ||
rc=$? | ||
|
||
if [ $rc -eq 0 ]; then | ||
echo "Success: Done executing release steps for Sonic v$SONIC_VERSION" | ||
else | ||
echo "Error: Failed executing release steps for Sonic v$SONIC_VERSION" | ||
fi | ||
popd > /dev/null | ||
|
||
exit $rc |
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,4 @@ | ||
FROM rustembedded/cross:armv7-unknown-linux-musleabihf-0.2.0 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y clang libclang-dev libc6-dev-i386 |
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,4 @@ | ||
FROM rustembedded/cross:x86_64-unknown-linux-musl-0.2.0 | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y clang libclang-dev libc6-dev-i386 |