mirror of
https://github.com/lxsang/DiyaSDK.git
synced 2024-11-16 18:18:22 +01:00
one script to rule them all
This commit is contained in:
parent
5aa21655dd
commit
358fbf7bab
37
bin/build_base_image_diya.sh
Executable file
37
bin/build_base_image_diya.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
[ -z "$1" ] && echo "Please specify 32 or 64 bits architectuure" && exit 1
|
||||
echo "[Compiler] Adding more Kernel packages"
|
||||
ARCH="$1"
|
||||
W=$(realpath "$(dirname "$(realpath "$0")")/../")
|
||||
BASE_DIR="$W/$ARCH"
|
||||
rm "$BASE_DIR/tmp" -rf
|
||||
mkdir -p "$BASE_DIR/tmp/"
|
||||
cp "$BASE_DIR/bootstrap/bootstrap.image" "$BASE_DIR/tmp/diya.image"
|
||||
cp "$W"/unicode/* "$BASE_DIR/tmp/"
|
||||
cp -rf "$W"/fonts "$BASE_DIR"/tmp/
|
||||
VM="$BASE_DIR/builder/pharo"
|
||||
IMG="$BASE_DIR/tmp/diya.image"
|
||||
SRC_IMG="$BASE_DIR/builder/Pharo.image"
|
||||
|
||||
if [ ! -e "$SRC_IMG" ]; then
|
||||
mkdir -p "$BASE_DIR/builder/"
|
||||
cd "$BASE_DIR/builder/"
|
||||
curl "https://get.pharo.org/$ARCH/70+vm" | bash
|
||||
cd "$W"
|
||||
fi
|
||||
cp -rf "$W/fonts" "$BASE_DIR/builder/"
|
||||
|
||||
$VM "$SRC_IMG" "$W/install.st" --quit
|
||||
NAME="Diya-Bootstrap"
|
||||
$VM "$SRC_IMG" "$W/export.st" "$BASE_DIR/tmp" "$NAME" --quit
|
||||
echo "Creating image...."
|
||||
|
||||
$VM "$IMG"
|
||||
$VM "$IMG" loadHermes "$BASE_DIR/bootstrap/Hermes-Extensions.hermes" \
|
||||
"$BASE_DIR/bootstrap/TraitsV2.hermes" \
|
||||
"$BASE_DIR/tmp/$NAME.hermes" --on-duplication=ignore \
|
||||
--no-fail-on-undeclared --save --quit
|
||||
|
||||
#init the image
|
||||
$VM "$IMG" init --save
|
97
bin/diya
Executable file
97
bin/diya
Executable file
@ -0,0 +1,97 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
W=$(dirname "$(realpath "$0")")
|
||||
|
||||
diya_help() {
|
||||
cat << EOF
|
||||
Usage: diya <option> [param]
|
||||
|
||||
Options:
|
||||
-b|--build <32|64> build 32 or 64 bits image
|
||||
-s|--sdk <32|64> run 32 or 64 bits SDK
|
||||
-c|--clean <32|64> cleanup 23 or 64 bits outputs
|
||||
-r|--run <32|64> run the generated 32 or 64 bit
|
||||
-h|--help this help
|
||||
Examples:
|
||||
diya -b 64
|
||||
diya -s 64
|
||||
EOF
|
||||
}
|
||||
|
||||
check_arch()
|
||||
{
|
||||
ARCH=$1
|
||||
if [ "$ARCH" != "64" ] && [ "$ARCH" != "32" ];then
|
||||
echo "Invalid Architecture: $ARCH. Should be 32 or 64"
|
||||
diya_help
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
build()
|
||||
{
|
||||
ARCH=$1
|
||||
check_arch "$ARCH"
|
||||
"$W/build_base_image_diya.sh" "$ARCH"
|
||||
}
|
||||
|
||||
sdk()
|
||||
{
|
||||
ARCH=$1
|
||||
check_arch "$ARCH"
|
||||
if [ ! -e "$W/../$ARCH/builder/pharo-ui" ]; then
|
||||
build "$ARCH"
|
||||
[ ! -e "$W/../$ARCH/builder/pharo-ui" ] && echo "Unable to init SDK" && exit 1
|
||||
fi
|
||||
"$W/../$ARCH/builder/pharo-ui" "$W/../$ARCH/builder/Pharo.image"
|
||||
}
|
||||
|
||||
run()
|
||||
{
|
||||
ARCH=$1
|
||||
check_arch "$ARCH"
|
||||
if [ ! -e "$W/../$ARCH/builder/pharo" ]; then
|
||||
build "$ARCH"
|
||||
[ ! -e "$W/../$ARCH/builder/pharo" ] && echo "Unable to build image" && exit 1
|
||||
fi
|
||||
"$W/../$ARCH/builder/pharo" "$W/../$ARCH/tmp/diya.image"
|
||||
}
|
||||
|
||||
clean() {
|
||||
ARCH=$1
|
||||
check_arch "$ARCH"
|
||||
rm -rf "$W/../$ARCH/builder"
|
||||
rm -rf "$W/../$ARCH/tmp"
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-b|--build)
|
||||
build "$2"
|
||||
exit 0
|
||||
;;
|
||||
-s|--sdk)
|
||||
sdk "$2"
|
||||
exit 0
|
||||
;;
|
||||
-h|--help)
|
||||
diya_help
|
||||
exit 1
|
||||
;;
|
||||
-c|--clean)
|
||||
clean "$2"
|
||||
exit 0
|
||||
;;
|
||||
-r|--run)
|
||||
run "$2"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
diya_help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
diya_help
|
@ -1,37 +0,0 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
[ -z "$1" ] && echo "Please specify 32 or 64 bits architectuure" && exit 1
|
||||
echo "[Compiler] Adding more Kernel packages"
|
||||
ARCH="$1"
|
||||
W=$(dirname `realpath $0`)
|
||||
BASE_DIR="$W/$ARCH"
|
||||
rm "$BASE_DIR/tmp" -rf
|
||||
mkdir -p "$BASE_DIR/tmp/"
|
||||
cp $BASE_DIR/bootstrap/bootstrap.image $BASE_DIR/tmp/diya.image
|
||||
cp $W/unicode/* $BASE_DIR/tmp/
|
||||
cp -rf $W/fonts $BASE_DIR/tmp/
|
||||
VM=$BASE_DIR/builder/pharo
|
||||
IMG=$BASE_DIR/tmp/diya.image
|
||||
SRC_IMG=$BASE_DIR/builder/Pharo.image
|
||||
|
||||
if [ ! -e "$SRC_IMG" ]; then
|
||||
mkdir -p "$BASE_DIR/builder/"
|
||||
cd "$BASE_DIR/builder/"
|
||||
curl https://get.pharo.org/$ARCH/70+vm | bash
|
||||
cd $W
|
||||
fi
|
||||
cp -rf $W/fonts $BASE_DIR/builder/
|
||||
|
||||
$VM $SRC_IMG $W/install.st --quit
|
||||
NAME="Diya-Bootstrap"
|
||||
$VM $SRC_IMG $W/export.st "$BASE_DIR/tmp" "$NAME" --quit
|
||||
echo "Creating image...."
|
||||
|
||||
$VM $IMG
|
||||
$VM $IMG loadHermes $BASE_DIR/bootstrap/Hermes-Extensions.hermes \
|
||||
$BASE_DIR/bootstrap/TraitsV2.hermes \
|
||||
$BASE_DIR/tmp/$NAME.hermes --on-duplication=ignore \
|
||||
--no-fail-on-undeclared --save --quit
|
||||
|
||||
#init the image
|
||||
$VM $IMG init --save
|
Loading…
Reference in New Issue
Block a user