[354] | 1 | #!/usr/bin/env bash
|
---|
| 2 | set -eu
|
---|
| 3 |
|
---|
| 4 | if [ ! -v SCRIPTS_DIR ]; then
|
---|
[355] | 5 | SCRIPTS_DIR=$(cd $(dirname $0);pwd)
|
---|
[354] | 6 | fi
|
---|
| 7 |
|
---|
| 8 | if [ ! -v WORK_DIR ]; then
|
---|
| 9 | WORK_DIR=$HOME/workdir
|
---|
| 10 | fi
|
---|
| 11 |
|
---|
| 12 | SSP_DIR=$WORK_DIR/ssp
|
---|
| 13 | SSP_PACKAGE=ssp-1.3.0.tar.gz
|
---|
| 14 | SSP_DOWNLOAD_URL=http://www.toppers.jp/download.cgi/$SSP_PACKAGE
|
---|
| 15 | SSP_RUBYCFG_FILES_URL=http://dev.toppers.jp/svn_user/contrib/rubycfg_ssp/trunk
|
---|
| 16 | SSP_TARGET_NAME=qemu_virt_gcc
|
---|
| 17 |
|
---|
| 18 | ASP3_DIR=$WORK_DIR/asp3
|
---|
| 19 | ASP3_PACKAGE=asp3-3.1.0.tar.gz
|
---|
| 20 | ASP3_DOWNLOAD_URL=https://www.toppers.jp/download.cgi/$ASP3_PACKAGE
|
---|
| 21 |
|
---|
| 22 | : "setup tools (compiler, emulator, etc.)" && {
|
---|
| 23 | $SCRIPTS_DIR/setup_tools.sh
|
---|
| 24 | . $HOME/.profile
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | : "Download TOPPERS/ASP3 package to get a configurator files" && {
|
---|
| 28 | cd $WORK_DIR
|
---|
| 29 | if [ ! -e $ASP3_DIR ]; then
|
---|
| 30 | if [ ! -e $ASP3_PACKAGE ]; then
|
---|
| 31 | curl $ASP3_DOWNLOAD_URL -o $ASP3_PACKAGE
|
---|
| 32 | fi
|
---|
| 33 | tar xvf $ASP3_PACKAGE
|
---|
| 34 | fi
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | : "if ssp directory already exists, rename it and create new directory" && {
|
---|
| 38 | cd $WORK_DIR
|
---|
| 39 | if [ -e $SSP_DIR ]; then
|
---|
| 40 | mv $SSP_DIR $SSP_DIR.$(date +%Y%m%d_%H%M%S)
|
---|
| 41 | fi
|
---|
| 42 |
|
---|
| 43 | if [ ! -e $SSP_PACKAGE ]; then
|
---|
| 44 | curl $SSP_DOWNLOAD_URL -o $SSP_PACKAGE
|
---|
| 45 | fi
|
---|
| 46 |
|
---|
| 47 | mkdir $SSP_DIR
|
---|
| 48 | tar xvf $SSP_PACKAGE -C $SSP_DIR --strip-components 2
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | : "setup source code(convert to UTF8, patch, etc.)" && {
|
---|
| 52 | for i in `find $SSP_DIR -type f` ; do nkf --overwrite --oc=UTF-8 $i; done
|
---|
| 53 | cp -a $ASP3_DIR/sample/Makefile $SSP_DIR/sample
|
---|
| 54 |
|
---|
| 55 | svn co $SSP_RUBYCFG_FILES_URL rubycfg_ssp
|
---|
| 56 | rubycfg_ssp/install.sh $SSP_DIR
|
---|
| 57 |
|
---|
| 58 | $SCRIPTS_DIR/install.sh $SSP_DIR
|
---|
| 59 |
|
---|
| 60 | cd $SSP_DIR
|
---|
| 61 | ln -s $ASP3_DIR/configure.rb configure.rb
|
---|
| 62 | ln -s $ASP3_DIR/cfg cfg
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | : "build a kernel" && {
|
---|
| 66 | cd $SSP_DIR
|
---|
| 67 | if [ -e build ]; then
|
---|
| 68 | mv build build.$(date +%Y%m%d_%H%M%S)
|
---|
| 69 | fi
|
---|
| 70 | mkdir build
|
---|
| 71 | cd build
|
---|
| 72 | ../configure.rb -T $SSP_TARGET_NAME -w
|
---|
| 73 | make
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | exit 0
|
---|